diff options
author | David Hildenbrand <david@redhat.com> | 2018-10-05 11:20:22 +0200 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2018-10-24 06:44:59 -0300 |
commit | 55d67a04923488cb27f470b37896dde7a8dc0366 (patch) | |
tree | 7aff2f663697dd174ba4c26561e21c68636e52f9 /hw/mem/memory-device.c | |
parent | 6ef2c0f2c162c3cae30f235c8d27ee7b0c37a1ab (diff) |
memory-device: complete factoring out plug handling
With the new memory device functions in place, we can factor out
plugging of memory devices completely.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181005092024.14344-15-david@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/mem/memory-device.c')
-rw-r--r-- | hw/mem/memory-device.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index aa4ddd5918..6569896b7e 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -273,10 +273,17 @@ out: error_propagate(errp, local_err); } -void memory_device_plug_region(MachineState *ms, MemoryRegion *mr, - uint64_t addr) +void memory_device_plug(MemoryDeviceState *md, MachineState *ms) { - /* we expect a previous call to memory_device_get_free_addr() */ + const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(md); + const uint64_t addr = mdc->get_addr(md); + MemoryRegion *mr; + + /* + * We expect that a previous call to memory_device_pre_plug() succeeded, so + * it can't fail at this point. + */ + mr = mdc->get_memory_region(md, &error_abort); g_assert(ms->device_memory); memory_region_add_subregion(&ms->device_memory->mr, |