From a16ba5f76a405a8aec87eed9b679033ce93fd4cd Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 20 Sep 2023 06:33:03 +0200 Subject: [PATCH] fix thunderbolt ring-interrupt not being masked on suspend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally for v6.4-rc7 and now it also got already into some stable trees, but not yet into a (released) ubuntu tag – so backport it already. Link: https://forum.proxmox.com/threads/133104/post-590457 Signed-off-by: Thomas Lamprecht (cherry picked from commit d772676031f0c9181fa9b7cdbdb84b759d764947) Signed-off-by: Thomas Lamprecht --- ...-ring-interrupt-on-Intel-hardware-as.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 patches/kernel/0017-thunderbolt-Mask-ring-interrupt-on-Intel-hardware-as.patch diff --git a/patches/kernel/0017-thunderbolt-Mask-ring-interrupt-on-Intel-hardware-as.patch b/patches/kernel/0017-thunderbolt-Mask-ring-interrupt-on-Intel-hardware-as.patch new file mode 100644 index 0000000..65563c2 --- /dev/null +++ b/patches/kernel/0017-thunderbolt-Mask-ring-interrupt-on-Intel-hardware-as.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mika Westerberg +Date: Tue, 30 May 2023 08:48:29 +0300 +Subject: [PATCH] thunderbolt: Mask ring interrupt on Intel hardware as well + +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 +Tested-by: beld zhang +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 +Signed-off-by: Mika Westerberg +(cherry picked from commit 9f9666e65359d5047089aef97ac87c50f624ecb0) +Signed-off-by: Thomas Lamprecht +--- + 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 0a525f44ea31..4a6a3802d7e5 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)