Page MenuHomeFreeBSD

USB4 initial work on suspend routine
Needs ReviewPublic

Authored by obiwac_gmail.com on Mar 22 2025, 1:50 AM.
Tags
Referenced Files
Unknown Object (File)
Fri, May 23, 9:58 AM
Unknown Object (File)
Thu, May 22, 4:39 PM
Unknown Object (File)
Apr 8 2025, 3:28 AM
Unknown Object (File)
Apr 5 2025, 5:25 AM
Unknown Object (File)
Mar 29 2025, 12:44 PM
Unknown Object (File)
Mar 28 2025, 7:10 PM
Unknown Object (File)
Mar 28 2025, 2:49 PM
Unknown Object (File)
Mar 27 2025, 3:47 PM
Subscribers

Details

Summary

Initial work on a suspend routine for USB4 on v1.0 host interfaces. At the moment I'm not quite concerned about resume, as it would already be quite nice to be able to suspend USB4 routers as this is a prerequisite for S0i3 on AMD.

This will also work on v2.0, but we might want to handle this differently in the future for these hosts.

Test Plan

Tested on AMD Pink Sardine controller (1022:1668/9), which is host interface version 1.0. The SLPR (sleep ready) bit is being set by the hardware.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 63790
Build 60674: arc lint + arc unit

Event Timeline

sys/dev/thunderbolt/router.c
381

Why don't we want these events?

396

Do we want to be verbose about being in this state to see if we need to implement this or if we can punt? Or is it a 'gotta do eventually'?

398

50ms is a long time to wait here...

410

And we wait 50ms multiple times. 100 if I'm reading the code right 5 seconds sleeping in a suspend path seems potentially unwise if we have to do this for multiple bridges. Is there a way to avoid that?

421

This will prevent the whole system from shutting down.... how likely is this timeout?

sys/dev/thunderbolt/router.c
381

Sorry, I should make this clearer.

The initial work on USB4 is meant to get suspend working well enough for the firmware on AMD systems to enter S0i3, since these are handed over to the OS in a powered-on state. Currently, I want to make sure we don't wake up for any reasons as I'm not handling resume and am not intending to handle resume in the near future.

396

I think leaving as is fine; the spec just mentions that, while we can wait for ROP_CMPLT on v2, polling as on v1 routers is also fine. So more of a "gotta do eventually".

398

This comes from tSetSR and is the time between setting SLP and SLPR being set by the router.

410

Actually, I think tSetSR is the maximum time the router has to set SLPR after SLP. I will double check this tomorrow, because this means we can immediately poll once every maybe 5 ms a maximum of 10 times.

421

I'm guessing this is unlikeley but if this is the case then I'll downgrade this to a simple warning I guess.

Don't touch router defines; this should be done in D49452.