mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
memory: add address_space_destroy()
Since address spaces can be created dynamically by device hotplug, they can also be destroyed dynamically. Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
b90600eed3
commit
83f3c25142
4 changed files with 39 additions and 2 deletions
18
memory.c
18
memory.c
|
@ -564,8 +564,10 @@ static FlatView generate_memory_topology(MemoryRegion *mr)
|
|||
|
||||
flatview_init(&view);
|
||||
|
||||
render_memory_region(&view, mr, int128_zero(),
|
||||
addrrange_make(int128_zero(), int128_2_64()), false);
|
||||
if (mr) {
|
||||
render_memory_region(&view, mr, int128_zero(),
|
||||
addrrange_make(int128_zero(), int128_2_64()), false);
|
||||
}
|
||||
flatview_simplify(&view);
|
||||
|
||||
return view;
|
||||
|
@ -1542,6 +1544,18 @@ void address_space_init(AddressSpace *as, MemoryRegion *root)
|
|||
address_space_init_dispatch(as);
|
||||
}
|
||||
|
||||
void address_space_destroy(AddressSpace *as)
|
||||
{
|
||||
/* Flush out anything from MemoryListeners listening in on this */
|
||||
memory_region_transaction_begin();
|
||||
as->root = NULL;
|
||||
memory_region_transaction_commit();
|
||||
QTAILQ_REMOVE(&address_spaces, as, address_spaces_link);
|
||||
address_space_destroy_dispatch(as);
|
||||
flatview_destroy(as->current_map);
|
||||
g_free(as->current_map);
|
||||
}
|
||||
|
||||
uint64_t io_mem_read(MemoryRegion *mr, target_phys_addr_t addr, unsigned size)
|
||||
{
|
||||
return memory_region_dispatch_read(mr, addr, size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue