From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNhyX-0002K1-DL for qemu-devel@nongnu.org; Mon, 15 Oct 2012 06:32:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNhyT-0001XS-BT for qemu-devel@nongnu.org; Mon, 15 Oct 2012 06:32:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNhyT-0001X1-2V for qemu-devel@nongnu.org; Mon, 15 Oct 2012 06:32:41 -0400 Message-ID: <507BE643.1070401@redhat.com> Date: Mon, 15 Oct 2012 12:32:35 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1349962023-560-1-git-send-email-avi@redhat.com> <1349962023-560-8-git-send-email-avi@redhat.com> <20121011133155.GA8983@redhat.com> <5076CAFE.8060205@redhat.com> <20121011134428.GB8983@redhat.com> <5076CD2A.8000703@redhat.com> <20121011143519.GE8983@redhat.com> <5076D92B.1060200@redhat.com> <20121011153415.GK8983@redhat.com> <5076EA3E.1010904@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v1 7/7] vhost: abort if an emulated iommu is used List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: "Michael S. Tsirkin" , qemu-devel@nongnu.org, Blue Swirl , Alex Williamson , Anthony Liguori , Paolo Bonzini On 10/15/2012 10:44 AM, liu ping fan wrote: > On Thu, Oct 11, 2012 at 11:48 PM, Avi Kivity wrote: >> On 10/11/2012 05:34 PM, Michael S. Tsirkin wrote: >>> On Thu, Oct 11, 2012 at 04:35:23PM +0200, Avi Kivity wrote: >>>> On 10/11/2012 04:35 PM, Michael S. Tsirkin wrote: >>>> >>>> >> No, qemu should configure virtio devices to bypass the iommu, even if it >>>> >> is on. >>>> > >>>> > Okay so there will be some API that virtio devices should call >>>> > to achieve this? >>>> >>>> The iommu should probably call pci_device_bypasses_iommu() to check for >>>> such devices. >>> >>> So maybe this patch should depend on the introduction of such >>> an API. >> >> I've dropped it for now. >> >> In fact, virtio/vhost are safe since they use cpu_physical_memory_rw() >> and the memory listener watches address_space_memory, no iommu there. > > Not quite sure your meaning. My understanding is that as a pci > device, vhost can lie behind a iommu in topology, which result in the > transaction launched can be snapped by the emulated iommu. BUT we make > a exception for vhost-dev and enforce > address_space_rw(address_space_memory, ..) NOT > address_space_rw(pci_dev->bus_master_as,..) for vhost device, so we > bypass the iommu. Right? The exception is not just for vhost, but for every virtio device. So the iommu needs to be aware of that, and if it manages a virtio device, it needs to provide a 1:1 translation. -- error compiling committee.c: too many arguments to function