mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Do not clear unobserved log overflow status bits
@ 2026-11-16  3:39 Guanghui Feng
  2026-11-16  6:30 ` Ankit Soni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Guanghui Feng @ 2026-11-16  3:39 UTC (permalink / raw)
  To: joro, vasant.hegde, suravee.suthikulpanit, will, robin.murphy
  Cc: iommu, linux-kernel

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 <guanghuifeng@linux.alibaba.com>
---
 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


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

* Re: [PATCH] iommu/amd: Do not clear unobserved log overflow status bits
  2026-11-16  3:39 [PATCH] iommu/amd: Do not clear unobserved log overflow status bits Guanghui Feng
@ 2026-11-16  6:30 ` Ankit Soni
  2026-11-19 14:13   ` [PATCH v2] " Guanghui Feng
  2026-11-16  8:40 ` [PATCH] " Ankit Soni
  2026-11-16 11:19 ` Ankit Soni
  2 siblings, 1 reply; 6+ messages in thread
From: Ankit Soni @ 2026-11-16  6:30 UTC (permalink / raw)
  To: Guanghui Feng
  Cc: joro, vasant.hegde, suravee.suthikulpanit, will, robin.murphy,
	iommu, linux-kernel

On Mon, Nov 16, 2026 at 11:39:02AM +0800, Guanghui Feng wrote:
> 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")

This commit only moved the existing clear into amd_iommu_handle_irq(). The
unconditional write already cleared overflow bits before that refactor.
The first commit that put an overflow bit into that write is:

Fixes: 5ce97f4ec5e0 ("iommu/amd: Recover from event log overflow")

The GA and PPR overflow bits were added later, by af47b0a24058
("iommu/amd: Handle GALog overflows") and 274c2218b8b2 ("iommu/amd: Handle
PPR log overflow").

Otherwise, patch looks good to me.

Reviewed-by: Ankit Soni <Ankit.Soni@amd.com>

-Ankit

> Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
> ---
>  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
> 

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

* Re: [PATCH] iommu/amd: Do not clear unobserved log overflow status bits
  2026-11-16  3:39 [PATCH] iommu/amd: Do not clear unobserved log overflow status bits Guanghui Feng
  2026-11-16  6:30 ` Ankit Soni
@ 2026-11-16  8:40 ` Ankit Soni
  2026-11-16 11:19 ` Ankit Soni
  2 siblings, 0 replies; 6+ messages in thread
From: Ankit Soni @ 2026-11-16  8:40 UTC (permalink / raw)
  To: Guanghui Feng
  Cc: joro, vasant.hegde, suravee.suthikulpanit, will, robin.murphy,
	iommu, linux-kernel

On Mon, Nov 16, 2026 at 11:39:02AM +0800, Guanghui Feng wrote:
> 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")

This commit only moved the existing clear into amd_iommu_handle_irq(). The
unconditional write already cleared overflow bits before that refactor.
The first commit that put an overflow bit into that write is:

Fixes: 5ce97f4ec5e0 ("iommu/amd: Recover from event log overflow")

The GA and PPR overflow bits were added later, by af47b0a24058
("iommu/amd: Handle GALog overflows") and 274c2218b8b2 ("iommu/amd: Handle
PPR log overflow").

Otherwise, Looks good to me.

Reviewed-by: Ankit Soni <Ankit.Soni@amd.com>

Thanks,
Ankit

> Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
> ---
>  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
> 

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

* Re: [PATCH] iommu/amd: Do not clear unobserved log overflow status bits
  2026-11-16  3:39 [PATCH] iommu/amd: Do not clear unobserved log overflow status bits Guanghui Feng
  2026-11-16  6:30 ` Ankit Soni
  2026-11-16  8:40 ` [PATCH] " Ankit Soni
@ 2026-11-16 11:19 ` Ankit Soni
  2026-11-16 11:42   ` Ankit Soni
  2 siblings, 1 reply; 6+ messages in thread
From: Ankit Soni @ 2026-11-16 11:19 UTC (permalink / raw)
  To: Guanghui Feng
  Cc: joro, vasant.hegde, suravee.suthikulpanit, will, robin.murphy,
	iommu, linux-kernel

On Mon, Nov 16, 2026 at 11:39:02AM +0800, Guanghui Feng wrote:
> 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")

This commit only moved the existing clear into amd_iommu_handle_irq(). The
unconditional write already cleared overflow bits before that refactor.
The first commit that put an overflow bit into that write is:

Fixes: 5ce97f4ec5e0 ("iommu/amd: Recover from event log overflow")

The GA and PPR overflow bits were added later, by af47b0a24058
("iommu/amd: Handle GALog overflows") and 274c2218b8b2 ("iommu/amd: Handle
PPR log overflow").

Otherwise, patch looks good to me.

Reviewed-by: Ankit Soni <Ankit.Soni@amd.com>

Thanks,
Ankit

> Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
> ---
>  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
> 

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

* Re: [PATCH] iommu/amd: Do not clear unobserved log overflow status bits
  2026-11-16 11:19 ` Ankit Soni
@ 2026-11-16 11:42   ` Ankit Soni
  0 siblings, 0 replies; 6+ messages in thread
From: Ankit Soni @ 2026-11-16 11:42 UTC (permalink / raw)
  To: Guanghui Feng
  Cc: joro, vasant.hegde, suravee.suthikulpanit, will, robin.murphy,
	iommu, linux-kernel


Sorry for spamming, internal server issue which blocked reply to
external mails temporarily, because of which i couldnt see my replies
on lore so resent it thrice.

-Ankit

On Mon, Nov 16, 2026 at 11:19:55AM +0000, Ankit Soni wrote:
> On Mon, Nov 16, 2026 at 11:39:02AM +0800, Guanghui Feng wrote:
> > 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")
> 
> This commit only moved the existing clear into amd_iommu_handle_irq(). The
> unconditional write already cleared overflow bits before that refactor.
> The first commit that put an overflow bit into that write is:
> 
> Fixes: 5ce97f4ec5e0 ("iommu/amd: Recover from event log overflow")
> 
> The GA and PPR overflow bits were added later, by af47b0a24058
> ("iommu/amd: Handle GALog overflows") and 274c2218b8b2 ("iommu/amd: Handle
> PPR log overflow").
> 
> Otherwise, patch looks good to me.
> 
> Reviewed-by: Ankit Soni <Ankit.Soni@amd.com>
> 
> Thanks,
> Ankit
> 
> > Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
> > ---
> >  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
> > 

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

* [PATCH v2] iommu/amd: Do not clear unobserved log overflow status bits
  2026-11-16  6:30 ` Ankit Soni
@ 2026-11-19 14:13   ` Guanghui Feng
  0 siblings, 0 replies; 6+ messages in thread
From: Guanghui Feng @ 2026-11-19 14:13 UTC (permalink / raw)
  To: ankit.soni
  Cc: guanghuifeng, iommu, joro, linux-kernel, robin.murphy,
	suravee.suthikulpanit, vasant.hegde, will

amd_iommu_handle_irq() clears the interrupt status with an unconditional
writel(mask, MMIO_STATUS_OFFSET), where mask is int_mask | overflow_mask.
If hardware sets a log overflow bit after the status register is sampled
at the top of the loop but before that write, the 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.

This is fatal for the GA log: GALOverflow generates no interrupt of its
own (MMIO Offset 2020h bit 9), 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 that
recovery.  The GA log then stays halted, 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 observed this round by writing status & mask.  An
overflow bit set concurrently is then left asserted and is re-observed by
the existing ERBT1312 status read-back at the bottom of the loop, which
re-enters the loop and runs overflow_handler().

The unconditional write has cleared an overflow bit since commit
5ce97f4ec5e0 ("iommu/amd: Recover from event log overflow"); commit
af47b0a24058 ("iommu/amd: Handle GALog overflows") and commit
274c2218b8b2 ("iommu/amd: Handle PPR log overflow") later added the GA
and PPR overflow bits to the same write.

Fixes: 5ce97f4ec5e0 ("iommu/amd: Recover from event log overflow")
Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
Reviewed-by: Ankit Soni <Ankit.Soni@amd.com>
---
v2:
 - Correct the Fixes tag: 2379f3485239 only moved the existing clear into
   amd_iommu_handle_irq(); the unconditional write started clearing an
   overflow bit in 5ce97f4ec5e0.  Record the GA/PPR follow-up commits.
   (Ankit Soni)
 - Tighten the commit message and the in-code comment: scope the "no
   interrupt of its own" statement to GALOverflow, since EventOverflow
   and PprOverflow do have their own interrupt source.  The functional
   change (writel(status & mask)) is unchanged from v1, so Ankit's
   Reviewed-by still applies.
 - Collect Ankit's Reviewed-by.

 drivers/iommu/amd/iommu.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index d0d55c93a480..530f97729d68 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1168,8 +1168,18 @@ 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 are RW1C; clearing one 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.  This matters most for the GA log,
+		 * whose GALOverflow bit generates no interrupt of its own, so a
+		 * dropped overflow can otherwise halt GA logging permanently.
+		 */
+		writel(status & mask, iommu->mmio_base + MMIO_STATUS_OFFSET);
 
 		if (int_handler) {
 			pr_devel("Processing IOMMU (ivhd%d) %s Log\n",
-- 
2.43.7


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

end of thread, other threads:[~2026-11-19 14:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16  3:39 [PATCH] iommu/amd: Do not clear unobserved log overflow status bits Guanghui Feng
2026-11-16  6:30 ` Ankit Soni
2026-11-19 14:13   ` [PATCH v2] " Guanghui Feng
2026-11-16  8:40 ` [PATCH] " Ankit Soni
2026-11-16 11:19 ` Ankit Soni
2026-11-16 11:42   ` Ankit Soni

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

all inboxes | Powered by JetHome®