Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3793485rdb; Wed, 27 Dec 2023 23:12:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFT+iJquzPKI7Oh7peQVr63raYKa4XoafrgQZIdHJkXN8mTqNlqyOLsakflxPvm0pP93Hkq X-Received: by 2002:a05:6214:519c:b0:67a:a721:d77c with SMTP id kl28-20020a056214519c00b0067aa721d77cmr16189992qvb.98.1703747526306; Wed, 27 Dec 2023 23:12:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703747526; cv=pass; d=google.com; s=arc-20160816; b=g0bQRmdrg7xZFXZ33VSbRwxkzITVzG109l5tIL625wQ4HjSNFLr5LqiBEb3QtQIJ5u fs1iPXswhzYGcqMbr9qyQ+luG8ElNOKYEn357X2RvAgrz/DiXMZRusGhCOSkm5bLiuN3 S1WX7KAkPDMYFP0s/kP/jhtkcobivtGKcx3/75NQpnhu3duczIXG47OneUqvlvP6llJp 00G0G8bjdj17cTGHAsUVqOn7//1NZBh5ojXdyGU4EI2HHRvDxJNC8HhTaXw4g/CSaQIH jose7rXjJb+KgJjrH8pOK1+4wok93pFeMeshisMkHISF2t9lrGCimgqRkfvPzWSv2orl AYNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from:dkim-signature; bh=igKevMPpcS2T22pDUjwb02Ui+YXaY0KPHA9WEged8U4=; fh=gqz022jL4d9g2TLosZS0RGrGfTvk/uei2T0TdjEzKNc=; b=lkBEG9Cs6q7wezO8tODABop5D/ywvwv1io/xkujmSIJzh6Y5Uhd/WrzjlH1UZYbrTt jREw66vJfxD5cIO8URJxiTMI//zb02FxTJpSCeLbl+yV9F2BhTPvVYN2j0uvBU6hJ3Lu Xbnz/ZASZXuopeOT7chLByFXu39luqC7BAxhcJoeB3Vph9kpiKhLk/8jj3uzQSB76rE6 BFFQB8YEsYSDPl2zGcpdFphkOrmFigtlZNHMGVLuOFBvGLl22ehqlNr1kAPZbHpXNN4g U3AvgPS+VIo7uPKpl56fGXQfnpzkUSWUCNCFQyXXWGV9b3zVTXHQYriVXTKlf3LzlQDi y9RQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b2iJj721; 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+bounces-12476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t10-20020a0cf98a000000b0067f81bb73bbsi15603047qvn.569.2023.12.27.23.12.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 23:12:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b2iJj721; 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+bounces-12476-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12476-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 078861C21090 for ; Thu, 28 Dec 2023 07:12:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CBB24426; Thu, 28 Dec 2023 07:11:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="b2iJj721" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 F222B3C0B; Thu, 28 Dec 2023 07:11:53 +0000 (UTC) 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=1703747514; x=1735283514; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=jvcHykd/L2dtKgTrTncTPL5acPllF9LIOhfyrmQkBQo=; b=b2iJj7218cuBFrNUK6IVuzXhsK/1lTuPe2j/M8kUIk4Ad9rhUysBL05G GIjVALnVtVglYCKjgozjqjV0OhyNbNFGhmeg7lvEZ2F+JAU9r1+10dMuK 5/rTLH/+nlr+ex0F0YV3FhxmCh6FWpGSqko1zE/dHPlgiN3geXZUMTK4D PnJrxTDeLpveuXRATd8H7lIl/M+byv/JiW1WgVN9pWQ8fyFzy20WHIT5n QJn537HkeWiNpc2fr+PqP4p0GVaLBP3TeBcklubOJFgo2oi4+cYv/N7q6 NBi1Cm9KfanBpebr08T/1XJVa+VLT66P3Rr7hSVvt9OaJN82H5eZGPaTo Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10936"; a="18077431" X-IronPort-AV: E=Sophos;i="6.04,311,1695711600"; d="scan'208";a="18077431" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2023 23:11:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10936"; a="778439526" X-IronPort-AV: E=Sophos;i="6.04,311,1695711600"; d="scan'208";a="778439526" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 27 Dec 2023 23:11:52 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 27 Dec 2023 23:11:51 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 27 Dec 2023 23:11:51 -0800 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.168) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 27 Dec 2023 23:11:51 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gs3d3hIo3wQ0Qx9h2JehShnULG7vidCvmZGkcCwwpXgTbkTReo4GCN0rQG9BOwTNCSpswEcM7Ch06jvFs39cXhi+UQDiFGCHs7N9Uzfbqyuid72PnAblo/YGTwirYs7iLYbaIpgYhz5iUoNf9AWGwg8bcF7NNkEhlSouU2Kdosi3iBzZlLSl3E1gFEwybAmm8V4txXb5Zfxd6PLeAUWWbFNYbObgptDYbz4p4fhR+xj/12pfh+zjiUrdu7V+ZWWpjT9BvKhahi+qkKt7etB5znkr0zlK4uMdac/rMAA4lLxZLiBnhJaIuzuRk3qmR530PBNXpjHA3O1/XuKiccmWrw== 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=igKevMPpcS2T22pDUjwb02Ui+YXaY0KPHA9WEged8U4=; b=HJEiLmz5ATzKRnb95nAwPCJakLabi7e0B0BRXGTAb6M/qMEJNCq9ye1dFw5H4BQzZc1oXT1cT2jUMifShWrN1gYRicHY7qoQs3WzaV6YP/czKGyqJ4JvKRnLJUxiu4rQsWQcPWqLJrpGKSVhf3vF2UCvuzz3Z4QSq6RVsDxSL3Y8AGUz7VDXpwUr3G0O8wrhUUEEsQlUS2fd3/z64MHc35Gm4YhO6Eum1WMYNBS8CfmRA5GHIzP1bvaDXZgmz4WtKDwLNkF3Lb7hQ6atf1xwfTGakd07XnkZYUoUqJ8NGAM51KSrYH/Oox92cEcNX4OBBvtYnG/2w4Iy5A656EAODA== 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 DM4PR11MB8202.namprd11.prod.outlook.com (2603:10b6:8:18b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Thu, 28 Dec 2023 07:11:49 +0000 Received: from BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::a8e9:c80f:9484:f7cb]) by BN9PR11MB5276.namprd11.prod.outlook.com ([fe80::a8e9:c80f:9484:f7cb%3]) with mapi id 15.20.7113.028; Thu, 28 Dec 2023 07:11:49 +0000 From: "Tian, Kevin" To: "Liu, Yi L" , "joro@8bytes.org" , "alex.williamson@redhat.com" , "jgg@nvidia.com" , "robin.murphy@arm.com" , "baolu.lu@linux.intel.com" CC: "cohuck@redhat.com" , "eric.auger@redhat.com" , "nicolinc@nvidia.com" , "kvm@vger.kernel.org" , "mjrosato@linux.ibm.com" , "chao.p.peng@linux.intel.com" , "yi.y.sun@linux.intel.com" , "peterx@redhat.com" , "jasowang@redhat.com" , "shameerali.kolothum.thodi@huawei.com" , "lulu@redhat.com" , "suravee.suthikulpanit@amd.com" , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "Duan, Zhenzhong" , "joao.m.martins@oracle.com" , "Zeng, Xin" , "Zhao, Yan Y" , "j.granados@samsung.com" Subject: RE: [PATCH v8 10/10] iommu/vt-d: Add iotlb flush for nested domain Thread-Topic: [PATCH v8 10/10] iommu/vt-d: Add iotlb flush for nested domain Thread-Index: AQHaON+9l+zA44VLDUyKcHm82dBOTbC+R0mg Date: Thu, 28 Dec 2023 07:11:48 +0000 Message-ID: References: <20231227161354.67701-1-yi.l.liu@intel.com> <20231227161354.67701-11-yi.l.liu@intel.com> In-Reply-To: <20231227161354.67701-11-yi.l.liu@intel.com> 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_|DM4PR11MB8202:EE_ x-ms-office365-filtering-correlation-id: d44abe7a-6c19-462b-6d19-08dc0774424c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MJyvPI6u4OdyWp6x3AG96mlWHpwkbrQIz5I+KVUlXhctBNONniKJnN2PwWYVz0ZVsoKK29/bVhACSL+rudH0CLrs80bfxaKtMDnNlK7bqDkxn1yk04QZcQLKMIhQmzn7SB8xXMEqyw93FJkbFSX7c3Ij9/Qq+QPADdEdVvv9MA4CF3ugIZWe9Xba6980fzqC6NpeqACXOPm2fi7Y6aZYoCTokQKhVUw+kb+ruRRok9NZ1z2vP4tzBKSGyX9JRlnQMtZ4n0ZO8acOfKw8NOPBi29KdM7BNm6T7JB12JNqPHjephhyilseGhpwVk7mRtfqidmDk3AUkUYW5IAPc7oaFmvc2mC4uKiLJNFRNvNVdLhaqsBnjQ+QiFgs8wuFK1mpPH761SZsdRnhHmE8TZJ0UioB6u2OQbVYZWzvv9mrzISXNZST9dp+LOukrIJjwdt8kvtbm8pyLSVsok096jaJzBZym17rB1EKmIK9GdzM/1RT1cuI+LvNXaAGpycm88uz3kH9WH+3MzMIPZf0Rn9FXylhbiFn+kXb/eSR1rSOKFFfpVJfjHP7sD53xI9GT9dsiZoWDJBjrkWUvEZedUoKg2rN0oNvgruL+kUSvAssXduGyN437gALtcg93H1q2rS/ 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)(39860400002)(376002)(366004)(346002)(396003)(136003)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(6506007)(7696005)(26005)(71200400001)(52536014)(4326008)(83380400001)(478600001)(9686003)(5660300002)(8676002)(7416002)(54906003)(76116006)(110136005)(316002)(41300700001)(8936002)(66476007)(66946007)(64756008)(66446008)(2906002)(66556008)(86362001)(33656002)(82960400001)(38100700002)(122000001)(38070700009)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zENgsyEkZfiQtdg3T003FPv/eFjewiEbpznKLemm6iq42Huha9yjQ1/jYv9F?= =?us-ascii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tucryqm6jCPcc0ac?= =?us-ascii?Q?3YO4L5jIHnwDUl4Es0pI7saKDuFJ83iboI/6AlUB7TlMLHnFIWS5UlZsxny7?= =?us-ascii?Q?e9lDkzvJsSYwLZ5F7ndFYU8mVFhdKtNbw/dXayvnQy1FTiSJ0xAYKk+Nmzzc?= =?us-ascii?Q?coZAV6aLezggljtzFkJOkWsSn5C38aTWX1FH025DLPNx9nVSdXoqmmeOxhBW?= =?us-ascii?Q?1VH/aZUJzFocy+LedtwQ+J7W5aqXdFRS+ydp7IZULW331Y2yCEKBpdVgII7H?= =?us-ascii?Q?7cFvPVoe7Yged7lZaehxnZPmPHlod6sVPZ+jbjzEyiyTHep+CNzBq5cJfP1y?= =?us-ascii?Q?MWRFzl0UeufIv2vw/0KfpmYnH9SXYOZ9FvjTdAKh9Ek1f6DpSstpG6y/t653?= =?us-ascii?Q?boiTF6iPa0ElBlijLacOBvYSdC3GV+2gQGH2CfqOdWkf+3ZS3LpdQ1iNq15w?= =?us-ascii?Q?L2s9dA+8P4o1156+2smbQk6GiU5mGGu8RIZjDk+k/HEbpAcwhS1M8cA0Wwp6?= =?us-ascii?Q?jR7hpp04Q+4yQCs9gyhUR6jh5U9VajDa8rkDizHkLEZzjoKwoSqIMRkfwxke?= =?us-ascii?Q?BVvPY3CwZRVaoqxzpxf6hl//PFbHkWA/7ETp4h1ZGBy2cWb90G/7G6C5wtB1?= =?us-ascii?Q?AJzeVUS3ssRS30f52HQKykk13LbGn3kLit5latSG?= 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: d44abe7a-6c19-462b-6d19-08dc0774424c X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Dec 2023 07:11:48.9261 (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: vkyInhm93D39BdIpHnDX4Weehi9hkM08Blu01EweNQSTHHQMG3P8DzdWnis5ALv2qEuWAS5dHM7QWACU2O4qBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB8202 X-OriginatorOrg: intel.com > From: Liu, Yi L > Sent: Thursday, December 28, 2023 12:14 AM >=20 >=20 > +static void nested_flush_pasid_iotlb(struct intel_iommu *iommu, > + struct dmar_domain *domain, u64 addr, > + unsigned long npages, bool ih) > +{ > + u16 did =3D domain_id_iommu(domain, iommu); > + unsigned long flags; > + > + spin_lock_irqsave(&domain->lock, flags); > + if (!list_empty(&domain->devices)) > + qi_flush_piotlb(iommu, did, IOMMU_NO_PASID, addr, > + npages, ih, NULL); Not sure the check of domain->devices makes sense here. The outer loop is xa_for_each(&domain->iommu_array, i, info) which, if found, then implies certain devices behind this iommu must be attached to this domain. I wonder whether it's clearer to remove this function and just call qi_flush_piotlb() from intel_nested_flush_cache(). > + > + /* > + * Invalidation queue error (i.e. IQE) will not be reported to user > + * as it's caused only by driver internal bug. > + */ here lack of: *error =3D 0; > + if (fault & DMA_FSTS_ICE) > + *error |=3D IOMMU_HWPT_INVALIDATE_VTD_S1_ICE; > + if (fault & DMA_FSTS_ITE) > + *error |=3D IOMMU_HWPT_INVALIDATE_VTD_S1_ITE; > +} > +