[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48a674ae-f5cd-fc06-4505-6d863e6dad69@huawei.com>
Date: Mon, 31 Jan 2022 17:06:03 +0000
From: John Garry <john.garry@...wei.com>
To: Joerg Roedel <joro@...tes.org>, <iommu@...ts.linux-foundation.org>
CC: Joerg Roedel <jroedel@...e.de>, <linux-kernel@...r.kernel.org>,
"Maxim Levitsky" <mlevitsk@...hat.com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH] iommu/amd: Fix loop timeout issue in
iommu_ga_log_enable()
On 31/01/2022 16:17, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@...e.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@...e.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);
Maybe readl_relaxed_poll_timeout_atomic() could be used instead
Thanks,
John
> }
>
> if (WARN_ON(i >= LOOP_TIMEOUT))
>
Powered by blists - more mailing lists