Received: by 10.213.65.68 with SMTP id h4csp380250imn; Fri, 6 Apr 2018 01:39:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/uzQKTZ582/6W1xVU59yncqY+QMFA7BgUjWc6z54SaqidUOgo3lhXClQF/Wi5s3oWOxX4N X-Received: by 2002:a17:902:4001:: with SMTP id b1-v6mr25987757pld.273.1523003998577; Fri, 06 Apr 2018 01:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523003998; cv=none; d=google.com; s=arc-20160816; b=l98ghX7CRrKeVl/tpsCZ86PRMavEtuoJE6SrVmXOVDPaKpczqJ0vBI4SyF+FhT76E7 DZ/GYDBJgatTXZzB6j9lMZkTVdvI8Rs99OK6aWRr7R+1seQZGhyghnCycZLEGr0tWInR 1Yycod2h+A7PFxjjkJpZPO1ItcFfsB9jbZKOdHJgg11N4BM1EDHfaUdG/Nn/XZubdpFH yuUPM6hN+JEAt9DuH82Qu+Ey9wXTmyQeVg6XdIbVPGIid8yEUz0vUTJzRg+Y20KFUdXr CjFr6nD7BRQ5j9k2XGa/EjBNi9pNUdomcbtK+ZE/e8g5cyHMW2ViOjgPK9OfLMuxOm96 8o6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=S+PbiXW0+GS7Z6Fte48P/NUjZZF+Xx6+MWhHEgKLk2Q=; b=Oi8XFZPh45KOMsCCDNvkuarOdc7cF4iEsSH1gLfx2JGgS7Fk8w4D1cy828dom+sPFS /eLp+WasTzHo7poZGOnCmnn2+YWXRsHdlY2MjFNCTgp+d4abeX4dgH5lj8Pok+LpTnT7 RLx5sXmw9bK9EjIBw7J/nFKxOpAwcfmjoEk5BZp9ezwpA6dv96MDUpMDc/Lfg57WuN+Z rjXOIZs/vnmeC03LRny8O2Ch9MC2kHn4BHivxfulOpdcvNZNlxoxxropDqNxs+0pEehH uFRPzxpU09Upssty7eu2w96BUZP5BgWLuqbEyS/X/QpVkSTyAbI/hUkxhCUGojJvqMG5 jb5w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si6825587pge.252.2018.04.06.01.39.43; Fri, 06 Apr 2018 01:39:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751946AbeDFIic (ORCPT + 99 others); Fri, 6 Apr 2018 04:38:32 -0400 Received: from gate.crashing.org ([63.228.1.57]:53193 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751708AbeDFIia (ORCPT ); Fri, 6 Apr 2018 04:38:30 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w368bJbl000756; Fri, 6 Apr 2018 03:37:20 -0500 Message-ID: <1523003838.21446.238.camel@kernel.crashing.org> Subject: Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU From: Benjamin Herrenschmidt To: Christoph Hellwig , Anshuman Khandual Cc: "Michael S. Tsirkin" , 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 Date: Fri, 06 Apr 2018 18:37:18 +1000 In-Reply-To: <20180406071634.GA31108@infradead.org> 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> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 (3.26.6-1.fc27) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-04-06 at 00:16 -0700, Christoph Hellwig wrote: > On Fri, Apr 06, 2018 at 08:23:10AM +0530, Anshuman Khandual wrote: > > On 04/06/2018 02:48 AM, Benjamin Herrenschmidt wrote: > > > On Thu, 2018-04-05 at 21:34 +0300, Michael S. Tsirkin wrote: > > > > > In this specific case, because that would make qemu expect an iommu, > > > > > and there isn't one. > > > > > > > > > > > > I think that you can set iommu_platform in qemu without an iommu. > > > > > > No I mean the platform has one but it's not desirable for it to be used > > > due to the performance hit. > > > > Also the only requirement is to bounce the I/O buffers through SWIOTLB > > 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. Cheers, Ben.