Now all AddressSpace instances are converted to QOM so drop
non-QOM AddressSpace support.
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
---
include/system/memory.h | 13 -------------
system/memory.c | 26 +++++---------------------
2 files changed, 5 insertions(+), 34 deletions(-)
diff --git a/include/system/memory.h b/include/system/memory.h
index 5108e0fba339..9b249b4b3ae2 100644
--- a/include/system/memory.h
+++ b/include/system/memory.h
@@ -1163,8 +1163,6 @@ struct AddressSpace {
/* private: */
Object parent_obj;
struct rcu_head rcu;
- bool qom;
- char *name;
MemoryRegion *root;
/* Accessed via RCU. */
@@ -2719,17 +2717,6 @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr,
void address_space_init(AddressSpace *as, Object *parent, MemoryRegion *root,
const char *name);
-/**
- * address_space_destroy: destroy an address space
- *
- * Releases all resources associated with an address space. After an address space
- * is destroyed, its root memory region (given by address_space_init()) may be destroyed
- * as well.
- *
- * @as: address space to be destroyed
- */
-void address_space_destroy(AddressSpace *as);
-
/**
* address_space_get_path: get the path to an address space
*
diff --git a/system/memory.c b/system/memory.c
index 7a77ba0f1797..363f50e7a4f0 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -3206,11 +3206,7 @@ void address_space_remove_listeners(AddressSpace *as)
void address_space_init(AddressSpace *as, Object *parent, MemoryRegion *root,
const char *name)
{
- if (parent) {
- object_initialize_child(parent, name, as, TYPE_ADDRESS_SPACE);
- }
-
- as->qom = parent;
+ object_initialize_child(parent, name, as, TYPE_ADDRESS_SPACE);
memory_region_ref(root);
as->root = root;
as->current_map = NULL;
@@ -3222,12 +3218,11 @@ void address_space_init(AddressSpace *as, Object *parent, MemoryRegion *root,
as->bounce_buffer_size = 0;
qemu_mutex_init(&as->map_client_list_lock);
QLIST_INIT(&as->map_client_list);
- as->name = g_strdup(name ? name : "anonymous");
address_space_update_topology(as);
address_space_update_ioeventfds(as);
}
-static void do_address_space_destroy(struct rcu_head *head)
+static void do_address_space_finalize(struct rcu_head *head)
{
AddressSpace *as = container_of(head, AddressSpace, rcu);
@@ -3238,18 +3233,13 @@ static void do_address_space_destroy(struct rcu_head *head)
assert(QTAILQ_EMPTY(&as->listeners));
flatview_unref(as->current_map);
- g_free(as->name);
g_free(as->ioeventfds);
memory_region_unref(as->root);
}
static void address_space_finalize(Object *obj)
{
- address_space_destroy(ADDRESS_SPACE(obj));
-}
-
-void address_space_destroy(AddressSpace *as)
-{
+ AddressSpace *as = ADDRESS_SPACE(obj);
MemoryRegion *root = as->root;
/* Flush out anything from MemoryListeners listening in on this */
@@ -3263,18 +3253,12 @@ void address_space_destroy(AddressSpace *as)
* values to expire before freeing the data.
*/
as->root = root;
- call_rcu1(&as->rcu, do_address_space_destroy);
+ call_rcu1(&as->rcu, do_address_space_finalize);
}
char *address_space_get_path(AddressSpace *as)
{
- char *path;
-
- if (!as->qom) {
- return as->name;
- }
-
- path = object_get_canonical_path(OBJECT(as));
+ char *path = object_get_canonical_path(OBJECT(as));
return path ? path : g_strdup("orphan");
}
--
2.51.0