Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3816476ybl; Mon, 12 Aug 2019 06:55:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqznwjpnB/RnWRERwCjv2W3q4r1cFT44FMgNJRhVVlMcOc0GldaeyV0UaeLuNEZUwL6eAFbO X-Received: by 2002:a65:6904:: with SMTP id s4mr30177065pgq.33.1565618151112; Mon, 12 Aug 2019 06:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565618151; cv=none; d=google.com; s=arc-20160816; b=bkGx9b6bI6AuwTdDHBuXutwUe596f0N6BzpKbdhHC3J9bPAp3oF7Lse5Nq65wJZuA4 qKG4Or+RMwrbGX25Rrr5R1NLNCsydeSeVfi8TxNp4fjDEzoXy7h5Ti0ADuEYV2vDfYW3 u/zjQ5q+JgNTEb1juALpf4A66/tFDLYkN1hDvRdxUR/U0Guf2NIWPBuFa3VkJrFFuM5n cmNQTtiHtxeW7jilz7eFH8w/7GQNN7ZQkYqmC1Quy3/bCpG7TLvMnqbD0p+xiKJLX/94 k6g4zB1/5LgQFakKGFaMrPP01tSwp9mgkmMaffTafnOMWPJPWaHLZgessydNv7wziAl8 IuHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bYAPJ7PpFeBJ6+/AyeRl90GMy7UeZuyO+5RCssQU1bE=; b=ipxgAed+NPv9Buf+xToPwFy/Vs90BlUSlTbMWhEjHEVMJDbY5SBv427nryYsKW/HUG J8j3AtmCzyfXst/z4Z8TiNw0OzZxSOOoa/mPjPEqF/O49Sfh/V7iilHuzoVTV4arDFzo Q96WAQB+E/ahIgJMK0D+rTDuKUamkD7FeJm1Tn0XSJ/iJRUObpcN/7dsCXWud3p5MhpE QktBcgvUSYtV2gvsviizT7p4xgz6oRll9ESnCNZiHEk85AczHL0Xe5KvRmy4o02MQh1r 6IBnOwJXQ10w/gSpw+LgTQTGNCL+Q5lzsci/GXl+cye5mW+rzcAsxDcplW2Kk6Cj97yy E7xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=XNfChPFX; 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 d8si89964617pgv.61.2019.08.12.06.55.35; Mon, 12 Aug 2019 06:55:51 -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; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=XNfChPFX; 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 S1727621AbfHLNyX (ORCPT + 99 others); Mon, 12 Aug 2019 09:54:23 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:47299 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727136AbfHLNyX (ORCPT ); Mon, 12 Aug 2019 09:54:23 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 466clc5Gzkz9sN1; Mon, 12 Aug 2019 23:54:20 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1565618060; bh=M9fkWHdcEUWxow+UKyurPCc6awYRSJcQDFkH60t6zw4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XNfChPFXwvqdC699kOEIy0Vv+oqCy3B16t+DVeHfqEhPuYXrv4IbL35jznMyfU7fK xOG5C9V9cbX93SGcIh3DMAgNEHFmoczgaOoRGnafCrGMLC0NYRRdQDDxDKSyaVS9X/ M9Vlcq+UBH20ge76b4ysegxd1UGPTyJxvCHp8GEQ= Date: Mon, 12 Aug 2019 19:51:56 +1000 From: David Gibson To: Christoph Hellwig Cc: Ram Pai , "Michael S. Tsirkin" , Thiago Jung Bauermann , virtualization@lists.linux-foundation.org, linuxppc-devel@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jason Wang , Alexey Kardashevskiy , Paul Mackerras , Benjamin Herrenschmidt Subject: Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted Message-ID: <20190812095156.GD3947@umbus.fritz.box> References: <87zhrj8kcp.fsf@morokweng.localdomain> <20190810143038-mutt-send-email-mst@kernel.org> <20190810220702.GA5964@ram.ibm.com> <20190811055607.GA12488@lst.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NtwzykIc2mflq5ck" Content-Disposition: inline In-Reply-To: <20190811055607.GA12488@lst.de> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --NtwzykIc2mflq5ck Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 11, 2019 at 07:56:07AM +0200, Christoph Hellwig wrote: > sev_active() is gone now in linux-next, at least as a global API. >=20 > And once again this is entirely going in the wrong direction. The only > way using the DMA API is going to work at all is if the device is ready > for it. So we need a flag on the virtio device, exposed by the > hypervisor (or hardware for hw virtio devices) that says: hey, I'm real, > don't take a shortcut. There still seems to be a failure to understand each other here. The limitation here simply *is not* a property of the device. In fact, it's effectively a property of the memory the virtio device would be trying to access (because it's in secure mode it can't be directly accessed via the hypervisor). There absolutely are cases where this is a device property (a physical virtio device being the obvious one), but this isn't one of them. Unfortunately, we're kind of stymied by the feature negotiation model of virtio. AIUI the hypervisor / device presents a bunch of feature bits of which the guest / driver selects a subset. AFAICT we already kind of abuse this for the VIRTIO_F_IOMMU_PLATFORM, because to handle for cases where it *is* a device limitation, we assume that if the hypervisor presents VIRTIO_F_IOMMU_PLATFORM then the guest *must* select it. What we actually need here is for the hypervisor to present VIRTIO_F_IOMMU_PLATFORM as available, but not required. Then we need a way for the platform core code to communicate to the virtio driver that *it* requires the IOMMU to be used, so that the driver can select or not the feature bit on that basis. > And that means on power and s390 qemu will always have to set thos if > you want to be ready for the ultravisor and co games. It's not like we > haven't been through this a few times before, have we? --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --NtwzykIc2mflq5ck Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl1RNrcACgkQbDjKyiDZ s5IeEA//dnRJ6mVj+RhQveMWMmeAiLbWMfnm//uTigHRNS3wsKGZnHuzpbBnRoCc lEX8grJ+aGO69ZFe4N41Fad605IFGUjnxTtQn6kMx85m7F6z1+Bdi0B4H/k9iZ77 jr/rVpXQ9lv93Sns8vg9rZloaLf3xt1ZBN7hjecvVNSN5esttOlczRXSCq8m3rGE 2wYsyLox6y/juyLl/f+MOADagIb5ca652DrmInAaER3HgNnMmZGjr+gAjgvzNWRC iYF3i/T/+NQLSS2IgG3eo9kzz3TF9FxmbtpqCynyr/JOUOf+M6vN9IZnr6MDSspR OnUgRJLIOVjAUcG5EDwfoZQIbuJ7rJZ68/q75aJpMWpfrAsEiKPVD42lhDRtPzuT fyT2lVp0ZF+VfSL4lc7nFq/yEG8YCJO2ZtgulzCFo72mPieeMZj3UyBOn0eJZ6Ui lAOZHKgkDuhvNYXigewhujz+kTJ2UlV0ioZ0fOs9ohqOMd3t9RcIn2HIhI1j+2hN drDFJUL6roSn+3rMA8MxCqeumTjFXGEGa9K+MIrVHpCnfgLgxV3Z2Z/gy8TNdetk qobrJcniwJGse95D0BXoU6FDLRTOBsyNXa1ruMT0srHClrFIVRkGGr8fveJvUo/z 9pxHx2HQa0ePV1VCTj0h9YficujWGsF+RwC57aQOeCUFqLYz+0c= =pHtB -----END PGP SIGNATURE----- --NtwzykIc2mflq5ck--