diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index ebc9b8d..713e206 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c @@ -2994,9 +2994,10 @@ static void __init iommu_exit_mempool(void) } -static void __init init_no_remapping_devices(void) +static int __init init_no_remapping_devices(void) { struct dmar_drhd_unit *drhd; + int drhd_total = 0,drhd_ignored = 0; for_each_drhd_unit(drhd) { if (!drhd->include_all) { @@ -3008,32 +3009,34 @@ static void __init init_no_remapping_devices(void) if (i == drhd->devices_cnt) drhd->ignored = 1; } + drhd_total++; } - - if (dmar_map_gfx) - return; - for_each_drhd_unit(drhd) { int i; - if (drhd->ignored || drhd->include_all) + if (drhd->ignored) + drhd_ignored++; + if (drhd->ignored || drhd->include_all) { + continue; + } + if (dmar_map_gfx) continue; - for (i = 0; i < drhd->devices_cnt; i++) if (drhd->devices[i] && !IS_GFX_DEVICE(drhd->devices[i])) break; - if (i < drhd->devices_cnt) continue; /* bypass IOMMU if it is just for gfx devices */ drhd->ignored = 1; + drhd_ignored++; for (i = 0; i < drhd->devices_cnt; i++) { if (!drhd->devices[i]) continue; drhd->devices[i]->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO; } } + return (drhd_total == drhd_ignored); } #ifdef CONFIG_SUSPEND @@ -3200,7 +3203,12 @@ int __init intel_iommu_init(void) iommu_init_mempool(); dmar_init_reserved_ranges(); - init_no_remapping_devices(); + if(init_no_remapping_devices()) { + printk(KERN_ERR "IOMMU: all dmar HW unit ignored\n"); + put_iova_domain(&reserved_iova_list); + iommu_exit_mempool(); + return ret; + } ret = init_dmars(); if (ret) {