From: Alexander Barabash <alexander_barabash@mentor.com>
To: qemu-devel@nongnu.org
Cc: Alexander Barabash <alexander_barabash@mentor.com>
Subject: [Qemu-devel] [PATCH 1/1] memory: add name in AddressSpace initialization.
Date: Tue, 8 Jan 2013 13:22:42 +0200 [thread overview]
Message-ID: <1357644162-28824-1-git-send-email-alexander_barabash@mentor.com> (raw)
In-Reply-To: <1357560425-15950-1-git-send-email-alexander_barabash@mentor.com>
Pass the AddressSpace's name (to be used for debugging)
to address_space_init(). If NULL is passed, the name
of root memory region is used instead.
Signed-off-by: Alexander Barabash <alexander_barabash@mentor.com>
---
exec.c | 6 ++----
hw/pci/pci.c | 3 ++-
include/exec/memory.h | 5 +++--
memory.c | 5 +++--
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/exec.c b/exec.c
index a6923ad..4637c28 100644
--- a/exec.c
+++ b/exec.c
@@ -1784,13 +1784,11 @@ static void memory_map_init(void)
{
system_memory = g_malloc(sizeof(*system_memory));
memory_region_init(system_memory, "system", INT64_MAX);
- address_space_init(&address_space_memory, system_memory);
- address_space_memory.name = "memory";
+ address_space_init(&address_space_memory, system_memory, "memory");
system_io = g_malloc(sizeof(*system_io));
memory_region_init(system_io, "io", 65536);
- address_space_init(&address_space_io, system_io);
- address_space_io.name = "I/O";
+ address_space_init(&address_space_io, system_io, "I/O");
memory_listener_register(&core_memory_listener, &address_space_memory);
memory_listener_register(&io_memory_listener, &address_space_io);
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 94840c4..6cc3abe 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -790,7 +790,8 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
get_system_memory(), 0,
memory_region_size(get_system_memory()));
memory_region_set_enabled(&pci_dev->bus_master_enable_region, false);
- address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_enable_region);
+ address_space_init(&pci_dev->bus_master_as,
+ &pci_dev->bus_master_enable_region, NULL);
pci_dev->dma = g_new(DMAContext, 1);
dma_context_init(pci_dev->dma, &pci_dev->bus_master_as, NULL, NULL, NULL);
}
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 2322732..cb79a65 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -817,9 +817,10 @@ void mtree_info(fprintf_function mon_printf, void *f);
*
* @as: an uninitialized #AddressSpace
* @root: a #MemoryRegion that routes addesses for the address space
+ * @name: used for debugging. If NULL, name of the root memory region is used.
*/
-void address_space_init(AddressSpace *as, MemoryRegion *root);
-
+void address_space_init(AddressSpace *as, MemoryRegion *root,
+ const char *name);
/**
* address_space_destroy: destroy an address space
diff --git a/memory.c b/memory.c
index 410c5f8..ab3b136 100644
--- a/memory.c
+++ b/memory.c
@@ -1562,14 +1562,14 @@ void memory_listener_unregister(MemoryListener *listener)
QTAILQ_REMOVE(&memory_listeners, listener, link);
}
-void address_space_init(AddressSpace *as, MemoryRegion *root)
+void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
{
memory_region_transaction_begin();
as->root = root;
as->current_map = g_new(FlatView, 1);
flatview_init(as->current_map);
QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);
- as->name = NULL;
+ as->name = g_strdup(name ? name : root->name);
memory_region_transaction_commit();
address_space_init_dispatch(as);
}
@@ -1584,6 +1584,7 @@ void address_space_destroy(AddressSpace *as)
address_space_destroy_dispatch(as);
flatview_destroy(as->current_map);
g_free(as->current_map);
+ g_free((char *)as->name);
}
uint64_t io_mem_read(MemoryRegion *mr, hwaddr addr, unsigned size)
--
1.7.9.5
next prev parent reply other threads:[~2013-01-08 11:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-07 12:07 [Qemu-devel] [PATCH 1/1] Added address_space_init2() Alexander Barabash
2013-01-07 13:05 ` Andreas Färber
2013-01-08 10:53 ` Alexander Barabash
2013-01-08 11:22 ` Alexander Barabash [this message]
2013-01-08 14:00 ` [Qemu-devel] [PATCH 1/1] memory: add name in AddressSpace initialization Anthony Liguori
2013-01-08 18:28 ` Alexander Barabash
2013-01-08 19:18 ` [Qemu-devel] [PATCH v3 " Alexander Barabash
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357644162-28824-1-git-send-email-alexander_barabash@mentor.com \
--to=alexander_barabash@mentor.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).