From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751534AbbKJFfZ (ORCPT ); Tue, 10 Nov 2015 00:35:25 -0500 Received: from mail-ob0-f177.google.com ([209.85.214.177]:36068 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750899AbbKJFfX (ORCPT ); Tue, 10 Nov 2015 00:35:23 -0500 MIME-Version: 1.0 In-Reply-To: <1447133316.31884.67.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> From: Andy Lutomirski Date: Mon, 9 Nov 2015 21:35:02 -0800 Message-ID: Subject: Re: [PATCH v4 0/6] virtio core DMA API conversion To: Benjamin Herrenschmidt 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" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 9, 2015 at 9:28 PM, Benjamin Herrenschmidt wrote: > On Mon, 2015-11-09 at 18:18 -0800, Andy Lutomirski wrote: >> >> /* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. >> */ >> static const struct pci_device_id virtio_pci_id_table[] = { >> { PCI_DEVICE(0x1af4, PCI_ANY_ID) }, >> { 0 } >> }; >> >> Can we match on that range? > > We can, but the problem remains, how do we differenciate an existing > device that does bypass vs. a newer one that needs the IOMMU and thus > doesn't have the new "bypass" property in the device-tree. > 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? --Andy