Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4422703imm; Tue, 7 Aug 2018 00:59:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeGjdLb1EblLdW5ysEniT0HIGMPQ+AV6ajNnaTBPzU/Lk4ZnFIaxkZUFuHWaP9rWxICM4l+ X-Received: by 2002:a65:448a:: with SMTP id l10-v6mr17801922pgq.382.1533628793125; Tue, 07 Aug 2018 00:59:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533628793; cv=none; d=google.com; s=arc-20160816; b=xpWxyVKUT1PNCSB2oIAFHNwlnEXNgozQW+KCl9q8qI4li/E/qJtObfK0VyGx/v2jsa SeOn+1QPfjF1PdS6XZ3eUonmXJDX6rz9i66HOpBOIAWZZ10F0eG7LbX8IB91PktvkJ2p 5Zd9+eDABGuy1SkqX3ulZw4P3j9+7PomhG122hBusVMFfHLGHoyrlc50QU6MaC1u1nIy L1xAhWV6sWaA3IxleOF8FyEdbtDcO5TGSxDKe2CKLlPO5KJgjJsULzrpYw2114KKBj0I DnAVDwUVsGJkRFwBtVbYo5BWmub7z2zAJ4PJZWOvJHPagY3aWfLP85DHHvQF/LW2qRz/ /ShQ== 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=2w3rGxQfZm4xExmfkggBYRjli70WnsaQDpy7NUmfnsg=; b=uFzmmlVPPYF/LJBqTbWakFKfivWipKKAYfdf4FVUBTMB5ZkFgKR0KRhFkvY4ldMaPE iYgpbpW5s6jRWqcw4q8vNjl7AsP4m6WYoKSgeCLWV3qUaZblmyY+DgoVPEYikTtyLA92 3G8VBElJnGGpk4zY26FFQgeLdLmBqFwUUwkz+T8O6gf+uxBPYPvDMuFaYKn/IM9uXaIA rPcWnh85bw+RJ27RzSsKlOrSYTB28o0R1evbjLN7oQaR8kCxaT7rWIGmZXuClWvrGlcn OeAuo+eYOfAJi5jSHLkzQ1LBbUogsAlmVo6uoQQ/iTJQyfwp1iRtqh3A8iIEIbB5fxGV smLA== 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 e17-v6si634531pgo.482.2018.08.07.00.59.38; Tue, 07 Aug 2018 00:59:53 -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 S2388676AbeHGI4z (ORCPT + 99 others); Tue, 7 Aug 2018 04:56:55 -0400 Received: from gate.crashing.org ([63.228.1.57]:50234 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727725AbeHGI4z (ORCPT ); Tue, 7 Aug 2018 04:56:55 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w776girW029481; Tue, 7 Aug 2018 01:42:45 -0500 Message-ID: Subject: Re: [RFC 0/4] Virtio uses DMA API for all devices From: Benjamin Herrenschmidt To: Christoph Hellwig Cc: "Michael S. Tsirkin" , 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, 07 Aug 2018 16:42:44 +1000 In-Reply-To: <20180807062117.GD32709@infradead.org> References: <20180803070507.GA1344@infradead.org> <20180803160246.GA13794@infradead.org> <22310f58605169fe9de83abf78b59f593ff7fbb7.camel@kernel.crashing.org> <20180804082120.GB4421@infradead.org> <20180805072930.GB23288@infradead.org> <20180806094243.GA16032@infradead.org> <6c707d6d33ac25a42265c2e9b521c2416d72c739.camel@kernel.crashing.org> <20180807062117.GD32709@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 Mon, 2018-08-06 at 23:21 -0700, Christoph Hellwig wrote: > On Tue, Aug 07, 2018 at 05:52:12AM +1000, Benjamin Herrenschmidt wrote: > > > It is your job to write a coherent interface specification that does > > > not depend on the used components. The hypervisor might be PAPR, > > > Linux + qemu, VMware, Hyperv or something so secret that you'd have > > > to shoot me if you had to tell me. The guest might be Linux, FreeBSD, > > > AIX, OS400 or a Hipster project of the day in Rust. As long as we > > > properly specify the interface it simplify does not matter. > > > > That's the point Christoph. The interface is today's interface. It does > > NOT change. That information is not part of the interface. > > > > It's the VM itself that is stashing away its memory in a secret place, > > and thus needs to do bounce buffering. There is no change to the virtio > > interface per-se. > > Any guest that doesn't know about your magic limited adressing is simply > not going to work, so we need to communicate that fact. The guest does. It's the guest itself that initiates it. That's my point, it's not a factor of the hypervisor, which is unchanged in that area. It's the guest itself, that makes the decision early on, to stash it's memory away in a secure place, and thus needs to establish some kind of bouce buffering via a few left over "insecure" pages. It's all done by the guest: initiated by the guest and controlled by the guest. That's why I don't see why this specifically needs to involve the hypervisor side, and thus a VIRTIO feature bit. Note that I can make it so that the same DMA ops (basically standard swiotlb ops without arch hacks) work for both "direct virtio" and "normal PCI" devices. The trick is simply in the arch to setup the iommu to map the swiotlb bounce buffer pool 1:1 in the iommu, so the iommu essentially can be ignored without affecting the physical addresses. If I do that, *all* I need is a way, from the guest itself (again, the other side dosn't know anything about it), to force virtio to use the DMA ops as if there was an iommu, that is, use whatever dma ops were setup by the platform for the pci device. Cheers, Ben.