Received: by 10.192.165.156 with SMTP id m28csp1420881imm; Wed, 18 Apr 2018 09:21:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx48vahZjtiDQDhpuBrnrFbIxMqNeIKdcgBRUIdcItFoheogy3DlDy3/rVoDi207ydB8cEmR3 X-Received: by 10.99.6.66 with SMTP id 63mr2261470pgg.10.1524068494395; Wed, 18 Apr 2018 09:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524068494; cv=none; d=google.com; s=arc-20160816; b=e/8wNejiMtRaq4K5MrWEglPPPdNrf/FUDVWXJIsXKHVKftqhsU/cicEGX1ibFFCxiP CkogsnpL4StMxBlumBtBLlpg6YSNd3v6YalhKk4MN67QVPbu00C10Bs89w1vnDNXvdNz 08GW3bYiG8NyxLDVaaY9ei12qu+MLFcPs5HUJRUonqTvRMFYecYXZcTNg+KB+/4gQ3mG kuwFDFcZevjES7ENftl7P0a+L1sttLiqLrWOs3mQPDnzg+A6OfQ9tTuMT/n0BoK2rQAb Yfd4JxDEed1Cy4zS41yg1tYBI0Sdg4889jvHvExLixDs5bQQQBqXgDhzu5Obt0KdYPBT svog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=KH+8ZG7KoOLiGKRgPKlKxoBEHNwCSpFPiY8Eg/QY7SQ=; b=H/7C/jw+psG6+baUNHiDEuujDD1r2Hqj64dqi8AtKoyVBJf4qVFfDOSQw0tuGlFzMb iyGQDtYEfmcLn5cw4PO9Ogb7KoglwidfSQ+AAVgeNBMo4iJkB0c3KFH8/WJIDmxSdr+2 g0eUG5hS7pU9rCNYvyBVGrIkH4N2I1ck+XBucy7pTvG3CaM7/PXTlHCQ1aDKeyO17X4/ TR+D9qYsh5ykz+sWSBSJMLwTisWwexPTYEb1jYAESE8ve0jUhSRG/V9cxXbBgGg2tjDD 3YiX4jXb5SroQMn9U/MUcxIGtZQ8XtEJu0PpdHxaykGnMF9vf4nKR7AhciBp+7e6jXvd JUAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si1437993pfh.31.2018.04.18.09.21.20; Wed, 18 Apr 2018 09:21:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752630AbeDRQUO (ORCPT + 99 others); Wed, 18 Apr 2018 12:20:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60710 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751232AbeDRQUN (ORCPT ); Wed, 18 Apr 2018 12:20:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 872F97CBBA; Wed, 18 Apr 2018 16:20:12 +0000 (UTC) Received: from redhat.com (ovpn-124-112.rdu2.redhat.com [10.10.124.112]) by smtp.corp.redhat.com (Postfix) with SMTP id D37901134CCD; Wed, 18 Apr 2018 16:20:10 +0000 (UTC) Date: Wed, 18 Apr 2018 19:20:10 +0300 From: "Michael S. Tsirkin" To: Anshuman Khandual Cc: Christoph Hellwig , Benjamin Herrenschmidt , robh@kernel.org, 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 Subject: Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU Message-ID: <20180418191722-mutt-send-email-mst@kernel.org> References: <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> <002f153f-452d-f64b-4fc7-7f3383b39162@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002f153f-452d-f64b-4fc7-7f3383b39162@linux.vnet.ibm.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 18 Apr 2018 16:20:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 18 Apr 2018 16:20:12 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 18, 2018 at 08:47:10AM +0530, Anshuman Khandual wrote: > 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. That's not the case. A single platform can have a mix of virtio and non-virtio devices. Same applies even within virtio, e.g. the balloon device always bypasses an iommu. Further, QEMU supports out of process devices some of which might bypass the IOMMU. -- MST