From 2cc0e2e8140f43ccc6aced6e47c9c2db15ce2330 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Mon, 23 Apr 2018 18:51:16 +0200 Subject: pc-dimm: factor out MemoryDevice interface On the qmp level, we already have the concept of memory devices: "query-memory-devices" Right now, we only support NVDIMM and PCDIMM. We want to map other devices later into the address space of the guest. Such device could e.g. be virtio devices. These devices will have a guest memory range assigned but won't be exposed via e.g. ACPI. We want to make them look like memory device, but not glued to pc-dimm. Especially, it will not always be possible to have TYPE_PC_DIMM as a parent class (e.g. virtio devices). Let's use an interface instead. As a first part, convert handling of - qmp_pc_dimm_device_list - get_plugged_memory_size to our new model. plug/unplug stuff etc. will follow later. A memory device will have to provide the following functions: - get_addr(): Necessary, as the property "addr" can e.g. not be used for virtio devices (already defined). - get_plugged_size(): The amount this device offers to the guest as of now. - get_region_size(): Because this can later on be bigger than the plugged size. - fill_device_info(): Fill MemoryDeviceInfo, e.g. for qmp. Reviewed-by: David Gibson Signed-off-by: David Hildenbrand Message-Id: <20180423165126.15441-2-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- stubs/qmp_memory_device.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 stubs/qmp_memory_device.c (limited to 'stubs/qmp_memory_device.c') diff --git a/stubs/qmp_memory_device.c b/stubs/qmp_memory_device.c new file mode 100644 index 0000000000..85ff8f2d7e --- /dev/null +++ b/stubs/qmp_memory_device.c @@ -0,0 +1,13 @@ +#include "qemu/osdep.h" +#include "qom/object.h" +#include "hw/mem/memory-device.h" + +MemoryDeviceInfoList *qmp_memory_device_list(void) +{ + return NULL; +} + +uint64_t get_plugged_memory_size(void) +{ + return (uint64_t)-1; +} -- cgit v1.2.1