All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: 70sp <70sp@protonmail.com>, Laurence Oberman <loberman@redhat.com>
Cc: Lu Baolu <baolu.lu@linux.intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Joerg Roedel <joro@8bytes.org>,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	Tobias Laas <tobias.laas@posteo.de>,
	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>,
	Will Deacon <will@kernel.org>, Niklas Cassel <cassel@kernel.org>
Subject: Re: [REGRESSION] DMAR fault by Intel H97 SATA controller since "block: Increase BLK_DEF_MAX_SECTORS_CAP" (6.17-rc1)
Date: Fri, 27 Nov 2026 07:56:14 -0800	[thread overview]
Message-ID: <0318408a-20b8-4237-85b2-e522883f5436@acm.org> (raw)
In-Reply-To: <l7ImnFzOgVkMzGhZoxCBcI1dAbMnO2NlsstuK-4sh3CyOpWhWAC1RqFIr4CW82iTy3FZe2r1k4EFFtecv5PClmy_mvh10vI9W_W5Z5p-jlo=@protonmail.com>

On 11/27/26 5:57 AM, 70sp wrote:
> I have taken a look at the patches and the entire problem much more
> in depth, and there probably isn't a significantly better variant to
> do this.
> 
> In the state before the regression, the kernel was assigning smaller
> page sizes for some cases, so it wasn't ideal as I thought. I also
> haven't found a better place for the quirk to belong as there are
> already exemptions for specific platforms in the code (I thought
> there weren't). This one is probably fine.
> 
> I am sorry to Bart and Laurence who had to handle this. I thought my
> patch was bad, so I thought the same about Barts, but it looks like
> it's the correct way to approach it.
> 
> I was told to repost my patch formally by Lu Baolu ( https://
> lore.kernel.org/regressions/d931a389-c143-4a6a-931c-
> bc7025bcefb9@linux.intel.com/ ), probably because it fixes at least
> my case.
> 
> I think we should wait for confirmation from Tobias and if it's
> positive, we can send out the final patch closing both cases.
My LLM came up with the (entirely untested) patch below after I asked
it to generalize an earlier patch:

Subject: [PATCH] iommu/vt-d: Disable superpages when legacy IGD engine 
lacks them

Disable Intel VT-d superpages on bare-metal systems when the Intel
integrated graphics device (0000:00:02.0) is behind a dedicated legacy
(non-scalable-mode) VT-d engine that reports CAP.SLLPS == 0 while an
active remapping unit advertises superpage support.

Per Intel Core processor datasheets (e.g. document 328897, section 3.1.2
for 4th Generation Core / Haswell), the integrated graphics VT-d engine
does not support super-pages and BIOS must disable super-pages in the
default VT-d engine while integrated graphics is enabled. Several 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.

Check the hardware capability directly instead of matching hardcoded CPU
model IDs. During intel_iommu_init(), look up the Intel integrated
graphics device at 0000:00:02.0, find its matched non-INCLUDE_ALL DRHD
unit, and clear intel_iommu_superpage before allocating any paging
domains if that unit is a legacy engine (ECAP.SMTS == 0) without
superpage support (CAP.SLLPS == 0) while an active IOMMU advertises
CAP.SLLPS. Skip virtualized guests, untrusted PCI devices, systems
without integrated graphics, and newer generations whose IGD VT-d engine
supports superpages or scalable mode.

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 | 48 +++++++++++++++++++++++++++++++++++++
  1 file changed, 48 insertions(+)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 5a2e705a2f2e..d2c03bec22e9 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -43,6 +43,7 @@

  #define DEFAULT_DOMAIN_ADDRESS_WIDTH 57

+static void __init check_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 +2763,7 @@ int __init intel_iommu_init(void)
  		pr_info("No SATC found\n");

  	init_no_remapping_devices();
+	check_igfx_superpage();

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

+/*
+ * Per Intel Core processor datasheets (e.g. document 328897, section 
3.1.2),
+ * when the integrated graphics VT-d engine does not support super-pages
+ * (CAP.SLLPS == 0), BIOS must disable super-pages in the default VT-d 
engine
+ * while integrated graphics is enabled. Some 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_igfx_superpage(void)
+{
+	struct dmar_drhd_unit *drhd, *igfx_drhd;
+	struct intel_iommu *iommu;
+	struct pci_dev *pdev;
+
+	if (!intel_iommu_superpage ||
+	    cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
+		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;
+	}
+
+	igfx_drhd = dmar_find_matched_drhd_unit(pdev);
+	pci_dev_put(pdev);
+	if (!igfx_drhd || !igfx_drhd->iommu || igfx_drhd->include_all)
+		return;
+
+	if (ecap_smts(igfx_drhd->iommu->ecap) ||
+	    cap_super_page_val(igfx_drhd->iommu->cap))
+		return;
+
+	for_each_active_iommu(iommu, drhd) {
+		if (cap_super_page_val(iommu->cap)) {
+			intel_iommu_superpage = 0;
+			pr_info("Disabling superpages because integrated graphics VT-d 
engine lacks superpage support\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-27 15:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 18:51 [REGRESSION] DMAR fault by Intel H97 SATA controller since "block: Increase BLK_DEF_MAX_SECTORS_CAP" (6.17-rc1) 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-12-01  6:28         ` Baolu Lu
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
2026-11-25 19:26         ` Laurence Oberman
2026-11-25 22:51           ` 70sp
2026-11-25 23:27             ` Bart Van Assche
2026-11-26 13:31               ` Laurence Oberman
2026-11-26 13:52                 ` 70sp
2026-11-27 13:57                   ` 70sp
2026-11-27 15:56                     ` Bart Van Assche [this message]
2026-11-28 20:35                     ` Tobias Laas
2026-11-29 16:56                       ` 70sp
2026-12-01  9:04               ` Baolu Lu

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=0318408a-20b8-4237-85b2-e522883f5436@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=jgg@ziepe.ca \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.