Received: by 10.213.65.68 with SMTP id h4csp2053629imn; Thu, 5 Apr 2018 08:12:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+9toEO3z42rW/KTO0clXrFJpTRdcaNm8rbpXNYE1/5a5RiE4Nv+7kx1EXcgKx3WDReZQcX X-Received: by 10.99.62.193 with SMTP id l184mr14731834pga.87.1522941122503; Thu, 05 Apr 2018 08:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522941122; cv=none; d=google.com; s=arc-20160816; b=E37x8YvPni4725PvT9fQKQIzB5vtzcjEhMaEDePAjd9a5cZc02NNH4Vi3b+lfYAvtJ 2bxJf+uN3f+S9vHqwbth9u6xyDaG00t/0HTbDAx/Gn2bQ5Dn35Ty3xSSP8LJ7Fl+tMD1 4Hy1c+8T5uXQNnTO3VHL26g3eRaihf5IY3xJfswtgH6kHvo+Nigcu0GozyD5jyVGwhUg vULbjQOplcLGKVgFa3CMs2WlP1yN2QTBFyy6P8Hi3HwKSILuCsMFaCe5pXtdXQekDOaV 2n1pmPUCpucMel3CcO3KChOhKwFvTzNQTp7N8wds90QQ99bG5wtgdfCdaMSeDnJUvSKJ 3nxw== 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=u0r0rUIMDuJGTJEKdmuD6Nn4q48aGJGZACvq4oGxgas=; b=fcFMqccFEnzCVIh3zXjhdUX8of5EhCKdkWwm8c2oz7AAnIcK8+3Kx02EsDm0aW/Rge e8hS5Rf/clFJkPz7Hdlf/ryRfynWfHBB+rIk+tGOcUehsXkXGFz0BeVS6Q+l//b4pgdJ rIN2Mip4F/Py/vOnEUBsiUbe7/VPX1bv8c+oXYBWll/mPKC+MjtgVW1zu1glbmdPRyd6 CqL4a3Jz4E1xXoKC69c870bVbWNYriOOTs5vnhY3p+81nr2J/3SsRyPbKJt6cy7HzszZ FYXh1SleAKTLMPjW1MD1x8CYtygD3iK/kCSp1Dm750WkJ0b8SOZl4YMJ7XquWKKxKYZC xbFg== 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 j1-v6si5833996pld.108.2018.04.05.08.11.47; Thu, 05 Apr 2018 08:12:02 -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 S1751361AbeDEPKi (ORCPT + 99 others); Thu, 5 Apr 2018 11:10:38 -0400 Received: from gate.crashing.org ([63.228.1.57]:50236 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbeDEPKh (ORCPT ); Thu, 5 Apr 2018 11:10:37 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w35F9hwt006461; Thu, 5 Apr 2018 10:09:44 -0500 Message-ID: <1522940983.21446.205.camel@kernel.crashing.org> Subject: Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU From: Benjamin Herrenschmidt To: "Michael S. Tsirkin" , Anshuman Khandual Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, robh@kernel.org, aik@ozlabs.ru, jasowang@redhat.com, joe@perches.com, linuxppc-dev@lists.ozlabs.org, elfring@users.sourceforge.net, david@gibson.dropbear.id.au Date: Fri, 06 Apr 2018 01:09:43 +1000 In-Reply-To: <20180405175326-mutt-send-email-mst@kernel.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> 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 Thu, 2018-04-05 at 17:54 +0300, Michael S. Tsirkin wrote: > On Thu, Apr 05, 2018 at 08:09:30PM +0530, Anshuman Khandual wrote: > > On 04/05/2018 04:26 PM, Anshuman Khandual wrote: > > > There are certian platforms which would like to use SWIOTLB based DMA API > > > for bouncing purpose without actually requiring an IOMMU back end. But the > > > virtio core does not allow such mechanism. Right now DMA MAP API is only > > > selected for devices which have an IOMMU and then the QEMU/host back end > > > will process all incoming SG buffer addresses as IOVA instead of simple > > > GPA which is the case for simple bounce buffers after being processed with > > > SWIOTLB API. To enable this usage, it introduces an architecture specific > > > function which will just make virtio core front end select DMA operations > > > structure. > > > > > > Signed-off-by: Anshuman Khandual > > > > + "Michael S. Tsirkin" > > I'm confused by this. > > static bool vring_use_dma_api(struct virtio_device *vdev) > { > if (!virtio_has_iommu_quirk(vdev)) > return true; > > > Why doesn't setting VIRTIO_F_IOMMU_PLATFORM on the > hypervisor side sufficient? In this specific case, because that would make qemu expect an iommu, and there isn't one. Anshuman, you need to provide more background here. I don't have time right now it's late, but explain about the fact that this is for a specific type of secure VM which has only a limited pool of (insecure) memory that can be shared with qemu, so all IOs need to bounce via that pool, which can be achieved by using swiotlb. Note: this isn't urgent, we can discuss alternative approaches, this is just to start the conversation. Cheers, Ben.