From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tsduj-00068F-VR for qemu-devel@nongnu.org; Tue, 08 Jan 2013 13:28:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tsdui-0003lV-J2 for qemu-devel@nongnu.org; Tue, 08 Jan 2013 13:28:41 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:53463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tsdui-0003lF-DE for qemu-devel@nongnu.org; Tue, 08 Jan 2013 13:28:40 -0500 Message-ID: <50EC654E.8030405@mentor.com> Date: Tue, 8 Jan 2013 20:28:30 +0200 From: Alexander Barabash MIME-Version: 1.0 References: <1357560425-15950-1-git-send-email-alexander_barabash@mentor.com> <1357644162-28824-1-git-send-email-alexander_barabash@mentor.com> <87k3rn22s9.fsf@codemonkey.ws> In-Reply-To: <87k3rn22s9.fsf@codemonkey.ws> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/1] memory: add name in AddressSpace initialization. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org On 01/08/2013 04:00 PM, Anthony Liguori wrote: > Alexander Barabash writes: > >> 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. >> >> @@ -1784,13 +1784,11 @@ static void memory_map_init(void) ... >> 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"); > It's best to avoid special characters in names. It will make a > conversion to QOM later a lot easier. So s:I/O:IO:g' I did not change the name of this address space. We can do it in a separate patch. >> --- 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); > Please top-post new patches. I assume you this to mean, "post new patches as reply to the previous one". ) OK > Any reason to not name this address space? It was not named previously. Now, it will pick up the name from the root memory region, passed to the same call. > Regards, > > Anthony Liguori Regards, Alex Barabash > > >> 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