summaryrefslogtreecommitdiff
path: root/include/hw/mem
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2020-10-08 10:30:28 +0200
committerMichael S. Tsirkin <mst@redhat.com>2020-11-03 07:19:26 -0500
commitc726aa69419ba2ecd38ae14dc62aaa189c3510e5 (patch)
tree87a523b3e81c94a3152af5aaa6db73101a41b551 /include/hw/mem
parent780a4d24e73dd0a7c7fc3f6f8b104aab70b7bfff (diff)
downloadqemu-c726aa69419ba2ecd38ae14dc62aaa189c3510e5.zip
memory-device: Add get_min_alignment() callback
Add a callback that can be used to express additional alignment requirements (exceeding the ones from the memory region). Will be used by virtio-mem to express special alignment requirements due to manually configured, big block sizes (e.g., 1GB with an ordinary memory-backend-ram). This avoids failing later when realizing, because auto-detection wasn't able to assign a properly aligned address. Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Wei Yang <richardw.yang@linux.intel.com> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20201008083029.9504-6-david@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/mem')
-rw-r--r--include/hw/mem/memory-device.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index 30d7e99f52..48d2611fc5 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -89,6 +89,16 @@ struct MemoryDeviceClass {
MemoryRegion *(*get_memory_region)(MemoryDeviceState *md, Error **errp);
/*
+ * Optional: Return the desired minimum alignment of the device in guest
+ * physical address space. The final alignment is computed based on this
+ * alignment and the alignment requirements of the memory region.
+ *
+ * Called when plugging the memory device to detect the required alignment
+ * during address assignment.
+ */
+ uint64_t (*get_min_alignment)(const MemoryDeviceState *md);
+
+ /*
* Translate the memory device into #MemoryDeviceInfo.
*/
void (*fill_device_info)(const MemoryDeviceState *md,