Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp712750pxf; Thu, 1 Apr 2021 11:32:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN2WGIFc5IgyACSf3BB69umF6KuS1MFPO7bzxzkzcq0kgdf+g+Yh74QlzQGbAe5a/+Xd9Q X-Received: by 2002:aa7:c6d2:: with SMTP id b18mr11336766eds.183.1617301951733; Thu, 01 Apr 2021 11:32:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617301951; cv=pass; d=google.com; s=arc-20160816; b=0GRm3kPEGsHqRWdV9ZmH0KkPJeQz39gk+wnOpVZaP+4XsGFlHsNsIimUtTqiSC4q6i GttaF7caqo2SselGvrbnPAqOwz/PBiWAGTaWOiglToJXT8e7aukjChiXw722+E8n36e9 nI+aIRvjQxRcF/uUvENKfO/yHoxAGPryvvg5WO5msuDMgwaGaB1i9X98Itv2PuU2viHl nESRYargrvju2DIgrTsw99NESG9lXOIdIet50w82+uvbMQMON4R0Cj6pY2nHgKUFAlZc 8TkPJDast1GsicnsxZ+ibY/ZGtMtxQ0ztGGkqmuj9VauQsf55LF6T1Is/V9oC7kMdw4W Yprg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :dlp-product:dlp-version:dlp-reaction:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature:ironport-sdr :ironport-sdr; bh=CThGP1dhY/be4EXdHHIcLSxePjmSzukC4ztmKDvteHE=; b=W3huY9HPkir8Wrq8uKsNlz2a7RbC9a9/G2ZLBDX9g1VSwOvuKfF4tQOI/1OVsUqkzX 2FOX4Q0cfpc2duuTd3c2JIrEOZUtytq4i8i6o7TgWJJtTEHQ7x+pTF6WJExGt5tW/yQ6 xbi0bEoYxsQZ7DwjJP8gcuxJbVwZWzyYRNKI0kxowOCgc57S6pkZHsxTLKfjD6xXcYJw 6KqfAjiC+nQJjy2ZAE/Q8leUHVnXH0LNkwKH8Cduuib4F157F00ERMlMLOOIF8H2ec0n 4nxbu4vv4mPQLmbOanIjobMStWBqlw6kYhq3OsKHi+Tyh6RZ0lD583LBhrKrXpGHss7d +2+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=dIy8FO6U; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si4696112edy.407.2021.04.01.11.32.08; Thu, 01 Apr 2021 11:32:31 -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=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=dIy8FO6U; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240136AbhDAS3Y (ORCPT + 99 others); Thu, 1 Apr 2021 14:29:24 -0400 Received: from mga06.intel.com ([134.134.136.31]:62833 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238314AbhDASGE (ORCPT ); Thu, 1 Apr 2021 14:06:04 -0400 IronPort-SDR: nH/ctAkkex/3kK/2zACKkzxqQiFscgoq6yeb5GbAWSo//UHrTigHJiVzXkuCHOohfewuJcZBQ8 xDoKHwwrJAmQ== X-IronPort-AV: E=McAfee;i="6000,8403,9941"; a="253582135" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="253582135" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 06:43:39 -0700 IronPort-SDR: pPJ73sFre6IHLbSVnnPjxoZg55NsNB7lud1i4iI5G3Ztuol0QNkbwl1/HfxS2y6O94pv7s9nz8 i6tQPQuW0wYA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="379321987" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga006.jf.intel.com with ESMTP; 01 Apr 2021 06:43:38 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 1 Apr 2021 06:43:38 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 1 Apr 2021 06:43:38 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (104.47.37.51) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Thu, 1 Apr 2021 06:43:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XLXdvTUW9B7I19dfPr9ffr8I1WbYC+4IHsRJFvsvbyrCPDkgWsGDE4o/dUdOrZWtkWQjrrR9PCV0AaLLLOw0MWvrRLAazJliSDRwtpa5ICDh2K2n82cqVyHuYL8a3tsPsKHi1Q7/29qxDNlTmMtaQfAdjUi/UpI52awpjZQoFH+HapF91GYaKqY8bEXaws04PKdm/QAv/+m+K609M3Qtaa3f8T+D8Xjows0FT+dICzKTvrsP1R/9IzclNxPmHIRRiBB8Snepw2mm2sT05Yb/K2yk7UNleiFctff1DjHSGVyS8gCs+V42BwJ9KIXCdmKPWvem+tqNVY4vYPkyKWt5aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CThGP1dhY/be4EXdHHIcLSxePjmSzukC4ztmKDvteHE=; b=HIHFTT2AIXBavdu8dcoKMjLxV11GraAuClU9Cm1QhSU7v0Orbi23KWjO0neoT/40D7iM0MwwfBM9dKjQTatC5ZJ9BVOV3wBxmdkXjSQwMUan6e4R/QbCGwu+jaoB2w/lUExfGQ6+xrKy3HlU1u7TyklT5Ir8XLaOGOW1alQ31wqMUtJ+Sepa60VWp29WcHfcC4xSBONqySiz0UD5NRZhUgm0tztDgRsHMB6qqK2q5CAl7trN0D2WnltVcwz8NFIEgg5BaT/+DAPmA9U3RTqdT+00LorvNIw+OygtcZNoI2+zjM4GkUlcajpdmggEx7KRMQBa3wazLIT33XvkenexLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CThGP1dhY/be4EXdHHIcLSxePjmSzukC4ztmKDvteHE=; b=dIy8FO6UtQYuXY5ZhZ8dnENSVBjTXUshRa/OCSxyX5kYb7dvPbqJ077TSWdhAD3iDj1PLzgQXeUiamPHlK148ZJ0TcsxDdNHsVFgEgb2caRb0UOgUMEm5fVjk6IYhJoER1lI2QH3aJRNeKjdBwYneuNMaB3cznnD1bwGq2lvmQw= Received: from BN6PR11MB4068.namprd11.prod.outlook.com (2603:10b6:405:7c::31) by BN9PR11MB5338.namprd11.prod.outlook.com (2603:10b6:408:137::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Thu, 1 Apr 2021 13:43:36 +0000 Received: from BN6PR11MB4068.namprd11.prod.outlook.com ([fe80::5404:7a7d:4c2a:1c1d]) by BN6PR11MB4068.namprd11.prod.outlook.com ([fe80::5404:7a7d:4c2a:1c1d%3]) with mapi id 15.20.3977.033; Thu, 1 Apr 2021 13:43:36 +0000 From: "Liu, Yi L" To: Jason Gunthorpe CC: "Tian, Kevin" , Jacob Pan , Jean-Philippe Brucker , LKML , Joerg Roedel , Lu Baolu , David Woodhouse , "iommu@lists.linux-foundation.org" , "cgroups@vger.kernel.org" , Tejun Heo , Li Zefan , Johannes Weiner , "Jean-Philippe Brucker" , Alex Williamson , Eric Auger , "Jonathan Corbet" , "Raj, Ashok" , "Wu, Hao" , "Jiang, Dave" Subject: RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Thread-Topic: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs Thread-Index: AQHXDZuc1/oaTFwUU0WheDxUmLBHiqqKkLIAgACg94CAAC72gIAAD04AgAADogCAAErUgIAETQEAgAOaswCAB7C3gIAAmFuAgADGxQCAAR7PEIAAZiYAgAECgOCAAIDKAIAAErowgAAGEoCAAAbzsA== Date: Thu, 1 Apr 2021 13:43:36 +0000 Message-ID: References: <20210322120300.GU2356281@nvidia.com> <20210324120528.24d82dbd@jacob-builder> <20210329163147.GG2356281@nvidia.com> <20210330132830.GO2356281@nvidia.com> <20210331124038.GE1463678@nvidia.com> <20210401114648.GX1463678@nvidia.com> <20210401131533.GD1463678@nvidia.com> In-Reply-To: <20210401131533.GD1463678@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ab588b82-73c2-4872-a3f6-08d8f514265b x-ms-traffictypediagnostic: BN9PR11MB5338: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Mq6ezhVNfJSF0mOAR7bP/Yyh67Pei6ZHRzY77wMt4EWtYd3Ag9hya7bK4JHrs5G5wds5jiNx9cysC2P7Ye4ryBD1163RjSui9UA3vhJIpC46aVX/eeRHkMd2q5hx+7xQSvNbFAsxuCVBkJ0/67Smv2TbgaCTeBF9y6BMQMT7NnT7caual1uIkLwG69L5r6cVDt+E1WtQsLiodjdgVxtMnwx8H6MmjuDDahvOGMRmT5jpZvYYEa+C5HeIoO6V3zrchIN+NPFi/EnKVoua0ptin0RZ1rCcDJbjT3w+LZlt8j6KkgAhPdP3lY2DY6Ab3fr9d+yKhEtGMlXj/9xKEN0iU3nAl6xwbwArk9kuJzVydKjrgGa4/NLZJnatDwejFamgP84LOF2qLlSss0pazdPGxcqn+VU/1itLBCS/0c9esReqbrBvk5As6YQk/EP4xBimx/GBzZuDg8WrVi0ndrqrQI9bwyoDRevRTJfLsxKWtb5KkHDjnvcYHCROxbTqwALsPjmU8ZQhNiRv/mDka7w/X9dFS+fsLjdf25k2IvKzTthuN6UA5WkHE260ClhCaVYIJt1BYnC21Mw2LRRmuzaPNHvkoQh310KbeKcVvTvRCX8eZFwS0yI+NoCOLfNYKRu/o1AkcbR4flMlte4IjngDQaBQzSNclbBpsM0eI5phktLYobj21PxxdCL0YcmF32XvGwj7fVzceNsdHw5RB7/Bh2NmVQjguJM0UDy2crnSj24QCf1ofmxcZzOt+kHV/AN+ x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR11MB4068.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(366004)(376002)(39860400002)(136003)(346002)(6916009)(38100700001)(86362001)(33656002)(54906003)(316002)(186003)(64756008)(66556008)(7416002)(478600001)(4326008)(966005)(76116006)(66946007)(66446008)(6506007)(66476007)(9686003)(55016002)(7696005)(26005)(2906002)(8936002)(71200400001)(8676002)(5660300002)(52536014);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?ZzJhq2YeSsT108F0RRzkdw7h0SzsmWsPSZsWxB1h5Egt415J5bGV8WkQJr3C?= =?us-ascii?Q?W6PAfso7naqILx72uzjkqVHP+fu8v+Dpuo5N0Qdlt205ZgVSh0EekqvSTWc5?= =?us-ascii?Q?bBer3gSKBCsoL+DkS8iEaPmkJnOSyHYpaQXEm/EYVpUrgcjQ2d5uSeoXt1Yo?= =?us-ascii?Q?jNbr6Jcf8ZoXxtp9q3LUQ7CetDLlkMnGnGrFf+KpzR3nNk1od8chhSKkvqtq?= =?us-ascii?Q?5XSYjGnV9+9R0ag/kQjfJW3OzcMhVBCHBCPK3SloOBa1ygI1bJa8hu4qR/yb?= =?us-ascii?Q?AqkUlCaZA9lx8l8actTqee3G822sv+iUZv7ef4UurZ++kh7pzErfw2XngeFT?= =?us-ascii?Q?vv8ADkMY5Heh5FkVziXyNKOkin+6Ifq0wIyujT7ZsvtS73oDi6WCm8W3t/wI?= =?us-ascii?Q?8VkDdswCumr414oEILWx/0NguBkYdF2aP4jxwekwI4/sz6FDOCIdu/U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ZOHLKx?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR11MB4068.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab588b82-73c2-4872-a3f6-08d8f514265b X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2021 13:43:36.2657 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BHjtpmvrEI+mIVnTiahHEODpvLYFKTX2ApCuX0I/TmdeRm5xBYzwb1lLtsh5FoZuKxNEiGt7vtt7ekR6ZL+VZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5338 X-OriginatorOrg: intel.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Jason Gunthorpe > Sent: Thursday, April 1, 2021 9:16 PM >=20 > On Thu, Apr 01, 2021 at 01:10:48PM +0000, Liu, Yi L wrote: > > > From: Jason Gunthorpe > > > Sent: Thursday, April 1, 2021 7:47 PM > > [...] > > > I'm worried Intel views the only use of PASID in a guest is with > > > ENQCMD, but that is not consistent with the industry. We need to see > > > normal nested PASID support with assigned PCI VFs. > > > > I'm not quire flow here. Intel also allows PASID usage in guest without > > ENQCMD. e.g. Passthru a PF to guest, and use PASID on it without > ENQCMD. >=20 > Then you need all the parts, the hypervisor calls from the vIOMMU, and > you can't really use a vPASID. This is a diagram shows the vSVA setup. .-------------. .---------------------------. | 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 https://lore.kernel.org/linux-iommu/20210302203545.436623-1-yi.l.liu@intel.= com/ >=20 > I'm not sure how Intel intends to resolve all of this. >=20 > > > > - this per-ioasid SVA operations is not aligned with the native SVA > usage > > > > model. Native SVA bind is per-device. > > > > > > Seems like that is an error in native SVA. > > > > > > SVA is a particular mode of the PASID's memory mapping table, it has > > > nothing to do with a device. > > > > I think it still has relationship with device. This is determined by th= e > > DMA remapping hierarchy in hardware. e.g. Intel VT-d, the DMA isolation > is > > enforced first in device granularity and then PASID granularity. SVA ma= kes > > usage of both PASID and device granularity isolation. >=20 > When the device driver authorizes a PASID the VT-d stuff should setup > the isolation parameters for the give pci_device and PASID. yes, both device and PASID is needed to setup VT-d stuff. > Do not leak implementation details like this as uAPI. Authorization > and memory map are distinct ideas with distinct interfaces. Do not mix > them. got you. Let's focus on the uAPI things here and leave implementation detai= ls in RFC patches. Thanks, Yi Liu > Jason