From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40QnNh4N2FzF1S0 for ; Wed, 18 Apr 2018 13:17:24 +1000 (AEST) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3I3EeFx080920 for ; Tue, 17 Apr 2018 23:17:21 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hds1padm1-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 23:17:20 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Apr 2018 04:17:18 +0100 Subject: Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU To: Christoph Hellwig , Benjamin Herrenschmidt References: <20180405105631.9514-1-khandual@linux.vnet.ibm.com> <3e1b113b-79ca-b700-5be9-10c66d74aabe@linux.vnet.ibm.com> <20180405175326-mutt-send-email-mst@kernel.org> <1522940983.21446.205.camel@kernel.crashing.org> <20180405213042-mutt-send-email-mst@kernel.org> <1522963113.21446.211.camel@kernel.crashing.org> <70cb433f-a8f7-5199-3c96-a760c7624804@linux.vnet.ibm.com> <20180406071634.GA31108@infradead.org> <1523003838.21446.238.camel@kernel.crashing.org> <20180415121157.GA17726@infradead.org> Cc: robh@kernel.org, "Michael S. Tsirkin" , aik@ozlabs.ru, jasowang@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, joe@perches.com, david@gibson.dropbear.id.au, linuxppc-dev@lists.ozlabs.org, elfring@users.sourceforge.net From: Anshuman Khandual Date: Wed, 18 Apr 2018 08:47:10 +0530 MIME-Version: 1.0 In-Reply-To: <20180415121157.GA17726@infradead.org> Content-Type: text/plain; charset=windows-1252 Message-Id: <002f153f-452d-f64b-4fc7-7f3383b39162@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 04/15/2018 05:41 PM, Christoph Hellwig wrote: > On Fri, Apr 06, 2018 at 06:37:18PM +1000, Benjamin Herrenschmidt wrote: >>>> implemented as DMA API which the virtio core understands. There is no >>>> need for an IOMMU to be involved for the device representation in this >>>> case IMHO. >>> >>> This whole virtio translation issue is a mess. I think we need to >>> switch it to the dma API, and then quirk the legacy case to always >>> use the direct mapping inside the dma API. >> >> Fine with using a dma API always on the Linux side, but we do want to >> special case virtio still at the arch and qemu side to have a "direct >> mapping" mode. Not sure how (special flags on PCI devices) to avoid >> actually going through an emulated IOMMU on the qemu side, because that >> slows things down, esp. with vhost. >> >> IE, we can't I think just treat it the same as a physical device. > > We should have treated it like a physical device from the start, but > that device has unfortunately sailed. > > But yes, we'll need a per-device quirk that says 'don't attach an > iommu'. How about doing it per platform basis as suggested in this RFC through an arch specific callback. Because all the virtio devices in the given platform would require and exercise this option (to avail bounce buffer mechanism for secure guests as an example). So the flag basically is a platform specific one not a device specific one.