From: David Gibson Subject: Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface Date: Thu, 2 Jun 2011 20:22:05 +1000 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 Cc: Avi Kivity , Eduard - Gabriel Munteanu , mst@redhat.com, aliguori@us.ibm.com, kvm@vger.kernel.org, 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, paul@codesourcery.com To: Richard Henderson Return-path: Received: from e23smtp09.au.ibm.com ([202.81.31.142]:38510 "EHLO e23smtp09.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932749Ab1FBKcx (ORCPT ); Thu, 2 Jun 2011 06:32:53 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp09.au.ibm.com (8.14.4/8.13.1) with ESMTP id p52AWmvJ005638 for ; Thu, 2 Jun 2011 20:32:48 +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 p52AWmUG913528 for ; Thu, 2 Jun 2011 20:32:48 +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 p52AWjlL014459 for ; Thu, 2 Jun 2011 20:32:47 +1000 Content-Disposition: inline In-Reply-To: <4DE657DC.3070909@twiddle.net> Sender: kvm-owner@vger.kernel.org List-ID: 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