diff mbox series

[v2,09/16] memory-device: properly deal with resizable memory regions

Message ID 20200212133601.10555-10-david@redhat.com (mailing list archive)
State New, archived
Headers show
Series Ram blocks with resizable anonymous allocations under POSIX | expand

Commit Message

David Hildenbrand Feb. 12, 2020, 1:35 p.m. UTC
In case we are dealing with resizable memory regions, we always have to
assign space in the physical address space which can fit the maximum
region size.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 hw/mem/memory-device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c
index 4bc9cf0917..32d0c5d334 100644
--- a/hw/mem/memory-device.c
+++ b/hw/mem/memory-device.c
@@ -269,7 +269,7 @@  void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
     align = legacy_align ? *legacy_align : memory_region_get_alignment(mr);
     addr = mdc->get_addr(md);
     addr = memory_device_get_free_addr(ms, !addr ? NULL : &addr, align,
-                                       memory_region_size(mr), &local_err);
+                                       memory_region_max_size(mr), &local_err);
     if (local_err) {
         goto out;
     }
@@ -329,7 +329,7 @@  uint64_t memory_device_get_region_size(const MemoryDeviceState *md,
         return 0;
     }
 
-    return memory_region_size(mr);
+    return memory_region_max_size(mr);
 }
 
 static const TypeInfo memory_device_info = {