From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752548AbbKJKiy (ORCPT ); Tue, 10 Nov 2015 05:38:54 -0500 Received: from gate.crashing.org ([63.228.1.57]:55296 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbbKJKiw (ORCPT ); Tue, 10 Nov 2015 05:38:52 -0500 Message-ID: <1447151874.31884.82.camel@kernel.crashing.org> Subject: Re: [PATCH v4 0/6] virtio core DMA API conversion From: Benjamin Herrenschmidt To: Andy Lutomirski Cc: Andy Lutomirski , David Woodhouse , "linux-kernel@vger.kernel.org" , "David S. Miller" , sparclinux@vger.kernel.org, Joerg Roedel , Christian Borntraeger , Cornelia Huck , Sebastian Ott , Paolo Bonzini , Christoph Hellwig , KVM , Martin Schwidefsky , linux-s390 , Linux Virtualization , "Michael S. Tsirkin" Date: Tue, 10 Nov 2015 21:37:54 +1100 In-Reply-To: References: <20151109133624-mutt-send-email-mst@redhat.com> <1447109937.31884.42.camel@kernel.crashing.org> <1447121076.31884.61.camel@kernel.crashing.org> <1447133316.31884.67.camel@kernel.crashing.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.1 (3.18.1-1.fc23) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2015-11-09 at 21:35 -0800, Andy Lutomirski wrote: > > We could do it the other way around: on powerpc, if a PCI device is in > that range and doesn't have the "bypass" property at all, then it's > assumed to bypass the IOMMU.  This means that everything that > currently works continues working.  If someone builds a physical > virtio device or uses another system in PCIe target mode speaking > virtio, then it won't work until they upgrade their firmware to set > bypass=0.  Meanwhile everyone using hypothetical new QEMU also gets > bypass=0 and no ambiguity. > > vfio will presumably notice the bypass and correctly refuse to map any > current virtio devices. > > Would that work? That would be extremely strange from a platform perspective. Any device in that vendor/device range would bypass the iommu unless some new property "actually-works-like-a-real-pci-device" happens to exist in the device-tree, which we would then need to define somewhere and handle accross at least 3 different platforms who get their device-tree from widly different places. Also if tomorrow I create a PCI device that implements virtio-net and put it in a machine running IBM proprietary firmware (or Apple's or Sun's), it won't have that property... This is not hypothetical. People are using virtio to do point-to-point communication between machines via PCIe today. Cheers, Ben. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: [PATCH v4 0/6] virtio core DMA API conversion Date: Tue, 10 Nov 2015 21:37:54 +1100 Message-ID: <1447151874.31884.82.camel@kernel.crashing.org> References: <20151109133624-mutt-send-email-mst@redhat.com> <1447109937.31884.42.camel@kernel.crashing.org> <1447121076.31884.61.camel@kernel.crashing.org> <1447133316.31884.67.camel@kernel.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Archive: List-Post: To: Andy Lutomirski Cc: Joerg Roedel , KVM , linux-s390 , "Michael S. Tsirkin" , Sebastian Ott , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Christian Borntraeger , Andy Lutomirski , sparclinux@vger.kernel.org, Paolo Bonzini , Linux Virtualization , David Woodhouse , "David S. Miller" , Martin Schwidefsky List-ID: T24gTW9uLCAyMDE1LTExLTA5IGF0IDIxOjM1IC0wODAwLCBBbmR5IEx1dG9taXJza2kgd3JvdGU6 Cj4gCj4gV2UgY291bGQgZG8gaXQgdGhlIG90aGVyIHdheSBhcm91bmQ6IG9uIHBvd2VycGMsIGlm IGEgUENJIGRldmljZSBpcyBpbgo+IHRoYXQgcmFuZ2UgYW5kIGRvZXNuJ3QgaGF2ZSB0aGUgImJ5 cGFzcyIgcHJvcGVydHkgYXQgYWxsLCB0aGVuIGl0J3MKPiBhc3N1bWVkIHRvIGJ5cGFz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YXRmb3JtcyB3aG8g Z2V0IHRoZWlyIGRldmljZS10cmVlIApmcm9tIHdpZGx5IGRpZmZlcmVudCBwbGFjZXMuCgpBbHNv IGlmIHRvbW9ycm93IEkgY3JlYXRlIGEgUENJIGRldmljZSB0aGF0IGltcGxlbWVudHMgdmlydGlv LW5ldCBhbmQKcHV0IGl0IGluIGEgbWFjaGluZSBydW5uaW5nIElCTSBwcm9wcmlldGFyeSBmaXJt d2FyZSAob3IgQXBwbGUncyBvcgpTdW4ncyksIGl0IHdvbid0IGhhdmUgdGhhdCBwcm9wZXJ0eS4u LgoKVGhpcyBpcyBub3QgaHlwb3RoZXRpY2FsLiBQZW9wbGUgYXJlIHVzaW5nIHZpcnRpbyB0byBk byBwb2ludC10by1wb2ludApjb21tdW5pY2F0aW9uIGJldHdlZW4gbWFjaGluZXMgdmlhIFBDSWUg dG9kYXkuCgpDaGVlcnMsCkJlbi4KCgpfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fXwpWaXJ0dWFsaXphdGlvbiBtYWlsaW5nIGxpc3QKVmlydHVhbGl6YXRpb25A bGlzdHMubGludXgtZm91bmRhdGlvbi5vcmcKaHR0cHM6Ly9saXN0cy5saW51eGZvdW5kYXRpb24u b3JnL21haWxtYW4vbGlzdGluZm8vdmlydHVhbGl6YXRpb24= From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Date: Tue, 10 Nov 2015 10:37:54 +0000 Subject: Re: [PATCH v4 0/6] virtio core DMA API conversion Message-Id: <1447151874.31884.82.camel@kernel.crashing.org> List-Id: References: <20151109133624-mutt-send-email-mst@redhat.com> <1447109937.31884.42.camel@kernel.crashing.org> <1447121076.31884.61.camel@kernel.crashing.org> <1447133316.31884.67.camel@kernel.crashing.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: Andy Lutomirski Cc: Joerg Roedel , KVM , linux-s390 , "Michael S. Tsirkin" , Sebastian Ott , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Christian Borntraeger , Andy Lutomirski , sparclinux@vger.kernel.org, Paolo Bonzini , Linux Virtualization , David Woodhouse , "David S. Miller" , Martin Schwidefsky On Mon, 2015-11-09 at 21:35 -0800, Andy Lutomirski wrote: > > We could do it the other way around: on powerpc, if a PCI device is in > that range and doesn't have the "bypass" property at all, then it's > assumed to bypass the IOMMU.  This means that everything that > currently works continues working.  If someone builds a physical > virtio device or uses another system in PCIe target mode speaking > virtio, then it won't work until they upgrade their firmware to set > bypass=0.  Meanwhile everyone using hypothetical new QEMU also gets > bypass=0 and no ambiguity. > > vfio will presumably notice the bypass and correctly refuse to map any > current virtio devices. > > Would that work? That would be extremely strange from a platform perspective. Any device in that vendor/device range would bypass the iommu unless some new property "actually-works-like-a-real-pci-device" happens to exist in the device-tree, which we would then need to define somewhere and handle accross at least 3 different platforms who get their device-tree from widly different places. Also if tomorrow I create a PCI device that implements virtio-net and put it in a machine running IBM proprietary firmware (or Apple's or Sun's), it won't have that property... This is not hypothetical. People are using virtio to do point-to-point communication between machines via PCIe today. Cheers, Ben.