Skip to content

Commit

Permalink
iommu/amd: Fix loop timeout issue in iommu_ga_log_enable()
Browse files Browse the repository at this point in the history
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: 8bda0cf ("iommu/amd: Detect and initialize guest vAPIC log")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
joergroedel authored and intel-lab-lkp committed Jan 31, 2022
1 parent 66dc1b7 commit 5b57855
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/iommu/amd/init.c
Expand Up @@ -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))
Expand Down

0 comments on commit 5b57855

Please sign in to comment.