diff options
Diffstat (limited to 'drivers/iommu/amd_iommu_init.c')
-rw-r--r-- | drivers/iommu/amd_iommu_init.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 28b4bea7c109..b76c58dbe30c 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -150,7 +150,7 @@ int amd_iommus_present; | |||
150 | bool amd_iommu_np_cache __read_mostly; | 150 | bool amd_iommu_np_cache __read_mostly; |
151 | bool amd_iommu_iotlb_sup __read_mostly = true; | 151 | bool amd_iommu_iotlb_sup __read_mostly = true; |
152 | 152 | ||
153 | u32 amd_iommu_max_pasids __read_mostly = ~0; | 153 | u32 amd_iommu_max_pasid __read_mostly = ~0; |
154 | 154 | ||
155 | bool amd_iommu_v2_present __read_mostly; | 155 | bool amd_iommu_v2_present __read_mostly; |
156 | bool amd_iommu_pc_present __read_mostly; | 156 | bool amd_iommu_pc_present __read_mostly; |
@@ -1231,14 +1231,16 @@ static int iommu_init_pci(struct amd_iommu *iommu) | |||
1231 | 1231 | ||
1232 | if (iommu_feature(iommu, FEATURE_GT)) { | 1232 | if (iommu_feature(iommu, FEATURE_GT)) { |
1233 | int glxval; | 1233 | int glxval; |
1234 | u32 pasids; | 1234 | u32 max_pasid; |
1235 | u64 shift; | 1235 | u64 pasmax; |
1236 | 1236 | ||
1237 | shift = iommu->features & FEATURE_PASID_MASK; | 1237 | pasmax = iommu->features & FEATURE_PASID_MASK; |
1238 | shift >>= FEATURE_PASID_SHIFT; | 1238 | pasmax >>= FEATURE_PASID_SHIFT; |
1239 | pasids = (1 << shift); | 1239 | max_pasid = (1 << (pasmax + 1)) - 1; |
1240 | 1240 | ||
1241 | amd_iommu_max_pasids = min(amd_iommu_max_pasids, pasids); | 1241 | amd_iommu_max_pasid = min(amd_iommu_max_pasid, max_pasid); |
1242 | |||
1243 | BUG_ON(amd_iommu_max_pasid & ~PASID_MASK); | ||
1242 | 1244 | ||
1243 | glxval = iommu->features & FEATURE_GLXVAL_MASK; | 1245 | glxval = iommu->features & FEATURE_GLXVAL_MASK; |
1244 | glxval >>= FEATURE_GLXVAL_SHIFT; | 1246 | glxval >>= FEATURE_GLXVAL_SHIFT; |