From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REe0A-0000JU-J3 for qemu-devel@nongnu.org; Fri, 14 Oct 2011 05:24:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1REe06-0000eU-Nb for qemu-devel@nongnu.org; Fri, 14 Oct 2011 05:24:26 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:59808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1REe06-0000co-6H for qemu-devel@nongnu.org; Fri, 14 Oct 2011 05:24:22 -0400 Received: from /spool/local by au.ibm.com with XMail ESMTP for from ; Fri, 14 Oct 2011 09:23:00 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9E9O9Nk2326748 for ; Fri, 14 Oct 2011 20:24:09 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9E9O9rN016975 for ; Fri, 14 Oct 2011 20:24:09 +1100 Date: Fri, 14 Oct 2011 20:24:05 +1100 From: David Gibson Message-ID: <20111014092405.GF4580@truffala.fritz.box> References: <1318584063-1611-1-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1318584063-1611-1-git-send-email-david@gibson.dropbear.id.au> Subject: Re: [Qemu-devel] [0/12] Preliminary work for IOMMU emulation support (v2) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com Cc: mst@redhat.com, joerg.roedel@amd.com, qemu-devel@nongnu.org, agraf@suse.de, avi@redhat.com, eduard.munteanu@linux360.ro, rth@twiddle.net On Fri, Oct 14, 2011 at 08:20:51PM +1100, David Gibson wrote: > A while back, Eduard - Gabriel Munteanu send a series of patches > implementing support for emulating the AMD IOMMU in conjunction with > qemu emulated PCI devices. A revised patch series added support for > the Intel IOMMU, and I also send a revised version of this series > which added support for the hypervisor mediated IOMMU on the pseries > machine. > > Richard Henderson also weighed in on the discussion, and there's still > a cretain amount to be thrashed out in terms of exactly how to set up > an IOMMU / DMA translation subsystem. > > However, really only 2 or 3 patches in any of these series have > contained anything interesting. The rest of the series has been > converting existing PCI emulated devices to use the new DMA interface > which worked through the IOMMU translation, whatever it was. While we > keep working out what we want for the guts of the IOMMU support, these > device conversion patches keep bitrotting against updates to the > various device implementations themselves. > > Really, regardless of whether we're actually implementing IOMMU > translation, it makes sense that qemu code should distinguish between > when it is really operating in CPU physical addresses and when it is > operating in bus or DMA addresses which might have some kind of > translation into physical addresses. > > This series, therefore, begins the conversion of existing PCI device > emulation code to use new (stub) pci dma access functions. These are, > for now, just defined to be untranslated cpu physical memory accesses, > as before, but has three advantages: > > * It becomes obvious where the code is working with dma addresses, > so it's easier to grep for what might be affected by an IOMMU or > other bus address translation. > > * The new stubs take the PCIDevice *, from which any of the various > suggested IOMMU interfaces should be able to locate the correct > IOMMU translation context. > > * The new pci_dma_{read,write}() functions have a return value. > When we do have IOMMU support, translation failures could lead to > these functions failing, so we want a way to report it. > > This series converts all the easy cases. It doesn't yet handle > devices which have both PCI and non-PCI variants, such as AHCI, OHCI > and ne2k. Unlike the earlier version of this series, functions using > scatter gather _are_ covered, though. Oh, one more note. There are a few checkpatch failures in the series; most are false positives (mistaking pointer * for a multiplication, mostly). There are a few more that are true style errors that I've left in on the basis that matching the surrounding code is more important than being checkpatchily correct. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson