Re: [PATCH v6 01/10] iommu/vt-d: Enlightened PASID allocation

From: Lu Baolu
Date: Thu Oct 24 2019 - 21:45:20 EST


Hi,

On 10/24/19 5:11 AM, Jacob Pan wrote:
On Wed, 23 Oct 2019 10:55:23 -0700
Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx> wrote:

Do you have to check this everytime? every dmar_readq is going to
trap to the other side ...

Yes. We don't need to check it every time. Check once and save the
result during boot is enough.

How about below incremental change?
Below is good but I was thinking to include vccap in struct
intel_iommu{} where cap and ecaps reside. i.e.
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 14b87ae2916a..e2cf25c9c956 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -528,6 +528,7 @@ struct intel_iommu {
u64 reg_size; /* size of hw register set */
u64 cap;
u64 ecap;
+ u64 vccap;

Also, we can use a static branch here.

On a second thought, we cannot use static(branch) here in that we
cannot assume there is only one vIOMMU all the time. Have to cache the
vccap per iommu.

intel_iommu is a per iommu structure, right? Or I missed anything?


diff --git a/drivers/iommu/intel-pasid.c
b/drivers/iommu/intel-pasid.c index ff7e877b7a4d..c15d9d7e1e73
100644 --- a/drivers/iommu/intel-pasid.c
+++ b/drivers/iommu/intel-pasid.c
@@ -29,22 +29,29 @@ u32 intel_pasid_max_id = PASID_MAX;

[Jacob Pan]


Best regards,
baolu