[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276502F9B5AB45EE9BF28628CDC2@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 2 Jul 2024 01:11:32 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>, Joerg Roedel <joro@...tes.org>, "Will
Deacon" <will@...nel.org>, Robin Murphy <robin.murphy@....com>, "Jason
Gunthorpe" <jgg@...pe.ca>
CC: "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v3 1/2] iommu/vt-d: Add helper to flush caches for context
change
> From: Lu Baolu <baolu.lu@...ux.intel.com>
> Sent: Monday, July 1, 2024 7:23 PM
> +
> + /*
> + * For scalable mode:
> + * - Domain-selective PASID-cache invalidation to affected domains
> + * - Domain-selective IOTLB invalidation to affected domains
> + * - Global Device-TLB invalidation to affected functions
> + */
> + if (flush_domains) {
> + /*
> + * If the IOMMU is running in scalable mode and there might
> + * be potential PASID translations, the caller should hold
> + * the lock to ensure that context changes and cache flushes
> + * are atomic.
> + */
> + assert_spin_locked(&iommu->lock);
> + for (i = 0; i < info->pasid_table->max_pasid; i++) {
> + pte = intel_pasid_get_entry(info->dev, i);
> + if (!pte || !pasid_pte_is_present(pte))
> + continue;
> +
> + did = pasid_get_domain_id(pte);
> + qi_flush_pasid_cache(iommu, did,
> QI_PC_ALL_PASIDS, 0);
> + iommu->flush.flush_iotlb(iommu, did, 0, 0,
> DMA_TLB_DSI_FLUSH);
> + }
> + }
> +
> + __context_flush_dev_iotlb(info);
> +}
this only invalidates devtlb w/o PASID. We miss a pasid devtlb invalidation
with global bit set.
otherwise this looks good:
Reviewed-by: Kevin Tian <kevin.tian@...el.com>
Powered by blists - more mailing lists