From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44579 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Or5XR-0007xG-5j for qemu-devel@nongnu.org; Thu, 02 Sep 2010 04:52:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Or5XP-0007hD-Iu for qemu-devel@nongnu.org; Thu, 02 Sep 2010 04:52:52 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:46514) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Or5XP-0007h4-An for qemu-devel@nongnu.org; Thu, 02 Sep 2010 04:52:51 -0400 Received: by fxm7 with SMTP id 7so58422fxm.4 for ; Thu, 02 Sep 2010 01:52:50 -0700 (PDT) Sender: Eduard - Gabriel Munteanu Date: Thu, 2 Sep 2010 11:51:04 +0300 From: Eduard - Gabriel Munteanu Subject: Re: [Qemu-devel] [PATCH 2/7] pci: memory access API and IOMMU support Message-ID: <20100902085104.GB7211@localhost> References: <1283119703-9781-1-git-send-email-eduard.munteanu@linux360.ro> <4C7EB336.40003@mail.berlios.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C7EB336.40003@mail.berlios.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: kvm@vger.kernel.org, mst@redhat.com, joro@8bytes.org, qemu-devel@nongnu.org, blauwirbel@gmail.com, yamahata@valinux.co.jp, paul@codesourcery.com, avi@redhat.com On Wed, Sep 01, 2010 at 10:10:30PM +0200, Stefan Weil wrote: > Please see my comments at the end of this mail. > > > Am 30.08.2010 00:08, schrieb Eduard - Gabriel Munteanu: > > PCI devices should access memory through pci_memory_*() instead of > > cpu_physical_memory_*(). This also provides support for translation and > > access checking in case an IOMMU is emulated. > > > > Memory maps are treated as remote IOTLBs (that is, translation caches > > belonging to the IOMMU-aware device itself). Clients (devices) must > > provide callbacks for map invalidation in case these maps are > > persistent beyond the current I/O context, e.g. AIO DMA transfers. > > > > Signed-off-by: Eduard - Gabriel Munteanu > > --- [snip] > > +static inline void pci_memory_read(PCIDevice *dev, > > + pcibus_t addr, > > + uint8_t *buf, > > + pcibus_t len) > > +{ > > + pci_memory_rw(dev, addr, buf, len, 0); > > +} > > + > > +static inline void pci_memory_write(PCIDevice *dev, > > + pcibus_t addr, > > + const uint8_t *buf, > > + pcibus_t len) > > +{ > > + pci_memory_rw(dev, addr, (uint8_t *) buf, len, 1); > > +} > > + > > #endif > > The functions pci_memory_read and pci_memory_write not only read > or write byte data but many different data types which leads to > a lot of type casts in your other patches. > > I'd prefer "void *buf" and "const void *buf" in the argument lists. > Then all those type casts could be removed. > > Regards > Stefan Weil I only followed an approach similar to how cpu_physical_memory_{read,write}() is defined. I think I should change both cpu_physical_memory_* stuff and pci_memory_* stuff, not only the latter, if I decide to go on that approach. Eduard