mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
memory-device: complete factoring out unplug handling
With the new memory device functions in place, we can factor out unplugging 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-16-david@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
55d67a0492
commit
8288590d23
3 changed files with 11 additions and 7 deletions
|
@ -290,9 +290,16 @@ void memory_device_plug(MemoryDeviceState *md, MachineState *ms)
|
|||
addr - ms->device_memory->base, mr);
|
||||
}
|
||||
|
||||
void memory_device_unplug_region(MachineState *ms, MemoryRegion *mr)
|
||||
void memory_device_unplug(MemoryDeviceState *md, MachineState *ms)
|
||||
{
|
||||
/* we expect a previous call to memory_device_get_free_addr() */
|
||||
const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(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_del_subregion(&ms->device_memory->mr, mr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue