From: Lu Baolu Date: Thu, 2 May 2019 01:34:25 +0000 (+0800) Subject: iommu/vt-d: Set intel_iommu_gfx_mapped correctly X-Git-Tag: v3.16.74~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60a934906822afb4573249fa1ac353a9483c73fb;p=thirdparty%2Fkernel%2Fstable.git iommu/vt-d: Set intel_iommu_gfx_mapped correctly commit cf1ec4539a50bdfe688caad4615ca47646884316 upstream. The intel_iommu_gfx_mapped flag is exported by the Intel IOMMU driver to indicate whether an IOMMU is used for the graphic device. In a virtualized IOMMU environment (e.g. QEMU), an include-all IOMMU is used for graphic device. This flag is found to be clear even the IOMMU is used. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Reported-by: Zhenyu Wang Fixes: c0771df8d5297 ("intel-iommu: Export a flag indicating that the IOMMU is used for iGFX.") Suggested-by: Kevin Tian Signed-off-by: Lu Baolu Signed-off-by: Joerg Roedel Signed-off-by: Ben Hutchings --- diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c2a44d2ca5b68..f2e7408eb91fd 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -3578,9 +3578,7 @@ static void __init init_no_remapping_devices(void) /* This IOMMU has *only* gfx devices. Either bypass it or set the gfx_mapped flag, as appropriate */ - if (dmar_map_gfx) { - intel_iommu_gfx_mapped = 1; - } else { + if (!dmar_map_gfx) { drhd->ignored = 1; for_each_active_dev_scope(drhd->devices, drhd->devices_cnt, i, dev) @@ -4074,6 +4072,9 @@ int __init intel_iommu_init(void) goto out_free_reserved_range; } + if (dmar_map_gfx) + intel_iommu_gfx_mapped = 1; + init_no_remapping_devices(); ret = init_dmars();