All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: Mask ring interrupt on Intel hardware as well
@ 2023-05-30  7:55 Mika Westerberg
  2023-05-31  7:41 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Mika Westerberg @ 2023-05-30  7:55 UTC (permalink / raw)
  To: linux-usb
  Cc: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever,
	beld zhang, Mario Limonciello, Bagas Sanjaya, Mika Westerberg

When resuming from system sleep states the driver issues following
warning on Intel hardware:

  thunderbolt 0000:07:00.0: interrupt for TX ring 0 is already enabled

The reason for this is that the commit in question did not mask the ring
interrupt on Intel hardware leaving the interrupt active. Fix this by
masking it also in Intel hardware.

Reported-by: beld zhang <beldzhang@gmail.com>
Closes: https://lore.kernel.org/linux-usb/ZHKW5NeabmfhgLbY@debian.me/
Fixes: c4af8e3fecd0 ("thunderbolt: Clear registers properly when auto clear isn't in use")
Cc: stable@vger.kernel.org
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/nhi.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 565892a2cdb9..a979f47109e3 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -56,9 +56,14 @@ static int ring_interrupt_index(const struct tb_ring *ring)
 
 static void nhi_mask_interrupt(struct tb_nhi *nhi, int mask, int ring)
 {
-	if (nhi->quirks & QUIRK_AUTO_CLEAR_INT)
-		return;
-	iowrite32(mask, nhi->iobase + REG_RING_INTERRUPT_MASK_CLEAR_BASE + ring);
+	if (nhi->quirks & QUIRK_AUTO_CLEAR_INT) {
+		u32 val;
+
+		val = ioread32(nhi->iobase + REG_RING_INTERRUPT_BASE + ring);
+		iowrite32(val & ~mask, nhi->iobase + REG_RING_INTERRUPT_BASE + ring);
+	} else {
+		iowrite32(mask, nhi->iobase + REG_RING_INTERRUPT_MASK_CLEAR_BASE + ring);
+	}
 }
 
 static void nhi_clear_interrupt(struct tb_nhi *nhi, int ring)
-- 
2.39.2


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

* Re: [PATCH] thunderbolt: Mask ring interrupt on Intel hardware as well
  2023-05-30  7:55 [PATCH] thunderbolt: Mask ring interrupt on Intel hardware as well Mika Westerberg
@ 2023-05-31  7:41 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2023-05-31  7:41 UTC (permalink / raw)
  To: linux-usb
  Cc: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever,
	beld zhang, Mario Limonciello, Bagas Sanjaya

On Tue, May 30, 2023 at 10:55:55AM +0300, Mika Westerberg wrote:
> When resuming from system sleep states the driver issues following
> warning on Intel hardware:
> 
>   thunderbolt 0000:07:00.0: interrupt for TX ring 0 is already enabled
> 
> The reason for this is that the commit in question did not mask the ring
> interrupt on Intel hardware leaving the interrupt active. Fix this by
> masking it also in Intel hardware.
> 
> Reported-by: beld zhang <beldzhang@gmail.com>
> Closes: https://lore.kernel.org/linux-usb/ZHKW5NeabmfhgLbY@debian.me/
> Fixes: c4af8e3fecd0 ("thunderbolt: Clear registers properly when auto clear isn't in use")
> Cc: stable@vger.kernel.org
> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Applied to thunderbolt.git/fixes.

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

end of thread, other threads:[~2023-05-31  7:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30  7:55 [PATCH] thunderbolt: Mask ring interrupt on Intel hardware as well Mika Westerberg
2023-05-31  7:41 ` Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.