Received: by 10.213.65.68 with SMTP id h4csp2252213imn; Thu, 5 Apr 2018 11:36:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/L5S6IrQgqMuQ6VqCg9dFDyT0wKAGiC6YUWY9tVAgyPX9tAzcNjECFjl8xwBs9G4Rk792p X-Received: by 2002:a17:902:9a86:: with SMTP id w6-v6mr23786897plp.168.1522953379904; Thu, 05 Apr 2018 11:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522953379; cv=none; d=google.com; s=arc-20160816; b=hKWgbffodKJfjvH2u63M1uPM6FGKnY4rF6ol2LSjUr5Hf+gfZS5VKKGSMfeEGE267j HEi+W02wfzjyC1+5M0lkVQ/BQyAqigXENqCXG8gKehBkJdFM35BJJdjt295ClHBVZC+U nfLhIIyBD+NMY82622xsYZh74etf4doe2K+7H90nRotYyzjA4TqHazNOCR4+PI3BynDE qyGop3AV5rzH05sVNk0CSU4uzuFoK6ke7xQMvyOjsWypP4xX6OWOSvQUk4YxK8GHqWFK qjCqMwRRRdufsx6jMUZfGT+J2H1opDzlH89yEKEH4eEVR3yhkLlBRra4ZHPiXxrOB7Ax 0Mwg== 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=ZaCNuSsiOSt5fqfFFSzvGXZBIwFoTAIlgS02yRDhVRs=; b=H1aSoDD2gURDwlUR4IjhXwRhlJtoDNjc/UbtotDwNPJrEgf8U/5TRjZxKWVYcjXOOy ifEyI/0HFNm12xQ8K6agiSzbjQKYobYaOJvlss0L+LNh3paIurwU28GCrEG8d+DiqFpW i8iGH97jStsJZWCRpYB51EGxManbaSekKxwaxuQbuifhzRjkaCWR8PN8XIfnPMbogx/y 2cAFC/8rLitz00KU8WfJj8401cj9fVtdB6GH43ZtycOSO0CLuzzWJ/d3EQl7I111kaXX YL/BatYR3K8tx5Dcs6DboHhGA1qjCptxMxMvHXWM3sB0ZCkCtmhJsJ/2DOCzQHcjMeAJ 4ASA== 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 j8-v6si7612751pli.9.2018.04.05.11.36.05; Thu, 05 Apr 2018 11:36:19 -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 S1751849AbeDESe5 (ORCPT + 99 others); Thu, 5 Apr 2018 14:34:57 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41986 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751442AbeDESe4 (ORCPT ); Thu, 5 Apr 2018 14:34:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F17FC406E96B; Thu, 5 Apr 2018 18:34:55 +0000 (UTC) Received: from redhat.com (ovpn-122-62.rdu2.redhat.com [10.10.122.62]) by smtp.corp.redhat.com (Postfix) with SMTP id 93A4DAFD45; Thu, 5 Apr 2018 18:34:54 +0000 (UTC) Date: Thu, 5 Apr 2018 21:34:54 +0300 From: "Michael S. Tsirkin" To: Benjamin Herrenschmidt Cc: Anshuman Khandual , 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 Subject: Re: [RFC] virtio: Use DMA MAP API for devices without an IOMMU Message-ID: <20180405213042-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> <1522940983.21446.205.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522940983.21446.205.camel@kernel.crashing.org> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 05 Apr 2018 18:34:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 05 Apr 2018 18:34:56 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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 Fri, Apr 06, 2018 at 01:09:43AM +1000, Benjamin Herrenschmidt wrote: > 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. I think that you can set iommu_platform in qemu without an iommu. > 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.