Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2105280ybv; Sun, 23 Feb 2020 22:52:00 -0800 (PST) X-Google-Smtp-Source: APXvYqwmMwuZyI6kEKWi+5VM9OX5VpE4zAR9oo/RHOjCZJs9oXCubb3VXLUnZvz3QHWtHfz8dXzD X-Received: by 2002:a9d:7c9a:: with SMTP id q26mr41361779otn.206.1582527120608; Sun, 23 Feb 2020 22:52:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582527120; cv=none; d=google.com; s=arc-20160816; b=mFszmXmo/xPlJ2H6jSvi7HOuNwT87J2lps7FnE7H+hvfsgQkXjpzGlmeQN1NgG4gm9 laGgieUfpex8BIDPVMKG3vQ/LEBvJPnj7VmGLzNXgi8ru6IzIjr09NrtrE872s73eB3O 5D3HjwyZ+u2A1FZPkJcMWxlCoWS9nrzl+hAdjQUpJWcJ4Gu3KS8V0NtPsR+J7fBGMFO3 Ng+rxGKXuIkQtjp8JwadxG2jVU/bpEmjeQ7d4VXVEH6nKk8+HnF0hCNg39TgSj7Q4NJs t9cq0fVXOh8tlK2sHjsOn7S05v7sp9jhdWay1fgqf4aHlc0GXLs4n6HXd4lHXfOaXArD rTNA== 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 :dkim-signature; bh=uc+u4kOQpWKNvvthWOfkYtI+hYjtokYfcrE3OMEpahQ=; b=s0WfS9SCvRb69QTBARlctk8zIg8xC2UAQEp/i8sT6d0ACm00zf5U9sf2MkoqJPY2Jx Gea7aBb/LMpEJgYL69wIUhjd0N0Uy83XCsJa/vTj+4S00fm+H1/cxEg2v43glhS7W/iW lRfSPumRWkhhg3LUh/amu2ywKfRqPrrWFb8OeTHa0DapViMaCENE+wHO/vU/nrEA+n+5 6yRSGiOdF4zRJWYoCPDPBKdyIx8pPITy7EOt3bCfTbg5PSqPU9axPfEmJdXRZ3OA9c5f 1bjIUWXNjLp03ofwTR2l5U86AJXCfBMLzY5molAQMfKoGcCi/cEtQuKro0cPCjloejxn UJNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=gMA87Wx6; 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 c189si4374115oig.74.2020.02.23.22.51.36; Sun, 23 Feb 2020 22:52:00 -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; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=gMA87Wx6; 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 S1727186AbgBXGv1 (ORCPT + 99 others); Mon, 24 Feb 2020 01:51:27 -0500 Received: from bilbo.ozlabs.org ([203.11.71.1]:45701 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbgBXGv1 (ORCPT ); Mon, 24 Feb 2020 01:51:27 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 48Qt596JR7z9sRQ; Mon, 24 Feb 2020 17:51:25 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1582527085; bh=4toq+o4FWYWnXZF2qhVnr45b/rNEVYKG5cy9H9uQF6w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gMA87Wx6tBiuJB6UgG+glqvbxC6ABwj/iRhqAEx62Xk9uiswratDNTSr3AAa71CXv GPUNJKQ/bDn7vXGBXFm2T/BC6o2tFusk2R+id/HezhrRbfqJ0xpErOvpDBEnHAlL93 576GQ8Ja7NR/3iFZTxbI/J02SIr0x/x5yeKPtEZk= Date: Mon, 24 Feb 2020 17:50:53 +1100 From: David Gibson To: Christoph Hellwig Cc: Halil Pasic , "Michael S. Tsirkin" , Jason Wang , Marek Szyprowski , Robin Murphy , linux-s390@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Christian Borntraeger , Janosch Frank , Viktor Mihajlovski , Cornelia Huck , Ram Pai , Thiago Jung Bauermann , "Lendacky, Thomas" , Michael Mueller Subject: Re: [PATCH 2/2] virtio: let virtio use DMA API when guest RAM is protected Message-ID: <20200224065053.GM1751@umbus.fritz.box> References: <20200220160606.53156-1-pasic@linux.ibm.com> <20200220160606.53156-3-pasic@linux.ibm.com> <20200220161309.GB12709@lst.de> <20200221025915.GB2298@umbus.fritz.box> <20200221163645.GB10054@lst.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tv2SIFopg1r47n4a" Content-Disposition: inline In-Reply-To: <20200221163645.GB10054@lst.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --tv2SIFopg1r47n4a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 21, 2020 at 05:36:45PM +0100, Christoph Hellwig wrote: > On Fri, Feb 21, 2020 at 01:59:15PM +1100, David Gibson wrote: > > > Hell no. This is a detail of the platform DMA direct implementation. > > > Drivers have no business looking at this flag, and virtio finally nee= ds > > > to be fixed to use the DMA API properly for everything but legacy dev= ices. > >=20 > > So, this patch definitely isn't right as it stands, but I'm struggling > > to understand what it is you're saying is the right way. > >=20 > > By "legacy devices" I assume you mean pre-virtio-1.0 devices, that > > lack the F_VERSION_1 feature flag. Is that right? Because I don't > > see how being a legacy device or not relates to use of the DMA API. >=20 > No. "legacy" is anything that does not set F_ACCESS_PLATFORM. Hm, I see. The trouble is I think we can only reasonably call things "legacy" when essentially all currently in use OSes have support for the new, better way of doing things. That is, alas, not really the case for F_ACCESS_PLATFORM. > > I *think* what you are suggesting here is that virtio devices that > > have !F_IOMMU_PLATFORM should have their dma_ops set up so that the > > DMA API treats IOVA=3D=3DPA, which will satisfy what the device expects. > > Then the virtio driver can use the DMA API the same way for both > > F_IOMMU_PLATFORM and !F_IOMMU_PLATFORM devices. >=20 > No. Those should just keep using the existing legacy non-dma ops > case and be done with it. No changes to that and most certainly > no new features. >=20 --=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 --tv2SIFopg1r47n4a Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl5TckoACgkQbDjKyiDZ s5K3ZRAAhMCdmN1OrUKfgLFhJWQQeC89dOZY69wRPSGHIRGqp2vdz/84iVFYTXtM KJIVtt/k4q5tdpB8FDlRYkPkBjAxZxwUXCQ5ErZ8bUW+1l9qidMcmM81ud6CuDo5 JnNILm61f05ut+aJtoH8N9pHLWVp6Xd7D0U2EuZm3O1E1Ru7eWh89XVqZszqy/0v wU+HF11K6jWai0ZBUmsbHzRzklrXB832SfHRxREYTgaAnfIJciC+VoYClfLDdz5l IHqFw/HkmOM0gbiuTsirWTmIZYgdiGm2luvqn3UJRSUeMur5r1KAQb54VdTXoxm6 85M7AILjY82m3QKG4xWbSzH778IFxv3fhbfNo1lOT0f4IAn3bJ3xNrlP72vmzq03 mnU3XYWDD7Bi7ohPJmNL/KatbmLDSBGW55f6VxdcydKUEWC4EOdLhAm3D1L9GOI7 m9MOyhkKifhvysv3yA4+Wu6lEhJS7C/xLLzZIKuXS/2YWeplK4meqBoIgBnLD9L1 oD4EK/yI9AQu0WLj2SPUP5jWzMxaUzKHrseBf8Lzk1i/IrMrOxqYF3+Mz6hHZkey +3lNPAAPuD+FeZC34MWsH7jL/JPT3RPDGHjtIf7fP2f/VPZygVJCOUh5/vYnX4dI v2Jd5yIETXGCRsGnZcxnszGVK3J0zN+skCNsyIZKwRBsZuBTLj0= =Q89/ -----END PGP SIGNATURE----- --tv2SIFopg1r47n4a--