Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2541116ybt; Tue, 16 Jun 2020 08:37:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHZi+bpREmXKOsER6B+UgN27t/LFGRqVh6XjmWSza2HXdznNFLh7nasvB+y8n53/pc9fVY X-Received: by 2002:a17:906:490f:: with SMTP id b15mr3278913ejq.180.1592321832066; Tue, 16 Jun 2020 08:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592321832; cv=none; d=google.com; s=arc-20160816; b=0+Dq30liKSljADYS1KzxIIx+NYBHqE+Vu62ACTjbm3f0zJLQuat6dSORJdyV2cUsUd bRmcRQ/45oDXGpheCedrl++a7fcxVjfdpjqlZPN/9m33Av4IifrJw1024uzm1DyKFESt a8ujiGDMybKacu/ueKzre6v9tXnADvaBpfRvh9ksL6qdPJk2WB9dztprx+8jY4Fb9qKc 07C0DNfS2OA+SjYsEd8CD/vnc6r2q6AID+KNZEkgVMnYVuv9yD+9NPFYrAL1VtqOZAbC lLQqFzJMK/CzCaucp1CGon/G6PhUiSqngt66QRXLckW539J2kWXgbIfL8I8rUb1ifipp TcXg== 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=heeKT585/GdJnkdDzmupKcXSMWfb3JfA/9n//HJB8KI=; b=sCYNwHFAQtuUTIyIdoTOhiFCh4RZMKQH9UZiuyZ9ce8Nv5o85L+Sk/xjEd9mVbEiED dnc9N1sFA5Bs866Kryc046UCYz2j7F4ZUBkpYp+/JkgxdzTPbCljqP85blMqnJN/TjKL 3GETJb8FfUbOOSinTPlb54F+oLftW1r2gmqBXZd/bRkCR/p25kbGdlyz4UIbysAR9Nfz Bf5NHjzyPhGMqgD4tx3eyjeidvtlboy7pFfV69ubC3X8OEm71m6xyN1/jMZf4NmLgwQq XXqDalxIhnQUXd1Mkhmm7xQ+ySYJ66WdfvpJOO8SLy/8tZ8pAJqK/FFosUOXntummRek fQyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cVYrNLNB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r27si10679039edl.187.2020.06.16.08.36.48; Tue, 16 Jun 2020 08:37:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cVYrNLNB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729833AbgFPPeo (ORCPT + 99 others); Tue, 16 Jun 2020 11:34:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728448AbgFPPen (ORCPT ); Tue, 16 Jun 2020 11:34:43 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28302C061573; Tue, 16 Jun 2020 08:34:43 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id x13so21236614wrv.4; Tue, 16 Jun 2020 08:34:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=heeKT585/GdJnkdDzmupKcXSMWfb3JfA/9n//HJB8KI=; b=cVYrNLNBPz0x7FpNz+U7hpChITwYsvE8DuKNm4jFWi++FFsx9Oy5FGkGG7EMAeixt5 U3WtXC/XYWsXL42lruWiNAMIaRDKlzVff8qoSZ6PoHK8XWLzziskLvOWnmeVBWIZHREj CLvmtD80NhJ1D3CeNego+GCMSfHpbodVfLy68PkArxZaBkTttH9eFkxIviYNo08PweY8 sS3ZAV6yrqnkiOElaGZ4qLNldl23QnU4OchQd0QTff25M+gljt2uNkwy5AgCTYni49N3 NPLLKrZrawdCqgE+FotClWohXnwxarw70eHiR7UTtByQZ6/I8ry/BGO43Iok3f9zc6iT ZDfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=heeKT585/GdJnkdDzmupKcXSMWfb3JfA/9n//HJB8KI=; b=YNZDwyxupcP++IpDYgee3U0DRKGNhrfylg5QMqsAeVUTTr6mmYFqOXT8/nGvouY/YQ BZMSzh9J1MTZdleeX5sVKERcOjy3Vr1Rvq2xh5wLfjJ/ErEIfSla1iSljhXuhxGmxvLg GI3RzxTBtkCjvO8WDSfFdvqSFtxy04QEOb/TaWKgfNkqjw/iZ8IvVPwa4P3tyuNFCuVn PPeIpP/NIgiN/JMf/BTDDT8dpuNjs9oGHnt97Fl17r7thTnKkR6hlx/Ef8YUTAJt5LSx caL1uUpaapN1URn+IxfFrQviaW4CQd2ElFkR9zL0IGSc6y+Flu9coYxLfO9bwOV3GEry OQeg== X-Gm-Message-State: AOAM532etjRxO0PXpBO8ZhLrjZaPpVWctlg0dIlBkqnKA48ZAW4GVbFs a2zHYQ4I8ZpHwRtBKqyIddQ= X-Received: by 2002:adf:e692:: with SMTP id r18mr3503560wrm.192.1592321681879; Tue, 16 Jun 2020 08:34:41 -0700 (PDT) Received: from localhost ([51.15.41.238]) by smtp.gmail.com with ESMTPSA id j4sm4815947wma.7.2020.06.16.08.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2020 08:34:41 -0700 (PDT) Date: Tue, 16 Jun 2020 16:34:39 +0100 From: Stefan Hajnoczi To: "Liu, Yi L" Cc: "alex.williamson@redhat.com" , "eric.auger@redhat.com" , "baolu.lu@linux.intel.com" , "joro@8bytes.org" , "Tian, Kevin" , "jacob.jun.pan@linux.intel.com" , "Raj, Ashok" , "Tian, Jun J" , "Sun, Yi Y" , "jean-philippe@linaro.org" , "peterx@redhat.com" , "Wu, Hao" , "iommu@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 00/15] vfio: expose virtual Shared Virtual Addressing to VMs Message-ID: <20200616153439.GE1491454@stefanha-x1.localdomain> References: <1591877734-66527-1-git-send-email-yi.l.liu@intel.com> <20200615100214.GC1491454@stefanha-x1.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TD8GDToEDw0WLGOL" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --TD8GDToEDw0WLGOL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 15, 2020 at 12:39:40PM +0000, Liu, Yi L wrote: > > From: Stefan Hajnoczi > > Sent: Monday, June 15, 2020 6:02 PM > >=20 > > On Thu, Jun 11, 2020 at 05:15:19AM -0700, Liu Yi L wrote: > > > Shared Virtual Addressing (SVA), a.k.a, Shared Virtual Memory (SVM) on > > > Intel platforms allows address space sharing between device DMA and > > > applications. SVA can reduce programming complexity and enhance secur= ity. > > > > > > This VFIO series is intended to expose SVA usage to VMs. i.e. Sharing > > > guest application address space with passthru devices. This is called > > > vSVA in this series. The whole vSVA enabling requires QEMU/VFIO/IOMMU > > > changes. For IOMMU and QEMU changes, they are in separate series (lis= ted > > > in the "Related series"). > > > > > > The high-level architecture for SVA virtualization is as below, the k= ey > > > design of vSVA support is to utilize the dual-stage IOMMU translation= ( > > > also known as IOMMU nesting translation) capability in host IOMMU. > > > > > > > > > .-------------. .---------------------------. > > > | vIOMMU | | Guest process CR3, FL only| > > > | | '---------------------------' > > > .----------------/ > > > | PASID Entry |--- PASID cache flush - > > > '-------------' | > > > | | V > > > | | CR3 in GPA > > > '-------------' > > > Guest > > > ------| Shadow |--------------------------|-------- > > > v v v > > > Host > > > .-------------. .----------------------. > > > | pIOMMU | | Bind FL for GVA-GPA | > > > | | '----------------------' > > > .----------------/ | > > > | PASID Entry | V (Nested xlate) > > > '----------------\.------------------------------. > > > | | |SL for GPA-HPA, default domain| > > > | | '------------------------------' > > > '-------------' > > > Where: > > > - FL =3D First level/stage one page tables > > > - SL =3D Second level/stage two page tables > >=20 > > Hi, > > Looks like an interesting feature! >=20 > thanks for the interest. Stefan :-) >=20 > > To check I understand this feature: can applications now pass virtual > > addresses to devices instead of translating to IOVAs? >=20 > yes, application could pass virtual addresses to device directly. As > long as the virtual address is mapped in cpu page table, then IOMMU > would get it translated to physical address. >=20 > > If yes, can guest applications restrict the vSVA address space so the > > device only has access to certain regions? >=20 > do you mean restrict the access of certain virtual address regions of > guest application ? or certain guest memory? :-) Your reply below answered my question. I was wondering if applications can protect parts of their virtual memory space that should not be accessed by the device. It makes sense that there is a trade-off to simplify the programming model and performance might also be better if the application doesn't need to DMA map/unmap buffers frequently. Stefan --TD8GDToEDw0WLGOL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl7o5o8ACgkQnKSrs4Gr c8g6Tgf/Van2m7eceyvVRw03HdeF1bB30zQNxTLZWlAYDwU8aW2VTupF58Qp/21A SqcR20C9LsPofsXKrbhWfK+6FVu/HxqQTR2cNtRLGE6/lSMB892d4YC/wEgMPWyb h+bHpwTOxse5/ywwglCtapKMgTpLdtvFWXGRAF5/g4BLM19dEji5JoSZf1oQEIT6 g8aCbxYoaD9GyE7HpYazYL1xPawp67YQNIp833WVsNky/9F/b9qnJxsg9QcVVJyq 2wcW/9L18xKbM2lEBHgIkJp/6tumX0x02wn5E+TsLj5l1X5FxMC5VDqUY4dovBvu yzWMCyrcU+JnPV6o2VOhBqNiZf4SZQ== =jhcy -----END PGP SIGNATURE----- --TD8GDToEDw0WLGOL--