diff options
-rw-r--r-- | drivers/iommu/intel-iommu.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 72d68c59670..5565753d460 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -404,6 +404,9 @@ static int dmar_forcedac; | |||
404 | static int intel_iommu_strict; | 404 | static int intel_iommu_strict; |
405 | static int intel_iommu_superpage = 1; | 405 | static int intel_iommu_superpage = 1; |
406 | 406 | ||
407 | int intel_iommu_gfx_mapped; | ||
408 | EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped); | ||
409 | |||
407 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) | 410 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) |
408 | static DEFINE_SPINLOCK(device_domain_lock); | 411 | static DEFINE_SPINLOCK(device_domain_lock); |
409 | static LIST_HEAD(device_domain_list); | 412 | static LIST_HEAD(device_domain_list); |
@@ -3226,9 +3229,6 @@ static void __init init_no_remapping_devices(void) | |||
3226 | } | 3229 | } |
3227 | } | 3230 | } |
3228 | 3231 | ||
3229 | if (dmar_map_gfx) | ||
3230 | return; | ||
3231 | |||
3232 | for_each_drhd_unit(drhd) { | 3232 | for_each_drhd_unit(drhd) { |
3233 | int i; | 3233 | int i; |
3234 | if (drhd->ignored || drhd->include_all) | 3234 | if (drhd->ignored || drhd->include_all) |
@@ -3236,18 +3236,23 @@ static void __init init_no_remapping_devices(void) | |||
3236 | 3236 | ||
3237 | for (i = 0; i < drhd->devices_cnt; i++) | 3237 | for (i = 0; i < drhd->devices_cnt; i++) |
3238 | if (drhd->devices[i] && | 3238 | if (drhd->devices[i] && |
3239 | !IS_GFX_DEVICE(drhd->devices[i])) | 3239 | !IS_GFX_DEVICE(drhd->devices[i])) |
3240 | break; | 3240 | break; |
3241 | 3241 | ||
3242 | if (i < drhd->devices_cnt) | 3242 | if (i < drhd->devices_cnt) |
3243 | continue; | 3243 | continue; |
3244 | 3244 | ||
3245 | /* bypass IOMMU if it is just for gfx devices */ | 3245 | /* This IOMMU has *only* gfx devices. Either bypass it or |
3246 | drhd->ignored = 1; | 3246 | set the gfx_mapped flag, as appropriate */ |
3247 | for (i = 0; i < drhd->devices_cnt; i++) { | 3247 | if (dmar_map_gfx) { |
3248 | if (!drhd->devices[i]) | 3248 | intel_iommu_gfx_mapped = 1; |
3249 | continue; | 3249 | } else { |
3250 | drhd->devices[i]->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO; | 3250 | drhd->ignored = 1; |
3251 | for (i = 0; i < drhd->devices_cnt; i++) { | ||
3252 | if (!drhd->devices[i]) | ||
3253 | continue; | ||
3254 | drhd->devices[i]->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO; | ||
3255 | } | ||
3251 | } | 3256 | } |
3252 | } | 3257 | } |
3253 | } | 3258 | } |