From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS5D0-000383-GB for qemu-devel@nongnu.org; Thu, 02 Jun 2011 06:33:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QS5Cy-0001m1-AY for qemu-devel@nongnu.org; Thu, 02 Jun 2011 06:32:58 -0400 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:34031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS5Cx-0001lp-Iv for qemu-devel@nongnu.org; Thu, 02 Jun 2011 06:32:56 -0400 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp07.au.ibm.com (8.14.4/8.13.1) with ESMTP id p52AWpbR029565 for ; Thu, 2 Jun 2011 20:32:51 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p52AWCSp1052696 for ; Thu, 2 Jun 2011 20:32:16 +1000 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 p52AWjl5014459 for ; Thu, 2 Jun 2011 20:32:46 +1000 Date: Thu, 2 Jun 2011 20:22:05 +1000 From: David Gibson Message-ID: <20110602102205.GF5998@yookeroo.fritz.box> References: <1306892315-7306-1-git-send-email-eduard.munteanu@linux360.ro> <1306892315-7306-2-git-send-email-eduard.munteanu@linux360.ro> <4DE64646.3010505@twiddle.net> <4DE64CE4.7030300@redhat.com> <4DE657DC.3070909@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DE657DC.3070909@twiddle.net> Subject: Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, mst@redhat.com, aik@ozlabs.ru, joro@8bytes.org, seabios@seabios.org, qemu-devel@nongnu.org, agraf@suse.de, blauwirbel@gmail.com, yamahata@valinux.co.jp, kevin@koconnor.net, Avi Kivity , Eduard - Gabriel Munteanu , paul@codesourcery.com On Wed, Jun 01, 2011 at 08:16:44AM -0700, Richard Henderson wrote: > On 06/01/2011 07:29 AM, Avi Kivity wrote: > > On 06/01/2011 05:01 PM, Richard Henderson wrote: > >> > + err = dev->mmu->translate(dev, addr,&paddr,&plen, is_write); > >> > >> I see you didn't take my suggestion for using an opaque callback pointer. > >> Really and truly, I won't be able to use this as-is for Alpha. > >> > > > > Rather than opaques, please pass the DMA engine itself and use container_of(). > > The dma engine object is currently sitting in the PCIBus structure. > Which is private, and can't be extended by a host bridge implementation. > > The entire code could be re-arranged, true, but please suggest something > reasonable. > > > We should be removing opaques, not adding them. > > See my followup elsewhere. Opaques *can* be cleaner than upcasting, > particularly if there are too many hoops through which to jump. So, in the meantime, I've also done a version of Eduard's earlier patches, with added support for the PAPR hypervisor managed IOMMU. I have also significantly reworked how the structure lookup works, partly because in my case I'l looking at IOMMU translation for non-PCI devices, but I think it may also address your concerns. I'm still using upcasts, but there are less steps from the device to the IOMMU state. I've been sick and haven't had a chance to merge my stuff with Eduard's changes. I'll post them anyway, as another discussion point. -- 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