From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.130 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794800361; b=aVK3XeBDv8K5g3GZD4H8frop3w/JaEmcw8Vk2ZyEc4a3iBJk5Ojf4VOcPy1Vk5KWjQe0 Fq6ImODD8UE42VNgKYNqbaDk9ODDyUMCwl3Eag/rV3ls7mAiqaTT1tWr8kK7OTVmuvxD+ dRQ5VsgKz7DgYvqh/roxZMePul5jNHQL/6Pu28GvaKFluqHHcyaWaQQDhOiN250dliAHY e3ugwbnYSOPBXEkPbqRC7iZo0xMP3HXXWwcs45oz/EJtbH3q3YbIXDj4qFXmhVV5GKzlJ jQJd4oeLKKQbXyUs0Vw/5Gj8iGIExRa7Kof5mh73l+R39tUvq/qYABvnmYlf5ioyTBA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794800361; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=W1vdO8a9mxhEayuDDyrm76yluN+B8zC339a6nO+fPrw=; b=DgYu5jZe96q2+TiBnC2j4Lm2PppPSyOXOAECCIM9GqLDexcA3cad+xsT1jucooNopIGS axHVcT/UFNb6vSluxrndMRuv6Q9fBsDY6ICHLXCwH1DBgU6LW7qiRTc/BjuTXOaNaKkN7 McCkkwOBtPiMZw/UiBc8PI0M0BRNVKLvI8/Hntxj85P9vuFDgWecGyHTDPJ/pR+umnsn8 TGhtOI8P8uuXZmdeFMo9SULDjDemJJeMoPZEGxq9fey4CuJ/uIhYIHrD1am3KXdxyS/Dx z0MwfgHCkKL/c3ZDdrPcIFi4uhEAtaJqjeZXbddodo9uNcfCZiI6E/A80yfJUCwO+6A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=oKTvF63q; arc=none smtp.remote-ip=115.124.30.130 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9947606A31C for ; Mon, 16 Nov 2026 03:39:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E9947606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=oKTvF63q DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1794800352; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=W1vdO8a9mxhEayuDDyrm76yluN+B8zC339a6nO+fPrw=; b=oKTvF63qcXcNcA97HrmQHZO1G87B1vrXhZH9FTaOS2uj1jfXOnjluFsMQX49BEbgJRTgfkt9LDH9E+fr/oa/mtcnX8yjbStoxT5A4hvm9U3o8H+ZyFKABf7YfBLQ8OwcKb7+tBLM7pKd42kne6f8oifAVZX0f34mdL0RndDjtQ4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033032089153;MF=guanghuifeng@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0XElQojT_1794800342; Received: from VM20241011-104.tbsite.net(mailfrom:guanghuifeng@linux.alibaba.com fp:SMTPD_---0XElQojT_1794800342 cluster:ay36) by smtp.aliyun-inc.com; Mon, 16 Nov 2026 11:39:11 +0800 From: Guanghui Feng To: joro@8bytes.org, vasant.hegde@amd.com, suravee.suthikulpanit@amd.com, will@kernel.org, robin.murphy@arm.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] iommu/amd: Do not clear unobserved log overflow status bits Date: Mon, 16 Nov 2026 11:39:02 +0800 Message-ID: <20261116033902.3277875-1-guanghuifeng@linux.alibaba.com> X-Mailer: git-send-email 2.43.7 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit amd_iommu_handle_irq() clears the interrupt status with an unconditional writel(mask, MMIO_STATUS_OFFSET), where mask is int_mask | overflow_mask. The log overflow status bits (GALOverflow, EventOverflow, PprOverflow) are RW1C and, per the AMD IOMMU spec, transitioning them from 0 to 1 does not itself generate an interrupt; they can only be observed by an IRQ round triggered by the corresponding log-interrupt bit. If hardware sets an overflow bit after the status register is sampled at the top of the loop but before the unconditional writel(), that write clears the freshly-set bit while the stale sampled status does not contain it, so overflow_handler() is skipped for an overflow that really happened. For the GA log this is fatal: amd_iommu_restart_ga_log() is the only recovery path, and per spec section 2.7.4 logging stays halted until GALogEn is toggled. A bare W1C of GALOverflow is not part of the documented recovery, so the GA log stays halted, no further entries are written, GAInt never re-asserts and the GA log interrupt line goes permanently silent, losing all AVIC non-running vCPU wakeups on that IOMMU. Clear only the bits actually observed this round by writing status & mask instead of mask. An overflow bit set concurrently is then left asserted and is picked up by the existing ERBT1312 status read-back at the bottom of the loop, which re-enters the loop and runs overflow_handler(). Fixes: 2379f3485239 ("iommu/amd: Refactor IOMMU interrupt handling logic for Event, PPR, and GA logs") Signed-off-by: Guanghui Feng --- drivers/iommu/amd/iommu.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index d0d55c93a480..39254671b924 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -1168,8 +1168,17 @@ static void amd_iommu_handle_irq(void *data, const char *evt_type, u32 mask = int_mask | overflow_mask; while (status & mask) { - /* Enable interrupt sources again */ - writel(mask, iommu->mmio_base + MMIO_STATUS_OFFSET); + /* + * Clear only the status bits observed in this round. The log + * overflow bits (GALOverflow/EventOverflow/PprOverflow) are RW1C + * and do not raise an interrupt on their own; clearing them + * unconditionally here would drop an overflow that hardware set + * between the readl() above and this write, without ever running + * overflow_handler(). Leaving such a bit asserted lets the + * existing ERBT1312 read-back below re-observe it and re-enter + * the loop so overflow_handler() runs. + */ + writel(status & mask, iommu->mmio_base + MMIO_STATUS_OFFSET); if (int_handler) { pr_devel("Processing IOMMU (ivhd%d) %s Log\n", -- 2.43.7