From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US1DU-0002x4-D1 for qemu-devel@nongnu.org; Tue, 16 Apr 2013 04:26:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1US1DR-0004rX-N7 for qemu-devel@nongnu.org; Tue, 16 Apr 2013 04:26:16 -0400 Received: from mail-la0-x22e.google.com ([2a00:1450:4010:c03::22e]:54831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US1DR-0004q6-Fq for qemu-devel@nongnu.org; Tue, 16 Apr 2013 04:26:13 -0400 Received: by mail-la0-f46.google.com with SMTP id ea20so223407lab.5 for ; Tue, 16 Apr 2013 01:26:11 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1366067974-5413-4-git-send-email-scottwood@freescale.com> References: <1360823521-32306-1-git-send-email-scottwood@freescale.com> <1366067974-5413-1-git-send-email-scottwood@freescale.com> <1366067974-5413-4-git-send-email-scottwood@freescale.com> From: Peter Maydell Date: Tue, 16 Apr 2013 09:25:50 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [RFC PATCH v2 3/6] memory: add memory_region_to_address() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Scott Wood Cc: qemu-ppc@nongnu.org, Alexander Graf , qemu-devel@nongnu.org On 16 April 2013 00:19, Scott Wood wrote: > This is useful for when a user of the memory region API needs to > communicate the absolute bus address to something outside QEMU > (in particular, KVM). > > Signed-off-by: Scott Wood > --- > TODO: Use add/del memory listeners later in the patchset, which would > eliminate the need for this patch. Yes, please do. > +/* memory_region_to_address: Find the full address of the start of the > + * given #MemoryRegion, ignoring aliases. There is no guarantee > + * that the #MemoryRegion is actually visible at this address, if > + * there are overlapping regions. > + * > + * @mr: #MemoryRegion being queried > + * @asp: if non-NULL, returns the #AddressSpace @mr is mapped in, if any > + */ > +hwaddr memory_region_to_address(MemoryRegion *mr, AddressSpace **asp); A MemoryRegion can appear in more than one AddressSpace (or none at all), so I don't think this is a very clearly defined API to put in the memory API itself. (It's ok to make that kind of assumption as a user of the memory APIs for particular cases, eg in how a memory listener callback function behaves. But we shouldn't be baking those assumptions into new API functions.) thanks -- PMM