summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu_init.c
diff options
context:
space:
mode:
authorJoerg Roedel2011-11-10 14:41:57 +0100
committerJoerg Roedel2011-12-12 14:54:30 +0100
commit62f71abbc64d686064a4caa10a3249c26776995e (patch)
treedd902320a0048af1a46212698f342552b77d943f /drivers/iommu/amd_iommu_init.c
parentiommu/amd: Convert dev_table_entry to u64 (diff)
downloadkernel-qcow2-linux-62f71abbc64d686064a4caa10a3249c26776995e.tar.gz
kernel-qcow2-linux-62f71abbc64d686064a4caa10a3249c26776995e.tar.xz
kernel-qcow2-linux-62f71abbc64d686064a4caa10a3249c26776995e.zip
iommu/amd: Get the maximum number of PASIDs supported
Read the number of PASIDs supported by each IOMMU in the system and take the smallest number as the maximum value supported by the IOMMU driver. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/amd_iommu_init.c')
-rw-r--r--drivers/iommu/amd_iommu_init.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 17e0f77c7dad..fb4afd6d357d 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -141,6 +141,8 @@ int amd_iommus_present;
bool amd_iommu_np_cache __read_mostly;
bool amd_iommu_iotlb_sup __read_mostly = true;
+u32 amd_iommu_max_pasids __read_mostly = ~0;
+
/*
* The ACPI table parsing functions set this variable on an error
*/
@@ -699,6 +701,17 @@ static void __init init_iommu_from_pci(struct amd_iommu *iommu)
iommu->features = ((u64)high << 32) | low;
+ if (iommu_feature(iommu, FEATURE_GT)) {
+ u32 pasids;
+ u64 shift;
+
+ shift = iommu->features & FEATURE_PASID_MASK;
+ shift >>= FEATURE_PASID_SHIFT;
+ pasids = (1 << shift);
+
+ amd_iommu_max_pasids = min(amd_iommu_max_pasids, pasids);
+ }
+
if (!is_rd890_iommu(iommu->dev))
return;