Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp196624lqn; Thu, 11 Apr 2024 20:17:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU31+5stBsjzn7wuhGEYTCmSmPsl/ugToXQC3t+iDbI8yF+LX9shGlGV7F0e0C2R2czUHe/WtP3i8itQWoqLWAxWlOXBT5Bm5S5JgpObg== X-Google-Smtp-Source: AGHT+IFNj4ZmWp43W390WvflWZ3Hg8gI6JLsCPF2TRia1DvNAJOzbUfKTHnycDWKLNgHbrqTtiWA X-Received: by 2002:a17:90a:bc83:b0:2a2:40c4:5175 with SMTP id x3-20020a17090abc8300b002a240c45175mr1445683pjr.14.1712891834193; Thu, 11 Apr 2024 20:17:14 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w23-20020a17090a029700b002a24fd29f92si4587439pja.117.2024.04.11.20.17.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 20:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZdQlTlw4; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-141849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141849-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B0CE5B22000 for ; Fri, 12 Apr 2024 03:13:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 971D414F7F; Fri, 12 Apr 2024 03:13:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZdQlTlw4" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DD4D17BA3 for ; Fri, 12 Apr 2024 03:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.9 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712891618; cv=fail; b=JZHsbudoB39NYQ9PXrQ6dGPg2X4PIX61kuYfPyifkdZohOKIpqIXYjwSTi8t8VQ9mlIP/eXQHSeFTnDHIuRLCk1i60T/CtsxEPc1/eC4hsTBRaihIfiD928rybPhPrAc31tVD7opeIuYC8VtUDvaPgOU/mY+EHf8cnklBdWVmuQ= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712891618; c=relaxed/simple; bh=btbKmN3nB/BCl/MeYqRIxe8xkpWVBh9GUE/OPg5AHdc=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=MUjMeF/98+4JmX0b7vWlBXh6IekFeGj8iIm5p/VI+j86ooKXECYLq9WtkdvzK2h/svEYpSOW4ns+tTpxeWSM15deg4MTT6CkGcN9TNLVN2DDor4p2FD1jQpSVeBs2pHgQHP8HkTcaRgFP7Gv+f3dFXY6UZ3wT/W66/y4WKDyBlo= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZdQlTlw4; arc=fail smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712891617; x=1744427617; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=btbKmN3nB/BCl/MeYqRIxe8xkpWVBh9GUE/OPg5AHdc=; b=ZdQlTlw4ZLqzj2ZgK9ZO5AzMoWe8pBLJThLh0Ja8oT/LGVGwcm6L0nOI POvncYhDRujWl1VGTVgEeN+IGfpjSiUq77CTZABbn0xUTNifGV6M+SiYZ CK+wcerh43xL8LhxdQzBXy6zkHmPoLdF/yUMkpKbY0gxfNXj2a1JcLlX9 5gOzCRk9uGJEHO/gNvLW/s8uiwi6ZJLgxaycptp5K04hiVtnCbL0lqMqS zZd71SB7EoabTGn+3wrHUF58HXyHNiK2xuGMeyumFzRx/G53zsVPE1hTA u7FMn6yWGz3jU/UjvjKFV1HG72XYXE8oJcwTnHvEmB8zI3/ly/gfrgK3F w==; X-CSE-ConnectionGUID: YlwgThUKT/mEqPevjj9maQ== X-CSE-MsgGUID: VcM3En+QS26F2mUlGA2Vaw== X-IronPort-AV: E=McAfee;i="6600,9927,11041"; a="19045587" X-IronPort-AV: E=Sophos;i="6.07,194,1708416000"; d="scan'208";a="19045587" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2024 20:13:36 -0700 X-CSE-ConnectionGUID: 823GskEeTVqbAS2EhG9qAg== X-CSE-MsgGUID: Atl1SvoQQcmPWe/uzRNAIw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,194,1708416000"; d="scan'208";a="25904959" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 11 Apr 2024 20:13:37 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 11 Apr 2024 20:13:35 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 11 Apr 2024 20:13:35 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 11 Apr 2024 20:13:35 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 11 Apr 2024 20:13:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bmZRttC45oa/vYU3BK67Pn1YLZ965X9D3RIw4onqgSzOp/Std4AWYEnHlH2WhhFegry7ie1ANI7x5obsrMBW5WSo8WBLPbNleexuhdcq9WLnMvJQNO7dM2ghdxYM44QqP7GOJWVQXF275KjAhRJpojImNK2EaMR32WzawEm4BX+XifZqc9aSBFRRMkZ2X7PmOT/hRXGaMp+7EEwhu36h6AKnerv2zlJuVjpqlaX+UYx35C5jKTDOMh2DhsUbyTE9vrCiu1okWAyTxUsONvLt9twF2z3IREQBRXtLoCPCn+O2NCajIeXXImqBogae894KbPNYswJJzZIKiOX/bxvwcg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kD8XV25M7r4oXG8xpkx0mn2wuATlml1A7hmr97a3R2I=; b=CnIGVKHJocCW+OQoXI4hmW1PZBxD+ZvE38IonElt0XQ4YRtQLayKXPmbTzhSZReCW7HlKcfyoqMQ4WDDb+YMNpycerHwsUppRgXQEGSlyJ6iu/8QRrpP4Kjp2/SZ0n+5+OY9pju6y3JT9FysB0W6Ws3mmkfQLCeYQ668bRlCDxepgyjhtublvjeggjCQ4PhRED8FHhIkb4ExCB9BtZVvYjojRud9LGBSWf5ov4ZWv2TAjS4vcmvfaKCyKwrPYWWy8qK/842FEfuZfLM9eiHYm8BUzUMbC+WoFGQ05nK8hYFJ/RyI5ne3FFm0OOcLnC0Mo4MEsivj9s4AL9Bjz64cjg== 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 Received: from BN9PR11MB5276.namprd11.prod.outlook.com (2603:10b6:408:135::18) by SA2PR11MB5163.namprd11.prod.outlook.com (2603:10b6:806:113::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.26; Fri, 12 Apr 2024 03:13:33 +0000 Received: from BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::6c9f:86e:4b8e:8234]) by BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::6c9f:86e:4b8e:8234%6]) with mapi id 15.20.7452.019; Fri, 12 Apr 2024 03:13:33 +0000 From: "Tian, Kevin" To: Jacob Pan CC: Baolu Lu , "iommu@lists.linux.dev" , "Liu, Yi L" , Joerg Roedel , Will Deacon , Robin Murphy , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 2/2] iommu/vt-d: Remove caching mode check before devtlb flush Thread-Topic: [PATCH 2/2] iommu/vt-d: Remove caching mode check before devtlb flush Thread-Index: AQHaiPoC7RpD2axGS0qZEPwCpJ1HeLFe3nWAgABnDgCAAPAgAIAAdL7wgAEJg4CAAHVPwIABHHCAgAC2WnA= Date: Fri, 12 Apr 2024 03:13:33 +0000 Message-ID: References: <20240407144232.190355-1-baolu.lu@linux.intel.com> <20240407144232.190355-2-baolu.lu@linux.intel.com> <20240408140329.6290377f@jacob-builder> <20240409103146.0d155e45@jacob-builder> <20240410091955.5c00e411@jacob-builder> <20240411091749.20afae6b@jacob-builder> In-Reply-To: <20240411091749.20afae6b@jacob-builder> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5276:EE_|SA2PR11MB5163:EE_ x-ms-office365-filtering-correlation-id: 2820d640-800a-4c54-3d10-08dc5a9e8979 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EiBrddSM2rpiofExDXP91pMuftHwu5tKaKOk84QgRrRD2DBPvzuueBEak31CVF8ds5iCVVGZj0XFV6j3nUHauYhWy5Rt+u0J1mI49kTFOuvmiHVBhjJloRPkpGAeTf1LqsEHKmscyrL4AXi23lwNGI49tDolnLkq398pqJ1hpDDx6/0FkbmlrOIW/8PHKZwYioQ7Oe9/hRppTyxI3++DChsY9HwPmJd7sjbhjdrxKY9qdduVNIJg1EGQTcLc10L/8qg9xj4zpLXN8TBLpTF70iPJRtxwK/KOXser86VOLhy7vo4sz+n0PbcY1HCy1VgnKv3WqiLZ9RnkLjnhdIw38m3CjwWbadDjy/4hG7o/+f5cfgwC8yZ+o7JKB5mycQ9KrPuwE8RLjZs+CczNSvX5UhRmkkMrlAUqEyFVvestLmEoYqfF8Fkp8nW5AS0rqCOZII7QZMA3Q4Zn3S55YWQC5ubCb3fdAZOJVS9eUnFRr+o3CR3intqASaDOH6YC9TCuNJg/aSfmSYAn7OJLqv9mPmxAvFe2ltP3D94dxjUrVXfkqEQcLBI+2pvOignWtxa+EbYnqRrl4zGV0MIxHIbcF8p3IZoDcZSwu+iI5+KSojfBYxB4Q3+63d9kprq7Ks+X9v8Ven9G5dTGZEvbcsU2t9HlW2jYLhTIyLD+1o+4EyZGPvfGfpYGO9r42pnaSfzNP7XJ5l8roCHqY7kxJNZV6QbRkz6ZlaPpSh423i3QxIU= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5276.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(366007)(1800799015)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RI8y1iYZ5ebyn8ukQRbqa+lWTExenkoVtaCarkV9svGtGmS9ntw2Iu5vTiUe?= =?us-ascii?Q?uWIsA1AYgjhwxyxBllkDM3Ftj3vBXBOTqXPGzDhWYAvCeQt1TCBCOK8GdMKo?= =?us-ascii?Q?BjHSAev08K+vX5OfREUKbMYMnyvfNMYqZjgnrI7LEiOO26KGL3R/KidyQka1?= =?us-ascii?Q?Vhu3aE1ICN3OzGt4qfNDXerOeaqd0dSeIQjx55AWx6QjgeUXkPzSyKRdMhM5?= =?us-ascii?Q?gHwyQxI1zLAAHdVDUrHfksDVKbvJ2L4GkNXPNmBvVeusBUdb8RH8iisMrZA4?= =?us-ascii?Q?yjQCZ46a4xGlrLIDI+6AwNO5YpRsM7bfrAKNvKpeulk4huJ2ZBpDkv7Z/QsG?= =?us-ascii?Q?g2GE6l/PNJ8vynKr11RkP2zfFq78YxDH2LEijFJL4RVC8AiS7svS46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oSowXTOhFfK/nP4822QiMHx+tmcfy1?= =?us-ascii?Q?L4u/pAzcgNp0Av2YEWN/fRLhs7M8eLSJFSCTp+76uMEemXShFq+pDOagQ4Ej?= =?us-ascii?Q?qSQ7nzPJfY5w9wmzJOmzrfUGHZBVn/rrDoZUC28D2zZnTpO5/OE/+dBpiDSI?= =?us-ascii?Q?dInofMrQvuUax463kLmrWqwkf6ff9vraSl45EQPPF1k/6Jd5fuWwXwXTeDaI?= =?us-ascii?Q?hnhT1VN42eXKhLdSQbjQMazb1u/pKhg70US141nC4rOePSXq5hwa2hCz2G/L?= =?us-ascii?Q?xuoQsKoMpI3yqtaMSG2nLONlqqzhaDH3lggp8KyE?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5276.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2820d640-800a-4c54-3d10-08dc5a9e8979 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2024 03:13:33.7196 (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: cFzg1lOBNd6F9ReqVigGCXAVLRaLIelTQNOaZPnMC9rmuPSBcqT9FWfqjbd3z/p1Y45yoidCnHtim8JtAUqktA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5163 X-OriginatorOrg: intel.com > From: Jacob Pan > Sent: Friday, April 12, 2024 12:18 AM >=20 > Hi Kevin, >=20 > On Wed, 10 Apr 2024 23:23:57 +0000, "Tian, Kevin" > wrote: >=20 > > > From: Jacob Pan > > > Sent: Thursday, April 11, 2024 12:20 AM > > > > > > Hi Kevin, > > > > > > On Wed, 10 Apr 2024 00:32:06 +0000, "Tian, Kevin" > > > > wrote: > > > > > > > > From: Jacob Pan > > > > > Sent: Wednesday, April 10, 2024 1:32 AM > > > > > > > > > > If the guest uses SL page tables in vIOMMU, we don;t expose ATS t= o > > > > > the guest. So ATS is not relevant here, does't matter map or unma= p. > > > > > > > > > > > > > ATS is orthogonal to SL vs. FL. Where is this restriction coming > > > > from? > > > For practical purposes, what would be the usage to have SL in the gue= st > > > and ATS enabled. i.e. shadowing SL but directly expose ATS? > > > > > > > ATS is about the protocol between device and iommu to look up > > translations. Why does it care about internal paging layout in > > iommu? > > > Maybe the original intent was missed, I was suggesting the devTLB flush > should be based on ATS cap (as you said here) not map/unmap. >=20 > - /* > - * In caching mode, changes of pages from non-present to present > require > - * flush. However, device IOTLB doesn't need to be flushed in thi= s case. > - */ > - if (!cap_caching_mode(iommu->cap) || !map) > - iommu_flush_dev_iotlb(domain, addr, mask); > + iommu_flush_dev_iotlb(domain, addr, mask); >=20 We need check both, as devtlb doesn't cache non-present=20 so the invalidation is required only for unmap. Here just the check of caching mode is irrelevant.