aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu_init.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2011-11-10 08:41:57 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2011-12-12 08:54:30 -0500
commit62f71abbc64d686064a4caa10a3249c26776995e (patch)
treedd902320a0048af1a46212698f342552b77d943f /drivers/iommu/amd_iommu_init.c
parentee6c28684585a64fd79c5a56e849af58ebdc5948 (diff)
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 17e0f77c7da..fb4afd6d357 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -141,6 +141,8 @@ int amd_iommus_present;
141bool amd_iommu_np_cache __read_mostly; 141bool amd_iommu_np_cache __read_mostly;
142bool amd_iommu_iotlb_sup __read_mostly = true; 142bool amd_iommu_iotlb_sup __read_mostly = true;
143 143
144u32 amd_iommu_max_pasids __read_mostly = ~0;
145
144/* 146/*
145 * The ACPI table parsing functions set this variable on an error 147 * The ACPI table parsing functions set this variable on an error
146 */ 148 */
@@ -699,6 +701,17 @@ static void __init init_iommu_from_pci(struct amd_iommu *iommu)
699 701
700 iommu->features = ((u64)high << 32) | low; 702 iommu->features = ((u64)high << 32) | low;
701 703
704 if (iommu_feature(iommu, FEATURE_GT)) {
705 u32 pasids;
706 u64 shift;
707
708 shift = iommu->features & FEATURE_PASID_MASK;
709 shift >>= FEATURE_PASID_SHIFT;
710 pasids = (1 << shift);
711
712 amd_iommu_max_pasids = min(amd_iommu_max_pasids, pasids);
713 }
714
702 if (!is_rd890_iommu(iommu->dev)) 715 if (!is_rd890_iommu(iommu->dev))
703 return; 716 return;
704 717