From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Shb76-00061R-77 for qemu-devel@nongnu.org; Thu, 21 Jun 2012 02:43:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Shb6z-0004Kz-Qv for qemu-devel@nongnu.org; Thu, 21 Jun 2012 02:43:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Shb6z-0004Km-Iy for qemu-devel@nongnu.org; Thu, 21 Jun 2012 02:43:25 -0400 Message-ID: <4FE2C281.1060104@redhat.com> Date: Thu, 21 Jun 2012 08:43:13 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1340087992-2399-1-git-send-email-benh@kernel.crashing.org> <1340087992-2399-5-git-send-email-benh@kernel.crashing.org> <4FE23E30.50302@codemonkey.ws> <1340228168.28143.178.camel@pasglop> <4FE2434D.2010901@codemonkey.ws> In-Reply-To: <4FE2434D.2010901@codemonkey.ws> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 04/13] usb-ohci: Use universal DMA helper functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: "Michael S. Tsirkin" , qemu-devel@nongnu.org, David Gibson Hi, >>> Why leave pci accessors and not implement usb_memory_rw() wrappers? >> >> Well, "usb" is a bit too generic, ehci and ohci would each need to have >> their own sets of wrappers. But yes, that's possible... is it really >> worth it ? There's nothing fundamentally wrong with using the dma_* >> accessors. > > So is using the pci accessors wrong? > > I'm not saying you should go and convert every caller of the pci_ > functions, I just want a clear policy on what interface devices should use. usb device emulations should use usb_packet_copy() usb host adapters emulations should use either usb_packet_map() + usb_packet_unmap(), or use usb_packet_addbuf(), then copy from/to the buffer using whatever is approximate. For pci host controller that is pci_memory_rw(). For ohci which exists in both pci and non-pci variants it looks reasonable to me to get a iommu handle in bus-specific code, then use dma_memory_rw with that handle directly in the common code paths. cheers, Gerd