Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753174AbcD0PGE (ORCPT ); Wed, 27 Apr 2016 11:06:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57401 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbcD0PF6 (ORCPT ); Wed, 27 Apr 2016 11:05:58 -0400 Date: Wed, 27 Apr 2016 18:05:51 +0300 From: "Michael S. Tsirkin" To: Joerg Roedel Cc: David Woodhouse , Kevin Wolf , Wei Liu , Andy Lutomirski , qemu-block@nongnu.org, Christian Borntraeger , Jason Wang , Stefano Stabellini , qemu-devel@nongnu.org, peterx@redhat.com, linux-kernel@vger.kernel.org, Amit Shah , iommu@lists.linux-foundation.org, Stefan Hajnoczi , kvm@vger.kernel.org, cornelia.huck@de.ibm.com, pbonzini@redhat.com, virtualization@lists.linux-foundation.org, Anthony PERARD Subject: Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api Message-ID: <20160427180007-mutt-send-email-mst@redhat.com> References: <1461245745-6710-1-git-send-email-mst@redhat.com> <20160421135416.GE11775@citrix.com> <1461759501.118304.149.camel@infradead.org> <20160427153345-mutt-send-email-mst@redhat.com> <20160427142331.GH17926@8bytes.org> <20160427172630-mutt-send-email-mst@redhat.com> <20160427145632.GI17926@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160427145632.GI17926@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1458 Lines: 41 On Wed, Apr 27, 2016 at 04:56:32PM +0200, Joerg Roedel wrote: > On Wed, Apr 27, 2016 at 05:34:30PM +0300, Michael S. Tsirkin wrote: > > On Wed, Apr 27, 2016 at 04:23:32PM +0200, Joerg Roedel wrote: > > > QEMU can choose to bypass IOMMU for one device and not the other. > > IOMMU in QEMU isn't involved when it's bypassed. > > And it is QEMU's task to tell the OS, right? And the correct way to do > this is via the firmware ACPI tables. Going forward, this might be reasonable. Of course it didn't in the past and no one cared because virtio devices used physical addresses. We have to keep these setups working. > > Fine but this is beside the point. Almost all virtio devices > > bypass IOMMU and what this patch does is create a way > > to detect devices that don't. This code can maybe go into > > platform. > > Again, the way to detect this is in platform code must not be device > specific. This is what the DMAR and IVRS tables on x86 are for. > > When there is no way to do this in the firmware (or there is no firmware > at all), we have to do a quirk in the platform code for it. > > > > Joerg I really don't get it. There's exactly one device that works now and needs the work-around and so that we need to support, and that is virtio. It happens to have exactly the same issue on all platforms. Why would we want to work hard to build platform-specific solutions to a problem that can be solved in 5 lines of generic code? -- MST