Page MenuHomeFreeBSD

USB4 initial work on suspend routine
Needs ReviewPublic

Authored by obiwac_gmail.com on Sat, Mar 22, 1:50 AM.

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 63048
Build 59932: arc lint + arc unit

Event Timeline

sys/dev/thunderbolt/router.c
379

Why don't we want these events?

394

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'?

396

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

408

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?

419

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

sys/dev/thunderbolt/router.c
379

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.

394

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".

396

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

408

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.

419

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