iommu/amd: Enable GT mode when supported by IOMMU
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 25 Nov 2011 10:41:31 +0000 (11:41 +0100)
committerJoerg Roedel <joerg.roedel@amd.com>
Mon, 12 Dec 2011 13:54:44 +0000 (14:54 +0100)
This feature needs to be enabled before IOMMUv2 DTEs can be
set up.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/amd_iommu_init.c
drivers/iommu/amd_iommu_types.h

index 60716cefa7af9e66dfe15ff2132abb1daa115dd4..2c25ae306e7c6df132b5aa19b2fb130803f1b32e 100644 (file)
@@ -623,6 +623,14 @@ static void __init free_ppr_log(struct amd_iommu *iommu)
        free_pages((unsigned long)iommu->ppr_log, get_order(PPR_LOG_SIZE));
 }
 
+static void iommu_enable_gt(struct amd_iommu *iommu)
+{
+       if (!iommu_feature(iommu, FEATURE_GT))
+               return;
+
+       iommu_feature_enable(iommu, CONTROL_GT_EN);
+}
+
 /* sets a specific bit in the device table entry. */
 static void set_dev_entry_bit(u16 devid, u8 bit)
 {
@@ -1338,6 +1346,7 @@ static void enable_iommus(void)
                iommu_enable_command_buffer(iommu);
                iommu_enable_event_buffer(iommu);
                iommu_enable_ppr_log(iommu);
+               iommu_enable_gt(iommu);
                iommu_set_exclusion_range(iommu);
                iommu_init_msi(iommu);
                iommu_enable(iommu);
index 4dc230904fe993eab256a50539551b4c8eced016..a6e1dc616afedefea50016c0bd0128effdc621b3 100644 (file)
 #define CONTROL_PPFLOG_EN       0x0dULL
 #define CONTROL_PPFINT_EN       0x0eULL
 #define CONTROL_PPR_EN          0x0fULL
+#define CONTROL_GT_EN           0x10ULL
 
 /* command specific defines */
 #define CMD_COMPL_WAIT          0x01