Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp51868imm; Tue, 31 Jul 2018 13:39:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpejXixf3Zh5m1evZLh24enw+3hQ9KiGNSejEWcz8KJnz6an9dXUXUMvLH1Aa2ziujrd/SNA X-Received: by 2002:a65:658d:: with SMTP id u13-v6mr22082036pgv.20.1533069553790; Tue, 31 Jul 2018 13:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533069553; cv=none; d=google.com; s=arc-20160816; b=IhUdT/2W+4GBxWZUDfRjnWyXhpAyET6kf/6dhxNwQi4HWbOUIiVNMIJj7U7njey9n2 EuvLBcXbqwirBzTMmX5Z5asE2mpCTor7hA1TJQ9uzB/RwCRmtfmXzRs1oh+N6lZj4mWS dYDYNDSmD7JK6MtN+BbaKffSYHOeHi2WU0anKKN6PkVd9OAPtg+NfXXmgPFjLsa/B7T1 iMzWtPMjE0z7F13MMknBIuKRGNGREoXD2HXso08XiewGHkYnsrycvYKQ7npU1a8vyvE6 hLA7rUg7BJFzjM2bPc26FMReBx3pMIHfDx7RRKGgU1YgzskAdIiUdh5rxnNWMaGUzp7d 1ssw== 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=wL6UhXQzoZunEzdaIajWG/i7GfrA6u/bnD+BcYL9XNY=; b=ziQbePvKPOo5Hlwhd9yVlAqu/pIgOBbDVkJ/uTX15DiCI5GC4ztYw7HlNuAIKALcKY pTDIY/d0uq7DiiPUVHJTf4WxN3iyeMA9vVqz8N7LUAzI0kAmmTPQdyf0GLJwpHhwYLt5 OBzgd2EPBpqm+t4CIOOGimK+H+55G4OdKd8IdjzI19mVbBQlsHVuUPqaIC5vyWfqDFMw pfa5YEqbf289DVvrdC/H6k1Ogbs/k17OBaL0DXzrpHrnip3mbfyR+jgVnXKvwmxeDP9f RmUtSiosFhhjD5/rQed9BykowsfIaEqYB37CpqQId2N3bgbWAsPWP1ZwiDkMPeHnO5aS 7bBw== 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 b6-v6si9229798pgj.211.2018.07.31.13.38.46; Tue, 31 Jul 2018 13:39:13 -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 S1729660AbeGaWTk (ORCPT + 99 others); Tue, 31 Jul 2018 18:19:40 -0400 Received: from gate.crashing.org ([63.228.1.57]:33652 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726580AbeGaWTk (ORCPT ); Tue, 31 Jul 2018 18:19:40 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w6VKaMZd023397; Tue, 31 Jul 2018 15:36:23 -0500 Message-ID: <3d6e81511571260de1c8047aaffa8ac4df093d2e.camel@kernel.crashing.org> Subject: Re: [RFC 0/4] Virtio uses DMA API for all devices From: Benjamin Herrenschmidt To: Christoph Hellwig , "Michael S. Tsirkin" Cc: Will Deacon , Anshuman Khandual , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, aik@ozlabs.ru, robh@kernel.org, joe@perches.com, elfring@users.sourceforge.net, david@gibson.dropbear.id.au, jasowang@redhat.com, mpe@ellerman.id.au, linuxram@us.ibm.com, haren@linux.vnet.ibm.com, paulus@samba.org, srikar@linux.vnet.ibm.com, robin.murphy@arm.com, jean-philippe.brucker@arm.com, marc.zyngier@arm.com Date: Tue, 31 Jul 2018 15:36:22 -0500 In-Reply-To: <20180731173052.GA17153@infradead.org> References: <20180720035941.6844-1-khandual@linux.vnet.ibm.com> <20180727095804.GA25592@arm.com> <20180730093414.GD26245@infradead.org> <20180730125100-mutt-send-email-mst@kernel.org> <20180730111802.GA9830@infradead.org> <20180730155633-mutt-send-email-mst@kernel.org> <20180731173052.GA17153@infradead.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.4 (3.28.4-1.fc28) 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 Tue, 2018-07-31 at 10:30 -0700, Christoph Hellwig wrote: > > However the question people raise is that DMA API is already full of > > arch-specific tricks the likes of which are outlined in your post linked > > above. How is this one much worse? > > None of these warts is visible to the driver, they are all handled in > the architecture (possibly on a per-bus basis). > > So for virtio we really need to decide if it has one set of behavior > as specified in the virtio spec, or if it behaves exactly as if it > was on a PCI bus, or in fact probably both as you lined up. But no > magic arch specific behavior inbetween. The only arch specific behaviour is needed in the case where it doesn't behave like PCI. In this case, the PCI DMA ops are not suitable, but in our secure VMs, we still need to make it use swiotlb in order to bounce through non-secure pages. It would be nice if "real PCI" was the default but it's not, VMs are created in "legacy" mode all the times and we don't know at VM creation time whether it will become a secure VM or not. The way our secure VMs work is that they start as a normal VM, load a secure "payload" and call the Ultravisor to "become" secure. So we're in a bit of a bind here. We need that one-liner optional arch hook to make virtio use swiotlb in that "IOMMU bypass" case. Ben.