Re: [PATCH RFC DNM 10/15] thunderbolt: nhi: Resume a runtime suspended NHI for system suspend
From: Mika Westerberg
Date: Tue Dec 01 2026 - 02:49:21 EST
Hi,
On Tue, Nov 24, 2026 at 09:01:39PM +0100, Konrad Dybcio wrote:
> The PCI core resumes a runtime suspended device in pci_pm_suspend()
> before calling the driver's suspend callback, so nhi_suspend_noirq()
> always finds the NHI active. Platform devices get no such treatment, so
> these runtime suspended NHIs gets suspended a second time in the
> noirq phase and resumed in nhi_resume_noirq(). nhi_complete() then still
> sees it as runtime suspended and resumes it once more, which corrupts
> the control channel (RX checksum mismatches, config space timeouts).
>
> Resume the NHI at the beginning of nhi_suspend(), like the PCI core
> does as a workaround.
Okay but I would rather keep it suspended over the system sleep. There
is no difference from USB4 perspective so there is really no point waking
it up. IIRC we do that now because USB stack needs to re-configure wakes
for S3 but for s2idle (which is what the modern Intel systems at least do)
that should not be necessary - it should wake the same way as runtime
suspended.
> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
> ---
> drivers/thunderbolt/nhi.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
> index e2578740d569a7ee1d5ab22e8effc153cb7d4632..56bc5748b6515b9d4799aa87ce0f72e1d673d634 100644
> --- a/drivers/thunderbolt/nhi.c
> +++ b/drivers/thunderbolt/nhi.c
> @@ -1258,6 +1258,13 @@ static int nhi_suspend(struct device *dev)
> {
> struct tb *tb = dev_get_drvdata(dev);
>
> + /*
> + * The noirq callbacks expect the NHI to be active. The PCI core
> + * resumes a runtime suspended device before calling this, do the
> + * same for the NHIs that are not PCI devices.
> + */
> + pm_runtime_resume(dev);
> +
> return tb_domain_suspend(tb);
> }
>
>
> --
> 2.55.0