From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: mario.limonciello@amd.com, andreas.noever@gmail.com,
westeri@kernel.org, YehezkelShB@gmail.com
Cc: "Mario Limonciello (AMD)" <superm1@kernel.org>,
Sanath.S@amd.com, linux-usb@vger.kernel.org
Subject: [PATCH] thunderbolt: Reset NHI during S4 restore_noirq() callback
Date: Thu, 23 Oct 2025 00:03:26 -0500 [thread overview]
Message-ID: <20251023050354.115015-1-superm1@kernel.org> (raw)
When a machine is restored from S4 if the firmware CM has created
tunnels there can be an incongruity of expectation from the kernel
when compared to booting from S5.
For example this incongruity can lead to problems like the display
not working properly if the firmware CM didn't turn it on pre-OS
but the OS had it on before entering S4.
Add an extra restore_noirq() callback to explicitly reset the NHI
before running the rest of the resume sequence. This will allow
the standard discovery and probing routines to run and create the
tunnels as expected.
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
Cc: Sanath.S@amd.com
---
drivers/thunderbolt/nhi.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 5f63f9b9cf405..042d184637a93 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -51,6 +51,8 @@ static bool host_reset = true;
module_param(host_reset, bool, 0444);
MODULE_PARM_DESC(host_reset, "reset USB4 host router (default: true)");
+static void nhi_reset(struct tb_nhi *nhi);
+
static int ring_interrupt_index(const struct tb_ring *ring)
{
int bit = ring->hop;
@@ -1077,6 +1079,17 @@ static int nhi_resume_noirq(struct device *dev)
return tb_domain_resume_noirq(tb);
}
+static int nhi_restore_noirq(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct tb *tb = pci_get_drvdata(pdev);
+ struct tb_nhi *nhi = tb->nhi;
+
+ nhi_reset(nhi);
+
+ return nhi_resume_noirq(dev);
+}
+
static int nhi_suspend(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
@@ -1449,7 +1462,7 @@ static const struct dev_pm_ops nhi_pm_ops = {
* pci-tunnels stay alive.
*/
.thaw_noirq = nhi_thaw_noirq,
- .restore_noirq = nhi_resume_noirq,
+ .restore_noirq = nhi_restore_noirq,
.suspend = nhi_suspend,
.poweroff_noirq = nhi_poweroff_noirq,
.poweroff = nhi_suspend,
--
2.43.0
next reply other threads:[~2025-10-23 5:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 5:03 Mario Limonciello (AMD) [this message]
2025-10-23 5:56 ` [PATCH] thunderbolt: Reset NHI during S4 restore_noirq() callback Mika Westerberg
2025-10-23 14:13 ` Mario Limonciello
2025-11-04 19:11 ` Kenneth Crudup
2025-11-04 19:12 ` Mario Limonciello
2025-11-04 20:22 ` Kenneth Crudup
2025-11-04 20:31 ` Mario Limonciello
2025-11-04 21:19 ` Kenneth Crudup
2025-11-04 21:21 ` Mario Limonciello
2025-11-05 19:06 ` Kenneth Crudup
2025-11-05 19:16 ` Mario Limonciello (AMD) (kernel.org)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251023050354.115015-1-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=Sanath.S@amd.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=westeri@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).