aboutsummaryrefslogtreecommitdiff
path: root/include/hw/mem
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2023-06-22 12:18:23 +0200
committerMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2023-11-03 20:26:59 +0100
commit6c1b28e9e405da8cfb7296b9efa2b85650086784 (patch)
tree082f57ac757c83839d79c900539ff6e225dfe10d /include/hw/mem
parentd762bf97931b58839316b68a570eecc6143c9e3e (diff)
memory-device: Support empty memory devices
Let's support empty memory devices -- memory devices that don't have a memory device region in the current configuration. hv-balloon with an optional memdev is the primary use case. Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Diffstat (limited to 'include/hw/mem')
-rw-r--r--include/hw/mem/memory-device.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index 3354d6c166..a1d62cc551 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -38,6 +38,10 @@ typedef struct MemoryDeviceState MemoryDeviceState;
* address in guest physical memory can either be specified explicitly
* or get assigned automatically.
*
+ * Some memory device might not own a memory region in certain device
+ * configurations. Such devices can logically get (un)plugged, however,
+ * empty memory devices are mostly ignored by the memory device code.
+ *
* Conceptually, memory devices only span one memory region. If multiple
* successive memory regions are used, a covering memory region has to
* be provided. Scattered memory regions are not supported for single
@@ -91,7 +95,8 @@ struct MemoryDeviceClass {
uint64_t (*get_plugged_size)(const MemoryDeviceState *md, Error **errp);
/*
- * Return the memory region of the memory device.
+ * Return the memory region of the memory device. If the device is
+ * completely empty, returns NULL without an error.
*
* Called when (un)plugging the memory device, to (un)map the
* memory region in guest physical memory, but also to detect the