Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5000375imu; Tue, 29 Jan 2019 11:03:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ls8vPV4BADsok4dyMmkRe8aUSNvY7a7i2U+EGfCECXLDr1GyPkKEG9HLE12C/x9Ji88i8 X-Received: by 2002:a63:151f:: with SMTP id v31mr24337989pgl.34.1548788592524; Tue, 29 Jan 2019 11:03:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548788592; cv=none; d=google.com; s=arc-20160816; b=qc0LGbrvrpc6DW53WbZIv3JVbZeCbuuQxKOqxDW/s0hCnyxmYjnAAK5l6sVwPT4BVj f0LBuUqWR0+bK/Pdtxb4fmjBzRcouDBj73ZRPXyPexBCVmLn2IHdQfUaRXPDYxu1QZ5f q9OAE7LLms7Ab6/E4/KaNSwjFNRRYN/21NVpOyGn08dfWEz2uwlICfZQdKQZccj+oau2 ouz8t6I4dm9k8+zEk9HXXU2hAf+ol+BBv4hTCN/Gv4x4xifcgNhOpcTgSgDYo1Wzyyft ExV+DPt/7Emtfn5wuviVROEJg9MkgsIwhZ3u87s73P1bvp6upQzWNYzTxrOEhT27neGX QKQg== 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; bh=qwSfK5gMwBDT/Qkh7u7EUYYPhQQ65Vi++RBoUXBbgk0=; b=WSpmJZ8haSqGwMDZAsmavLBwWf1o/Rk+IJuQZSuKF9T/botcKgm/X9YP37mj2My1jz Qj7NmsgQvFrli2N2qObGb4GuKcfyeICrF1jPKnqnf1jWlVxTs273vNMh/7HOkruLX3m6 2DQ1safsRwCQkVgumMiVtqLCeHTG3fgXzkWbn6xFs5VR3zsIylAvy9wkkkjTUQCpXQPb 4U7j4tKpvZdbGxzTDZuMNnSbwWrJa0Xh5NOp64gyQII1xr7Qj4CKKV4A+BAAGhsiJeRo eWW/jsjaUamqrESeIYuTCMhg/jKPJyeJkmetV2rEOiVXR40zA9Q2Tcsobsvf8F1LCpGP 3xmQ== 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 w2si37263987pfg.78.2019.01.29.11.02.55; Tue, 29 Jan 2019 11:03:12 -0800 (PST) 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 S1729308AbfA2TCm (ORCPT + 99 others); Tue, 29 Jan 2019 14:02:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52288 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727165AbfA2TCl (ORCPT ); Tue, 29 Jan 2019 14:02:41 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0177CA0484; Tue, 29 Jan 2019 19:02:41 +0000 (UTC) Received: from redhat.com (ovpn-123-79.rdu2.redhat.com [10.10.123.79]) by smtp.corp.redhat.com (Postfix) with SMTP id DA0CC5C893; Tue, 29 Jan 2019 19:02:37 +0000 (UTC) Date: Tue, 29 Jan 2019 14:02:36 -0500 From: "Michael S. Tsirkin" To: Thiago Jung Bauermann Cc: virtualization@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jason Wang , Christoph Hellwig , David Gibson , Alexey Kardashevskiy , Paul Mackerras , Benjamin Herrenschmidt , Ram Pai , Jean-Philippe Brucker Subject: Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted Message-ID: <20190129134750-mutt-send-email-mst@kernel.org> References: <87zhrj8kcp.fsf@morokweng.localdomain> <87womn8inf.fsf@morokweng.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87womn8inf.fsf@morokweng.localdomain> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 29 Jan 2019 19:02:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 29, 2019 at 03:42:44PM -0200, Thiago Jung Bauermann wrote: > > Fixing address of powerpc mailing list. > > Thiago Jung Bauermann writes: > > > Hello, > > > > With Christoph's rework of the DMA API that recently landed, the patch > > below is the only change needed in virtio to make it work in a POWER > > secure guest under the ultravisor. > > > > The other change we need (making sure the device's dma_map_ops is NULL > > so that the dma-direct/swiotlb code is used) can be made in > > powerpc-specific code. > > > > Of course, I also have patches (soon to be posted as RFC) which hook up > > to the powerpc secure guest support code. > > > > What do you think? > > > > From d0629a36a75c678b4a72b853f8f7f8c17eedd6b3 Mon Sep 17 00:00:00 2001 > > From: Thiago Jung Bauermann > > Date: Thu, 24 Jan 2019 22:08:02 -0200 > > Subject: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted > > > > The host can't access the guest memory when it's encrypted, so using > > regular memory pages for the ring isn't an option. Go through the DMA API. > > > > Signed-off-by: Thiago Jung Bauermann Well I think this will come back to bite us (witness xen which is now reworking precisely this path - but at least they aren't to blame, xen came before ACCESS_PLATFORM). I also still think the right thing would have been to set ACCESS_PLATFORM for all systems where device can't access all memory. But I also think I don't have the energy to argue about power secure guest anymore. So be it for power secure guest since the involved engineers disagree with me. Hey I've been wrong in the past ;). But the name "sev_active" makes me scared because at least AMD guys who were doing the sensible thing and setting ACCESS_PLATFORM (unless I'm wrong? I reemember distinctly that's so) will likely be affected too. We don't want that. So let's find a way to make sure it's just power secure guest for now pls. I also think we should add a dma_api near features under virtio_device such that these hacks can move off data path. By the way could you please respond about virtio-iommu and why there's no support for ACCESS_PLATFORM on power? I have Cc'd you on these discussions. Thanks! > > --- > > drivers/virtio/virtio_ring.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > > index cd7e755484e3..321a27075380 100644 > > --- a/drivers/virtio/virtio_ring.c > > +++ b/drivers/virtio/virtio_ring.c > > @@ -259,8 +259,11 @@ static bool vring_use_dma_api(struct virtio_device *vdev) > > * not work without an even larger kludge. Instead, enable > > * the DMA API if we're a Xen guest, which at least allows > > * all of the sensible Xen configurations to work correctly. > > + * > > + * Also, if guest memory is encrypted the host can't access > > + * it directly. In this case, we'll need to use the DMA API. > > */ > > - if (xen_domain()) > > + if (xen_domain() || sev_active()) > > return true; > > > > return false; > > > -- > Thiago Jung Bauermann > IBM Linux Technology Center