linux/drivers/iommu/intel
Mingcong Bai 2c8a7c66c9 iommu/vt-d: Apply quirk_iommu_igfx for 8086:0044 (QM57/QS57)
On the Lenovo ThinkPad X201, when Intel VT-d is enabled in the BIOS, the
kernel boots with errors related to DMAR, the graphical interface appeared
quite choppy, and the system resets erratically within a minute after it
booted:

DMAR: DRHD: handling fault status reg 3
DMAR: [DMA Write NO_PASID] Request device [00:02.0] fault addr 0xb97ff000
[fault reason 0x05] PTE Write access is not set

Upon comparing boot logs with VT-d on/off, I found that the Intel Calpella
quirk (`quirk_calpella_no_shadow_gtt()') correctly applied the igfx IOMMU
disable/quirk correctly:

pci 0000:00:00.0: DMAR: BIOS has allocated no shadow GTT; disabling IOMMU
for graphics

Whereas with VT-d on, it went into the "else" branch, which then
triggered the DMAR handling fault above:

... else if (!disable_igfx_iommu) {
	/* we have to ensure the gfx device is idle before we flush */
	pci_info(dev, "Disabling batched IOTLB flush on Ironlake\n");
	iommu_set_dma_strict();
}

Now, this is not exactly scientific, but moving 0x0044 to quirk_iommu_igfx
seems to have fixed the aforementioned issue. Running a few `git blame'
runs on the function, I have found that the quirk was originally
introduced as a fix specific to ThinkPad X201:

commit 9eecabcb9a ("intel-iommu: Abort IOMMU setup for igfx if BIOS gave
no shadow GTT space")

Which was later revised twice to the "else" branch we saw above:

- 2011: commit 6fbcfb3e46 ("intel-iommu: Workaround IOTLB hang on
  Ironlake GPU")
- 2024: commit ba00196ca4 ("iommu/vt-d: Decouple igfx_off from graphic
  identity mapping")

I'm uncertain whether further testings on this particular laptops were
done in 2011 and (honestly I'm not sure) 2024, but I would be happy to do
some distro-specific testing if that's what would be required to verify
this patch.

P.S., I also see IDs 0x0040, 0x0062, and 0x006a listed under the same
`quirk_calpella_no_shadow_gtt()' quirk, but I'm not sure how similar these
chipsets are (if they share the same issue with VT-d or even, indeed, if
this issue is specific to a bug in the Lenovo BIOS). With regards to
0x0062, it seems to be a Centrino wireless card, but not a chipset?

I have also listed a couple (distro and kernel) bug reports below as
references (some of them are from 7-8 years ago!), as they seem to be
similar issue found on different Westmere/Ironlake, Haswell, and Broadwell
hardware setups.

Cc: stable@vger.kernel.org
Fixes: 6fbcfb3e46 ("intel-iommu: Workaround IOTLB hang on Ironlake GPU")
Fixes: ba00196ca4 ("iommu/vt-d: Decouple igfx_off from graphic identity mapping")
Link: https://groups.google.com/g/qubes-users/c/4NP4goUds2c?pli=1
Link: https://bugs.archlinux.org/task/65362
Link: https://bbs.archlinux.org/viewtopic.php?id=230323
Reported-by: Wenhao Sun <weiguangtwk@outlook.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=197029
Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Link: https://lore.kernel.org/r/20250415133330.12528-1-jeffbai@aosc.io
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2025-04-28 13:00:58 +02:00
..
Kconfig iommu/vt-d: Move IOMMU_IOPF into INTEL_IOMMU 2024-11-05 13:32:26 +01:00
Makefile iommu/vt-d: Remove iommu cap audit 2025-01-07 09:30:51 +01:00
cache.c iommu/vt-d: Link cache tags of same iommu unit together 2025-01-07 09:30:53 +01:00
debugfs.c iommu/vt-d: Remove debugfs use of private data field 2024-04-26 11:57:38 +02:00
dmar.c iommu/vt-d: Fix suspicious RCU usage 2025-02-28 12:19:01 +01:00
iommu.c iommu/vt-d: Apply quirk_iommu_igfx for 8086:0044 (QM57/QS57) 2025-04-28 13:00:58 +02:00
iommu.h iommu/vt-d: Cleanup intel_context_flush_present() 2025-03-10 09:31:05 +01:00
irq_remapping.c iommu/vt-d: Wire up irq_ack() to irq_move_irq() for posted MSIs 2025-04-11 09:06:06 +02:00
nested.c iommu/vt-d: Add IOMMU_HWPT_ALLOC_PASID support 2025-03-25 10:18:31 -03:00
pasid.c iommu/vt-d: Cleanup intel_context_flush_present() 2025-03-10 09:31:05 +01:00
pasid.h iommu/vt-d: Draining PRQ in sva unbind path when FPD bit set 2025-01-07 09:30:52 +01:00
perf.c iommu/vt-d: Use kcalloc() instead of kzalloc() 2024-03-01 13:51:18 +01:00
perf.h iommu/vt-d: Remove debugfs use of private data field 2024-04-26 11:57:38 +02:00
perfmon.c iommu/vt-d: Clean up cpumask and hotplug for perfmon 2024-09-10 11:44:13 +02:00
perfmon.h iommu/vt-d: Add IOMMU perfmon support 2023-02-03 11:06:06 +01:00
prq.c iommu/vt-d: Move PRI enablement in probe path 2025-03-10 09:31:04 +01:00
svm.c iommu/vt-d: Check if SVA is supported when attaching the SVA domain 2025-03-10 09:31:03 +01:00
trace.c iommu/vt-d: Move trace/events/intel_iommu.h under iommu 2022-07-15 10:21:28 +02:00
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00