From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eduard - Gabriel Munteanu Subject: Re: [RFC PATCH 4/7] ide: IOMMU support Date: Thu, 15 Jul 2010 02:11:00 +0300 Message-ID: <20100714231100.GC7065@localhost> References: <1279086307-9596-1-git-send-email-eduard.munteanu@linux360.ro> <1279086307-9596-5-git-send-email-eduard.munteanu@linux360.ro> <201007141453.06131.paul@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: joro@8bytes.org, avi@redhat.com, kvm@vger.kernel.org, qemu-devel@nongnu.org To: Paul Brook Return-path: Received: from mail-bw0-f46.google.com ([209.85.214.46]:47711 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752392Ab0GNXMG (ORCPT ); Wed, 14 Jul 2010 19:12:06 -0400 Received: by bwz1 with SMTP id 1so256258bwz.19 for ; Wed, 14 Jul 2010 16:12:04 -0700 (PDT) Content-Disposition: inline In-Reply-To: <201007141453.06131.paul@codesourcery.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 14, 2010 at 02:53:03PM +0100, Paul Brook wrote: > > Memory accesses must go through the IOMMU layer. > > No. Devices should not know or care whether an IOMMU is present. They don't really care. iommu_get() et al. are convenience functions which can and do return NULL when there's no IOMMU and device code can pass that NULL around without checking. I could've probably made the r/w functions take only the DeviceState in addition to normal args, but wanted to avoid looking up the related structures on each I/O operation. > You should be adding a DeviceState argument to cpu_physical_memory_{rw,map}. > This should then handle IOMMU translation transparently. > > You also need to accomodate the the case where multiple IOMMU are present. > > Paul We don't assume there's a single IOMMU in the generic layer. The callbacks within 'struct iommu' could very well dispatch the request to one of multiple, coexisting IOMMUs. Eduard