aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorJoseph Cihula <joseph.cihula@intel.com>2011-05-03 03:08:37 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2011-05-24 08:07:56 -0400
commitb779260b097dec295e8798277ed08ec5ecd3b2c1 (patch)
tree5aa7bc90c3b399e8d11c80f20f7a4d85fe901edc /drivers/pci
parent61c4f2c81c61f73549928dfd9f3e8f26aa36a8cf (diff)
intel-iommu: fix VT-d PMR disable for TXT on S3 resume
This patch is a follow on to https://lkml.org/lkml/2011/3/21/239, which was merged as commit 51a63e67da6056c13b5b597dcc9e1b3bd7ceaa55. This patch adds support for S3, as pointed out by Chris Wright. Signed-off-by: Joseph Cihula <joseph.cihula@intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/intel-iommu.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index d552d2c77844..4e4e0202e59d 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -142,6 +142,12 @@ static void __init check_tylersburg_isoch(void);
142static int rwbf_quirk; 142static int rwbf_quirk;
143 143
144/* 144/*
145 * set to 1 to panic kernel if can't successfully enable VT-d
146 * (used when kernel is launched w/ TXT)
147 */
148static int force_on = 0;
149
150/*
145 * 0: Present 151 * 0: Present
146 * 1-11: Reserved 152 * 1-11: Reserved
147 * 12-63: Context Ptr (12 - (haw-1)) 153 * 12-63: Context Ptr (12 - (haw-1))
@@ -2217,7 +2223,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
2217 return 0; 2223 return 0;
2218} 2224}
2219 2225
2220static int __init init_dmars(int force_on) 2226static int __init init_dmars(void)
2221{ 2227{
2222 struct dmar_drhd_unit *drhd; 2228 struct dmar_drhd_unit *drhd;
2223 struct dmar_rmrr_unit *rmrr; 2229 struct dmar_rmrr_unit *rmrr;
@@ -3117,7 +3123,17 @@ static int init_iommu_hw(void)
3117 if (iommu->qi) 3123 if (iommu->qi)
3118 dmar_reenable_qi(iommu); 3124 dmar_reenable_qi(iommu);
3119 3125
3120 for_each_active_iommu(iommu, drhd) { 3126 for_each_iommu(iommu, drhd) {
3127 if (drhd->ignored) {
3128 /*
3129 * we always have to disable PMRs or DMA may fail on
3130 * this device
3131 */
3132 if (force_on)
3133 iommu_disable_protect_mem_regions(iommu);
3134 continue;
3135 }
3136
3121 iommu_flush_write_buffer(iommu); 3137 iommu_flush_write_buffer(iommu);
3122 3138
3123 iommu_set_root_entry(iommu); 3139 iommu_set_root_entry(iommu);
@@ -3126,7 +3142,8 @@ static int init_iommu_hw(void)
3126 DMA_CCMD_GLOBAL_INVL); 3142 DMA_CCMD_GLOBAL_INVL);
3127 iommu->flush.flush_iotlb(iommu, 0, 0, 0, 3143 iommu->flush.flush_iotlb(iommu, 0, 0, 0,
3128 DMA_TLB_GLOBAL_FLUSH); 3144 DMA_TLB_GLOBAL_FLUSH);
3129 iommu_enable_translation(iommu); 3145 if (iommu_enable_translation(iommu))
3146 return 1;
3130 iommu_disable_protect_mem_regions(iommu); 3147 iommu_disable_protect_mem_regions(iommu);
3131 } 3148 }
3132 3149
@@ -3193,7 +3210,10 @@ static void iommu_resume(void)
3193 unsigned long flag; 3210 unsigned long flag;
3194 3211
3195 if (init_iommu_hw()) { 3212 if (init_iommu_hw()) {
3196 WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); 3213 if (force_on)
3214 panic("tboot: IOMMU setup failed, DMAR can not resume!\n");
3215 else
3216 WARN(1, "IOMMU setup failed, DMAR can not resume!\n");
3197 return; 3217 return;
3198 } 3218 }
3199 3219
@@ -3270,7 +3290,6 @@ static struct notifier_block device_nb = {
3270int __init intel_iommu_init(void) 3290int __init intel_iommu_init(void)
3271{ 3291{
3272 int ret = 0; 3292 int ret = 0;
3273 int force_on = 0;
3274 3293
3275 /* VT-d is required for a TXT/tboot launch, so enforce that */ 3294 /* VT-d is required for a TXT/tboot launch, so enforce that */
3276 force_on = tboot_force_iommu(); 3295 force_on = tboot_force_iommu();
@@ -3308,7 +3327,7 @@ int __init intel_iommu_init(void)
3308 3327
3309 init_no_remapping_devices(); 3328 init_no_remapping_devices();
3310 3329
3311 ret = init_dmars(force_on); 3330 ret = init_dmars();
3312 if (ret) { 3331 if (ret) {
3313 if (force_on) 3332 if (force_on)
3314 panic("tboot: Failed to initialize DMARs\n"); 3333 panic("tboot: Failed to initialize DMARs\n");