From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson Subject: Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface Date: Wed, 01 Jun 2011 08:16:44 -0700 Message-ID: <4DE657DC.3070909@twiddle.net> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Eduard - Gabriel Munteanu , mst@redhat.com, aliguori@us.ibm.com, david@gibson.dropbear.id.au, 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, dwg@au1.ibm.com, paul@codesourcery.com To: Avi Kivity Return-path: Received: from mail-yx0-f174.google.com ([209.85.213.174]:44510 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753122Ab1FAPQt (ORCPT ); Wed, 1 Jun 2011 11:16:49 -0400 Received: by yxs7 with SMTP id 7so2251180yxs.19 for ; Wed, 01 Jun 2011 08:16:48 -0700 (PDT) In-Reply-To: <4DE64CE4.7030300@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. r~