public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Fix loop timeout issue in iommu_ga_log_enable()
@ 2022-01-31 16:17 Joerg Roedel
  2022-01-31 17:06 ` John Garry
  2022-02-01  7:01 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Joerg Roedel @ 2022-01-31 16:17 UTC (permalink / raw)
  To: iommu
  Cc: Joerg Roedel, Suravee Suthikulpanit, Will Deacon, linux-kernel,
	Maxim Levitsky, Joerg Roedel

From: Joerg Roedel <jroedel@suse.de>

The polling loop for the register change in iommu_ga_log_enable() needs
to have a udelay() in it.  Otherwise the CPU might be faster than the
IOMMU hardware and wrongly trigger the WARN_ON() further down the code
stream.

Fixes: 8bda0cfbdc1a ("iommu/amd: Detect and initialize guest vAPIC log")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/amd/init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index dc338acf3338..d2e09d53851f 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -834,6 +834,7 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu)
 		status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);
 		if (status & (MMIO_STATUS_GALOG_RUN_MASK))
 			break;
+		udelay(1);
 	}
 
 	if (WARN_ON(i >= LOOP_TIMEOUT))
-- 
2.34.1


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

end of thread, other threads:[~2022-02-04 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-31 16:17 [PATCH] iommu/amd: Fix loop timeout issue in iommu_ga_log_enable() Joerg Roedel
2022-01-31 17:06 ` John Garry
2022-02-04 11:34   ` Joerg Roedel
2022-02-01  7:01 ` kernel test robot

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