All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Fix premature break in init_iommu_one()
@ 2026-05-17 12:29 Vasant Hegde
  2026-05-28  7:29 ` Jörg Rödel
  0 siblings, 1 reply; 2+ messages in thread
From: Vasant Hegde @ 2026-05-17 12:29 UTC (permalink / raw)
  To: iommu, joro
  Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde,
	Sudheer Dantuluri, Dheeraj Kumar Srivastava

In init_iommu_one(), when processing IOMMU EFR attributes, the code checks
whether GASUP is enabled. If GASUP is not enabled, the code falls back to
legacy guest IR mode and then breaks out of the switch statement.

This break incorrectly skips the subsequent initialization steps that
follow the GASUP check. These initializations are independent of GASUP
support and must always be performed.

Fix this by replacing the early break with a conditional else block,
ensuring that the XTSUP check is only skipped when GASUP is not available.

Fixes: a44092e326d4 ("iommu/amd: Use IVHD EFR for early initialization of IOMMU features")
Reported-by: Sudheer Dantuluri <dantuluris@google.com>
Tested-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
---
 drivers/iommu/amd/init.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 3bdb380d23e9..9a846dcd0306 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -1939,12 +1939,11 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h,
 		/* 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_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;
-- 
2.31.1


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

* Re: [PATCH] iommu/amd: Fix premature break in init_iommu_one()
  2026-05-17 12:29 [PATCH] iommu/amd: Fix premature break in init_iommu_one() Vasant Hegde
@ 2026-05-28  7:29 ` Jörg Rödel
  0 siblings, 0 replies; 2+ messages in thread
From: Jörg Rödel @ 2026-05-28  7:29 UTC (permalink / raw)
  To: Vasant Hegde
  Cc: iommu, will, robin.murphy, suravee.suthikulpanit,
	Sudheer Dantuluri, Dheeraj Kumar Srivastava

On Sun, May 17, 2026 at 12:29:25PM +0000, Vasant Hegde wrote:
>  drivers/iommu/amd/init.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Applied, thanks.

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

end of thread, other threads:[~2026-05-28  7:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-17 12:29 [PATCH] iommu/amd: Fix premature break in init_iommu_one() Vasant Hegde
2026-05-28  7:29 ` Jörg Rödel

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.