Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1127928ybl; Tue, 13 Aug 2019 07:48:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIpHSjNOXM2g//4w3p89+m5olhO95iHVOO1LeTCpBrKYa8rhqLpLLkmSBCBIDwIdmVZIv4 X-Received: by 2002:a17:902:4324:: with SMTP id i33mr37680315pld.108.1565707735954; Tue, 13 Aug 2019 07:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565707735; cv=none; d=google.com; s=arc-20160816; b=hom4c59DP5c0eQpz5KP7Ncs6Jabs+mW6L+yHo+SGqrt3S5ohk6yIi0wcC4bu/o3JWh JzyBM+7v39G9MPo1dJezU7eRTiA7mt0+GsZQKX0c+eJe9+KyKO7dAH/w8iLQaxUY08zE DM8+OS2pDIwXGpRm9rrFzuiCVh2uB1a3jkN6bYtksNFmujf9GY1WEKmQ3A8gJCj6F5KJ cUwCGvUBrhufPeRM5B336PjXjzT9lieEmc8XDsAjKrnxt5aa7+7hzcqw+au17oTrkYGG x3EblYayyXqctAIOH5zY4SUv4SgblAu3x2w98Y628nvPU9X1Z6cWLj73ADdoKIqgYfVo jnwg== 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=XhD9o+QfV0sOCbEo/j+moJNjUbqhqXQ61fIHebnaNbo=; b=KEoCtS3ZTg/I491Y6Dl7iVW+q+FurRIkNBxoUfFrMfYq+L/o4Tfo2gd0XO0LHqZWnD f1lSsaBEj+llrzkW9BvGOEqCONGbp+iOYN31cvMDkiLIJq0Y6l9Co1GCaow9hfR8mzwL dVk/zXs8d1e3JqoVd720enDAzE6kD2G1oZk3/KXTEmG2WVAATKZxvRZ2A3ccW7jZshoG PBOrY5Mok2hpGrbEmcuQwViIiY2VyrmKSKZtl1uNBfUQtUAQs76vDOcjZp1hZjUYNScV b6emK7qlk1yhF19S2VlFN22vszt5DExZKXD28OISWcQytBUIbr0X+1X7B77DYh29mv4P TBpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=RL7wRDBn; 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 m9si1067158pjs.95.2019.08.13.07.48.40; Tue, 13 Aug 2019 07:48:55 -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=RL7wRDBn; 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 S1729680AbfHMOrr (ORCPT + 99 others); Tue, 13 Aug 2019 10:47:47 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:37969 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727561AbfHMOrq (ORCPT ); Tue, 13 Aug 2019 10:47:46 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 467Ftl594Dz9sN1; Wed, 14 Aug 2019 00:47:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1565707663; bh=YSf4/YKDTs2wsPKYpWpVsROZ9TkPMAXnHxWQNLas4ZQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RL7wRDBnOANeQePVqkn3FJuiHQUYJQd/cb/dQZ/3SDxdB92pdJf/cJeJiDGnTLJCl rBSj0c8hn7JlnGn2go3uzHbhLJcFsA97E5o9TJgefD0W+kXcz8Fww9xsPBQGXHpdmu iQo4GX9xOdCk3vr3TirWKAtH2Rhs2p3fGutGDX0E= Date: Wed, 14 Aug 2019 00:24:39 +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: <20190813142439.GO3947@umbus.fritz.box> References: <87zhrj8kcp.fsf@morokweng.localdomain> <20190810143038-mutt-send-email-mst@kernel.org> <20190810220702.GA5964@ram.ibm.com> <20190811055607.GA12488@lst.de> <20190812095156.GD3947@umbus.fritz.box> <20190813132617.GA6426@lst.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xexMVKTdXPhpRiVT" Content-Disposition: inline In-Reply-To: <20190813132617.GA6426@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 --xexMVKTdXPhpRiVT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 13, 2019 at 03:26:17PM +0200, Christoph Hellwig wrote: > On Mon, Aug 12, 2019 at 07:51:56PM +1000, David Gibson wrote: > > 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. > >=20 > > 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. >=20 > I agree with the above, but that just brings us back to the original > issue - the whole bypass of the DMA OPS should be an option that the > device can offer, not the other way around. And we really need to > fix that root cause instead of doctoring around it. I'm not exactly sure what you mean by "device" in this context. Do you mean the hypervisor (qemu) side implementation? You're right that this was the wrong way around to begin with, but as well as being hard to change now, I don't see how it really addresses the current problem. The device could default to IOMMU and allow bypass, but the driver would still need to get information from the platform to know that it *can't* accept that option in the case of a secure VM. Reversed sense, but the same basic problem. The hypervisor does not, and can not be aware of the secure VM restrictions - only the guest side platform code knows that. --=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 --xexMVKTdXPhpRiVT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl1SyCcACgkQbDjKyiDZ s5I4bQ//S4EUhoZcI/LsW/VYsc9vUb4nR5PFUpsfHBRPpz5LSCyiE0zj6HPD0NEw xx7wFiEoEoijTK2eUAql0bciMMkjU4bktaIRNxHL0gHTJ+bYC0JQK42DBFC6t/9L 2D5DD8K9CYwIwxjYOPlxaxCEJfVKLLCMwBXmO3n1wbp3DO4ejeOq6TcsFfzF079C rj1ofD3aAdjKicydMAWXVOly4fcAimPwCI+CU/hEuAiT5OOsvl3RkOcPQ2psC0kr AhWUtFFDmdTosz+3HvByFrQoIsWS833CETD/+h7QPRfcgdDnoctb5QY9oyqSCxvH phO1O07WExt8rXrRAWJvP81K0n+b4cTuw8aUKp8qchHopQUrSiUfwM0vLFgbHmPj qG+x3Z1XfdMRWJjnst0aF/EMnI3GXl+d2hzMJLbXicj0F4HLnn/F2mkQbXRkOcFw 8gilmJLNmOhUWo8viy7dc90YU2i0HOQd6h0j+5fyfhYKf+4fWvodL6thBGHWWiTk g63CjmoEZByRc5iDwuGf3vRBsFU26hDHYXh3mk8+AEmfZ0zMfE+6NvgEdPOvU82A bwQU186bnnTF1AjRiGfC69gX4Dfe077FiFjcDwS6ojR+21MojjdITMsVOKw4ZwfQ wwnomYbPb7NjK2QJcSM8AqbQftwvqAIzBtjPEOsknnb4VyoVTXs= =2Lh2 -----END PGP SIGNATURE----- --xexMVKTdXPhpRiVT--