mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Thorsten Leemhuis <regressions@leemhuis.info>,
	Tobias Laas <tobias.laas@posteo.de>
Cc: Damien Le Moal <dlemoal@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	regressions@lists.linux.dev, linux-block@vger.kernel.org,
	linux-ide@vger.kernel.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	David Woodhouse <dwmw2@infradead.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Niklas Cassel <cassel@kernel.org>, 70sp <70sp@protonmail.com>,
	Laurence Oberman <loberman@redhat.com>
Subject: Re: [REGRESSION] DMAR fault by Intel H97 SATA controller since "block: Increase BLK_DEF_MAX_SECTORS_CAP" (6.17-rc1)
Date: Wed, 25 Nov 2026 10:29:49 -0800	[thread overview]
Message-ID: <a0ff3156-add0-4f7d-8373-09f95bd7036b@acm.org> (raw)
In-Reply-To: <87b1bbd8-8113-4890-8623-738b19a9cc7b@leemhuis.info>

On 11/25/26 12:52 AM, Thorsten Leemhuis wrote:
> For completeness, Šimon Pospíchal (now CCed) shared findings and a WIP
> fix (both with the help of a LLM) meanwhile here:
> 
> https://lore.kernel.org/all/QISmXFlpPMgvFUKmdIBDwqn4JHHXt2NZeJzerMLHF_5icLo0lPKVlN0Ig9v8Vb52NmCeSFdyrao4x8KoN1DCXtDlnZS7eRIClC6vZyu-hPU%3D@protonmail.com/

Thanks Thorsten for having shared that link. The LLM I'm using doesn't
like that patch and came up with the patch shown below. Untested.

Bart.


Subject: [PATCH] iommu/vt-d: Disable superpages on Haswell with 
integrated graphics

Disable Intel VT-d superpages on bare-metal Haswell client systems when
integrated graphics (0000:00:02.0) is enabled and an active remapping
unit advertises superpage support (CAP.SLLPS).

Per the 4th Generation Intel Core Processor Family datasheets (document
328897, section 3.1.2), the integrated graphics VT-d engine does not
support super-pages and BIOS must disable super-pages in the default
VT-d engine when integrated graphics is enabled. Several Haswell BIOSes
leave CAP.SLLPS set on the default engine (dmar1). Whenever Linux installs
a 2 MiB or 1 GiB leaf entry (PS=1) on dmar1, hardware aborts DMA with
fault reason 0x0c ("non-zero reserved fields in PTE"), breaking VFIO
passthrough, discrete GPUs, audio, and AHCI storage (exposed by default
once BLK_DEF_MAX_SECTORS_CAP increased to 4 MiB in v6.17).

Prior to commit c376a3456d8b ("iommu/vt-d: Remove
domain_update_iommu_cap()"), domain_update_iommu_superpage() intersected
superpage support across all active IOMMUs, so the IGD unit (SLLPS=0)
masked off superpages on dmar1. After that commit, dmar1 domains started
honoring dmar1's advertised CAP.SLLPS.

Detect bare-metal Haswell client CPUs (INTEL_HASWELL, INTEL_HASWELL_L,
INTEL_HASWELL_G), verify that the Intel integrated graphics device at
0000:00:02.0 is present and not on an untrusted PCI link, and clear
intel_iommu_superpage during intel_iommu_init() before allocating any
paging domains if an active IOMMU advertises CAP.SLLPS.

Fixes: c376a3456d8b ("iommu/vt-d: Remove domain_update_iommu_cap()")
Reported-by: Tobias Laas <tobias.laas@posteo.de>
Closes: 
https://lore.kernel.org/linux-block/5ad27a97aafbc08a8702d5b90d09cd59@posteo.de/
Reported-by: Šimon Pospíchal <70sp@protonmail.com>
Closes: 
https://lore.kernel.org/r/HYhMd0Klo0XE_yiVY7XmsgyKKFDwKHfKRy22KrycLcYd0V_ykA4xdbBMJXkA07YX3os6qK-NhMIVi6ITo-CkNIIF0e-GcI0UwwZmdDhAJ0I=@protonmail.com
Cc: stable@vger.kernel.org
---
  drivers/iommu/intel/iommu.c | 53 +++++++++++++++++++++++++++++++++++++
  1 file changed, 53 insertions(+)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 5a2e705a2f2e..dd37aa25e287 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -24,6 +24,8 @@
  #include <linux/tboot.h>
  #include <uapi/linux/iommufd.h>

+#include <asm/cpu_device_id.h>
+
  #include "iommu.h"
  #include "../dma-iommu.h"
  #include "../irq_remapping.h"
@@ -43,6 +45,7 @@

  #define DEFAULT_DOMAIN_ADDRESS_WIDTH 57

+static void __init check_haswell_igfx_superpage(void);
  static void __init check_tylersburg_isoch(void);
  static int intel_iommu_set_dirty_tracking(struct iommu_domain *domain,
  					  bool enable);
@@ -2762,6 +2765,7 @@ int __init intel_iommu_init(void)
  		pr_info("No SATC found\n");

  	init_no_remapping_devices();
+	check_haswell_igfx_superpage();

  	ret = init_dmars();
  	if (ret) {
@@ -4266,6 +4270,55 @@ static void __init check_tylersburg_isoch(void)
  	       vtisochctrl);
  }

+static const struct x86_cpu_id haswell_cpu_ids[] __initconst = {
+	X86_MATCH_VFM(INTEL_HASWELL, NULL),
+	X86_MATCH_VFM(INTEL_HASWELL_L, NULL),
+	X86_MATCH_VFM(INTEL_HASWELL_G, NULL),
+	{}
+};
+
+/*
+ * Per the 4th Generation Intel Core Processor Family datasheets (e.g.
+ * document 328897, section 3.1.2), the integrated graphics VT-d engine
+ * does not support super-pages and BIOS must disable super-pages in the
+ * default VT-d engine when integrated graphics is enabled. Some Haswell
+ * BIOSes leave CAP.SLLPS set on the default engine, causing fault reason
+ * 0x0c (non-zero reserved fields in PTE) when a 2 MiB or 1 GiB superpage
+ * mapping is used.
+ */
+static void __init check_haswell_igfx_superpage(void)
+{
+	struct dmar_drhd_unit *drhd;
+	struct intel_iommu *iommu;
+	struct pci_dev *pdev;
+
+	if (!intel_iommu_superpage)
+		return;
+
+	if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR) ||
+	    !x86_match_cpu(haswell_cpu_ids))
+		return;
+
+	pdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(2, 0));
+	if (!pdev)
+		return;
+
+	if (pdev->vendor != PCI_VENDOR_ID_INTEL || !IS_GFX_DEVICE(pdev) ||
+	    risky_device(pdev)) {
+		pci_dev_put(pdev);
+		return;
+	}
+	pci_dev_put(pdev);
+
+	for_each_active_iommu(iommu, drhd) {
+		if (cap_super_page_val(iommu->cap)) {
+			intel_iommu_superpage = 0;
+			pr_info("Disabling superpages on Haswell with integrated graphics\n");
+			break;
+		}
+	}
+}
+
  /*
   * Here we deal with a device TLB defect where device may 
inadvertently issue ATS
   * invalidation completion before posted writes initiated with 
translated address


      reply	other threads:[~2026-11-25 18:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 18:51 Tobias Laas
2026-11-23 21:15 ` Niklas Cassel
2026-11-23 21:49   ` Laurence Oberman
2026-11-25  8:29     ` Tobias Laas
2026-11-25 12:45       ` Laurence Oberman
2026-11-24  7:20   ` Tobias Laas
2026-11-24  8:55   ` Thorsten Leemhuis
2026-11-25  8:52     ` Thorsten Leemhuis
2026-11-25 18:29       ` Bart Van Assche [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a0ff3156-add0-4f7d-8373-09f95bd7036b@acm.org \
    --to=bvanassche@acm.org \
    --cc=70sp@protonmail.com \
    --cc=axboe@kernel.dk \
    --cc=baolu.lu@linux.intel.com \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=tobias.laas@posteo.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®