From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qzeqx-000568-R5 for qemu-devel@nongnu.org; Fri, 02 Sep 2011 21:17:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qzeqw-0006zU-Uh for qemu-devel@nongnu.org; Fri, 02 Sep 2011 21:16:59 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:59327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qzeqw-0006zC-R0 for qemu-devel@nongnu.org; Fri, 02 Sep 2011 21:16:58 -0400 Received: by gwb19 with SMTP id 19so2299112gwb.4 for ; Fri, 02 Sep 2011 18:16:58 -0700 (PDT) Sender: Richard Henderson Message-ID: <4E617FFE.6050203@twiddle.net> Date: Sat, 03 Sep 2011 06:46:46 +0530 From: Richard Henderson MIME-Version: 1.0 References: <1314853263-2086-1-git-send-email-david@gibson.dropbear.id.au> <1314853263-2086-2-git-send-email-david@gibson.dropbear.id.au> <4E5FAADF.1040704@us.ibm.com> In-Reply-To: <4E5FAADF.1040704@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 01/10] Add stub functions for PCI device models to do PCI DMA List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: joerg.roedel@amd.com, agraf@suse.de, qemu-devel@nongnu.org, Avi Kivity , eduard.munteanu@linux360.ro, David Gibson On 09/01/2011 09:25 PM, Anthony Liguori wrote: > I think this is the wrong approach given the introduction of the memory API. > > I think we should have a generic memory access function that takes a MemoryRegion as it's first argument. > > The PCI bus should then expose one memory region for each device (that's how it can figure out where the access is coming from). A MemoryRegion is the wrong abstraction for the device's view back into system memory. The new memory API really has nothing to do with DMA or an IOMMU. Think about it: 99.999% of the time we're writing to the one MemoryRegion that is RAM (with the other remaining fraction being pci-pci dma tricks), except in a non-contiguous manner. Obviously we need something else to represent the non-contiguous-ness. I suppose you could abuse Avi's AddressSpace, with hundreds of MemoryRegion aliases, but that would be a horrible interface to actually use in this situation. I think David's patch is fine, as far as it goes for the majority of the PCI-only devices that we emulate. As for the devices attached to more than one bus, they'll just have to wait until we actually hash out the underlying dma api. r~