]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.183/iommu-vt-d-set-intel_iommu_gfx_mapped-correctly.patch
Linux 4.9.183
[thirdparty/kernel/stable-queue.git] / releases / 4.9.183 / iommu-vt-d-set-intel_iommu_gfx_mapped-correctly.patch
CommitLineData
bb104d9e
SL
1From 1e77f44c4825fc69ed0782e3e1351fa723354399 Mon Sep 17 00:00:00 2001
2From: Lu Baolu <baolu.lu@linux.intel.com>
3Date: Thu, 2 May 2019 09:34:25 +0800
4Subject: iommu/vt-d: Set intel_iommu_gfx_mapped correctly
5
6[ Upstream commit cf1ec4539a50bdfe688caad4615ca47646884316 ]
7
8The intel_iommu_gfx_mapped flag is exported by the Intel
9IOMMU driver to indicate whether an IOMMU is used for the
10graphic device. In a virtualized IOMMU environment (e.g.
11QEMU), an include-all IOMMU is used for graphic device.
12This flag is found to be clear even the IOMMU is used.
13
14Cc: Ashok Raj <ashok.raj@intel.com>
15Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
16Cc: Kevin Tian <kevin.tian@intel.com>
17Reported-by: Zhenyu Wang <zhenyuw@linux.intel.com>
18Fixes: c0771df8d5297 ("intel-iommu: Export a flag indicating that the IOMMU is used for iGFX.")
19Suggested-by: Kevin Tian <kevin.tian@intel.com>
20Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
21Signed-off-by: Joerg Roedel <jroedel@suse.de>
22Signed-off-by: Sasha Levin <sashal@kernel.org>
23---
24 drivers/iommu/intel-iommu.c | 7 ++++---
25 1 file changed, 4 insertions(+), 3 deletions(-)
26
27diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
28index 28feb1744710..25cc6ae87039 100644
29--- a/drivers/iommu/intel-iommu.c
30+++ b/drivers/iommu/intel-iommu.c
31@@ -4119,9 +4119,7 @@ static void __init init_no_remapping_devices(void)
32
33 /* This IOMMU has *only* gfx devices. Either bypass it or
34 set the gfx_mapped flag, as appropriate */
35- if (dmar_map_gfx) {
36- intel_iommu_gfx_mapped = 1;
37- } else {
38+ if (!dmar_map_gfx) {
39 drhd->ignored = 1;
40 for_each_active_dev_scope(drhd->devices,
41 drhd->devices_cnt, i, dev)
42@@ -4870,6 +4868,9 @@ int __init intel_iommu_init(void)
43 goto out_free_reserved_range;
44 }
45
46+ if (dmar_map_gfx)
47+ intel_iommu_gfx_mapped = 1;
48+
49 init_no_remapping_devices();
50
51 ret = init_dmars();
52--
532.20.1
54