From 946d6154aba9aaa4d19433a6a8bcd3de3b119240 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Fri, 5 Oct 2018 11:20:17 +0200 Subject: memory-device: add and use memory_device_get_region_size() We will factor out get_memory_region() from pc-dimm to memory device code soon. Once that is done, get_region_size() can be implemented generically and essentially be replaced by memory_device_get_region_size (and work only on get_memory_region()). We have some users of get_memory_region() (spapr and pc-dimm code) that are only interested in the size. So let's rework them to use memory_device_get_region_size() first, then we can factor out get_memory_region() and eventually remove get_region_size() without touching the same code multiple times. Reviewed-by: David Gibson Reviewed-by: Igor Mammedov Signed-off-by: David Hildenbrand Message-Id: <20181005092024.14344-10-david@redhat.com> Signed-off-by: Eduardo Habkost --- include/hw/mem/memory-device.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/hw/mem/memory-device.h') diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h index 0474a3dd11..898df3057d 100644 --- a/include/hw/mem/memory-device.h +++ b/include/hw/mem/memory-device.h @@ -83,5 +83,7 @@ uint64_t memory_device_get_free_addr(MachineState *ms, const uint64_t *hint, void memory_device_plug_region(MachineState *ms, MemoryRegion *mr, uint64_t addr); void memory_device_unplug_region(MachineState *ms, MemoryRegion *mr); +uint64_t memory_device_get_region_size(const MemoryDeviceState *md, + Error **errp); #endif -- cgit 1.4.1