Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH rc] iommu/amd: Fix premature break in init_iommu_one() again
@ 2026-08-24  6:29 Vasant Hegde
  2026-09-07 12:50 ` Jörg Rödel
  0 siblings, 1 reply; 2+ messages in thread
From: Vasant Hegde @ 2026-08-24  6:29 UTC (permalink / raw)
  To: iommu, joro
  Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde,
	Andreas Juch

Commit 283d245468a2 ("iommu/amd: Fix premature break in
init_iommu_one()") unintentionally broke older platforms - such as
the ASRockRack B550D4-4L - where the BIOS advertises incorrect IOMMU
features.

Move the HATDis check ahead of the GASup check, and re-introduce the
break inside the GASup check to restore correct behavior on affected
platforms.

This is a short-term fix to resolve the regression. Longer term, we
should rework how EFRs are tracked and prioritize the MMIO-advertised
EFR over the one reported via IVRS. That requires more extensive
changes and will be addressed separately.

Fixes: 283d245468a2 ("iommu/amd: Fix premature break in init_iommu_one()")
Reported-by: Andreas Juch <andreas@juch.cc>
Closes: https://lore.kernel.org/linux-iommu/07b2d390-f7a0-47e2-bc2c-eb0853acf52e@juch.cc/
Tested-by: Andreas Juch <andreas@juch.cc>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
---
 drivers/iommu/amd/init.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index e7d7b4cb9337..c67dfd39a5ef 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -1914,19 +1914,20 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h,
 		else
 			iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET;
 
+		if (h->efr_attr & BIT(IOMMU_IVHD_ATTR_HATDIS_SHIFT)) {
+			pr_warn_once("Host Address Translation is not supported.\n");
+			amd_iommu_hatdis = true;
+		}
+
 		/* XT and GAM require GA mode. */
 		if ((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0) {
 			amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY;
+			break;
 		} else {
 			if (h->efr_reg & BIT(IOMMU_EFR_XTSUP_SHIFT))
 				amd_iommu_xt_mode = IRQ_REMAP_X2APIC_MODE;
 		}
 
-		if (h->efr_attr & BIT(IOMMU_IVHD_ATTR_HATDIS_SHIFT)) {
-			pr_warn_once("Host Address Translation is not supported.\n");
-			amd_iommu_hatdis = true;
-		}
-
 		early_iommu_features_init(iommu, h);
 
 		break;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH rc] iommu/amd: Fix premature break in init_iommu_one() again
  2026-08-24  6:29 [PATCH rc] iommu/amd: Fix premature break in init_iommu_one() again Vasant Hegde
@ 2026-09-07 12:50 ` Jörg Rödel
  0 siblings, 0 replies; 2+ messages in thread
From: Jörg Rödel @ 2026-09-07 12:50 UTC (permalink / raw)
  To: Vasant Hegde
  Cc: iommu, will, robin.murphy, suravee.suthikulpanit, Andreas Juch

On Mon, Aug 24, 2026 at 06:29:07AM +0000, Vasant Hegde wrote:
> Commit 283d245468a2 ("iommu/amd: Fix premature break in
> init_iommu_one()") unintentionally broke older platforms - such as
> the ASRockRack B550D4-4L - where the BIOS advertises incorrect IOMMU
> features.
> 
> Move the HATDis check ahead of the GASup check, and re-introduce the
> break inside the GASup check to restore correct behavior on affected
> platforms.
> 
> This is a short-term fix to resolve the regression. Longer term, we
> should rework how EFRs are tracked and prioritize the MMIO-advertised
> EFR over the one reported via IVRS. That requires more extensive
> changes and will be addressed separately.
> 
> Fixes: 283d245468a2 ("iommu/amd: Fix premature break in init_iommu_one()")
> Reported-by: Andreas Juch <andreas@juch.cc>
> Closes: https://lore.kernel.org/linux-iommu/07b2d390-f7a0-47e2-bc2c-eb0853acf52e@juch.cc/
> Tested-by: Andreas Juch <andreas@juch.cc>
> Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
> ---
>  drivers/iommu/amd/init.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Queued for -rc, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-07 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24  6:29 [PATCH rc] iommu/amd: Fix premature break in init_iommu_one() again Vasant Hegde
2026-09-07 12:50 ` Jörg Rödel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox