From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZMlj-0008US-NE for qemu-devel@nongnu.org; Mon, 06 May 2013 10:52:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZMli-0005QJ-I4 for qemu-devel@nongnu.org; Mon, 06 May 2013 10:51:59 -0400 Received: from goliath.siemens.de ([192.35.17.28]:33005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZMli-0005Q0-7T for qemu-devel@nongnu.org; Mon, 06 May 2013 10:51:58 -0400 Message-ID: <5187C388.8070202@siemens.com> Date: Mon, 06 May 2013 16:51:52 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <71c94383d7247e68bfbd45786227844e37f330ce.1367849167.git.jan.kiszka@siemens.com> <5187C08A.9060702@redhat.com> In-Reply-To: <5187C08A.9060702@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC][PATCH 09/15] memory: Introduce address_space_lookup_region List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Liu Ping Fan , qemu-devel , =?ISO-8859-15?Q?Andreas_F=E4rbe?= =?ISO-8859-15?Q?r?= On 2013-05-06 16:39, Paolo Bonzini wrote: > Il 06/05/2013 16:26, Jan Kiszka ha scritto: >> This new service so far only replaces phys_page_find as public API. In a >> follow-up step, it will return the effective memory region for the >> specified address, i.e. after resolving what are currently sub-pages. >> Moreover, it will also once encapsulate locking and reference counting >> when we introduce BQL-free dispatching. > > In my IOMMU rebase I have a similar function: > > /* address_space_translate: translate an address range into an address space > * into a MemoryRegionSection and an address range into that section. > * > * @as: #AddressSpace to be accessed > * @addr: address within that address space > * @xlat: pointer to address within the returned memory region section's > * #MemoryRegion. > * @len: pointer to length > * @is_write: indicates the transfer direction > */ > MemoryRegionSection *address_space_translate(AddressSpace *as, hwaddr addr, > hwaddr *xlat, hwaddr *len, > bool is_write); > > It wraps (actually, replaces) both phys_page_find and > memory_region_section_addr. Good, looks like we are heading in similar directions. What is the purpose of len? When does is_write matter? In a later step, this should become something like address_space_get_region_ref (to be paired with memory_region_unref, once done). So this one also takes care of incrementing the reference counter or acquiring the BQL, as necessary. Currently, it asks the caller to specify if the BQL is already held, but that will change. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux