aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu_init.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2011-11-28 09:11:02 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2011-12-12 08:54:52 -0500
commit400a28a05f2cc1a311acb4ff6ac64d8402d21678 (patch)
tree4dca7cd2b8610ca0bb5ea7a7df4a0af995aa733b /drivers/iommu/amd_iommu_init.c
parentcbc33a9085995e21f52a66380d108d64916b6787 (diff)
iommu/amd: Add iommuv2 flag to struct amd_iommu
In mixed IOMMU setups this flag inidicates whether an IOMMU supports the v2 features or not. This patch also adds a global flag together with a function to query that flag from other code. The flag shows if at least one IOMMUv2 is in the system. 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.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 2c25ae306e7c..d1e5067852d4 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27#include <linux/amd-iommu.h> 27#include <linux/amd-iommu.h>
28#include <linux/export.h>
28#include <asm/pci-direct.h> 29#include <asm/pci-direct.h>
29#include <asm/iommu.h> 30#include <asm/iommu.h>
30#include <asm/gart.h> 31#include <asm/gart.h>
@@ -143,6 +144,8 @@ bool amd_iommu_iotlb_sup __read_mostly = true;
143 144
144u32 amd_iommu_max_pasids __read_mostly = ~0; 145u32 amd_iommu_max_pasids __read_mostly = ~0;
145 146
147bool amd_iommu_v2_present __read_mostly;
148
146/* 149/*
147 * The ACPI table parsing functions set this variable on an error 150 * The ACPI table parsing functions set this variable on an error
148 */ 151 */
@@ -760,6 +763,12 @@ static void __init init_iommu_from_pci(struct amd_iommu *iommu)
760 amd_iommu_max_pasids = min(amd_iommu_max_pasids, pasids); 763 amd_iommu_max_pasids = min(amd_iommu_max_pasids, pasids);
761 } 764 }
762 765
766 if (iommu_feature(iommu, FEATURE_GT) &&
767 iommu_feature(iommu, FEATURE_PPR)) {
768 iommu->is_iommu_v2 = true;
769 amd_iommu_v2_present = true;
770 }
771
763 if (!is_rd890_iommu(iommu->dev)) 772 if (!is_rd890_iommu(iommu->dev))
764 return; 773 return;
765 774
@@ -1645,3 +1654,9 @@ IOMMU_INIT_FINISH(amd_iommu_detect,
1645 gart_iommu_hole_init, 1654 gart_iommu_hole_init,
1646 0, 1655 0,
1647 0); 1656 0);
1657
1658bool amd_iommu_v2_supported(void)
1659{
1660 return amd_iommu_v2_present;
1661}
1662EXPORT_SYMBOL(amd_iommu_v2_supported);