Repository navigation
PCI: apple: T6050: wait for the radio's port with a wait queue - #2377
RyanTheTide wants to merge 1 commit into
Conversation
After a sleep, a parked T6050 port is brought back only once the radio's port is up again, because the shared PHY and the root complex come back with it. The radio's driver may be taking that port down and up once more for its warm reset (apple_pcie_t6050_port_recycle()), so the unpark polled t6050_down 40 times with msleep(50). Both ends of that state are in this driver: apple_pcie_t6050_sleep_up() clears t6050_down when the link is up and sets t6050_lost when it gives the port up, and apple_pcie_t6050_sleep_down() clears it again when the shutdown is refused. Wake a wait queue at each of those three points and wait on it with the same 2 s bound. The parked port now follows the radio's port as soon as it is back, instead of up to 50 ms later, and a lost port ends the wait at once. Comment the two delays left in that path: the 150 ms from the endpoint's power to its PERST# work (Tpvperl, PCIe CEM r5.0 2.9.2, with the boot bring-up's value), and the T8140 bootstrap's post-response slot watch, which samples for a late write into retained memory, an absence that no status bit or interrupt reports; the engine's completion is already waited for before it. Fixes: 851aa85 ("PCI: apple: T6050: the N1's link over a firmware sleep, and the SD reader's port") Suggested-by: Diljit Singh <[email protected]> Signed-off-by: Ryan Murray <[email protected]>
|
Looks good; approve once the T6050 s2idle row is on this head. I checked every writer of This is a resume-path change, though, and nothing has run it. The rows under "Still to run" haven't been done. HW row: a T6050 Mac on this head with the SD reader port parked over s2idle, 3 cycles: "link up again after the sleep" and "its functions found again" each time, no "stays parked: the radio's port is not back", and the SD card readable after each wake. Plus one s2idle on J616s or Neo with Wi-Fi back. 0 AVC, 0 failed units, no new apple-pcie errors. Assisted-by: LLM (Claude:Opus 5.5) |
Problem
After a sleep, a parked T6050 port comes back only once the radio's port is up again, because the shared PHY and the root complex come back with it. The radio's driver may be taking that port down and up once more for its warm reset. The unpark polled
t6050_down40 times withmsleep(50)(pcie-apple.c:5276, from 851aa85 "PCI: apple: T6050: the N1's link over a firmware sleep, and the SD reader's port"). Both ends of that state are in this driver, so a sleep loop is not needed.Change
apple_pcie_t6050_sleep_up()clearst6050_down(link up), where it setst6050_lost(port given up), and whereapple_pcie_t6050_sleep_down()clearst6050_downafter a refused shutdown. The unpark waits on it with the same 2 s bound. The parked port follows the radio's port as soon as it is back, and a lost port ends the wait at once.apple_pcie_t6050_cold_up()stays. A comment now gives the reason: Tpvperl is at least 100 ms (PCIe CEM r5.0 2.9.2), and 150 ms is what the boot bring-up gives this port.checks = answered ? 2 : 10, from d15e15e) is unchanged. A comment now explains why it is sampled. The engine's completion (status interrupt, command bit, drained FIFO) is already waited for before it. The watch looks for a late write into retained memory, and no status bit or interrupt reports that absence.Only hosts with a
t6050_port(apple,t6050-pcie, theadopt_linkhost) run the changed wait. Every other apple-pcie host initialises the queue but never setst6050_down, so T8103, T6000, T8112, T6040 and T8140 behave as before.Testing
drivers/pci/controller/pcie-apple.oandpcie-apple-t8140-bootstrap.owith the release config: no new warnings compared with the base.Still to run
ip linkshows wlan up,dmesgshows no apple-pcie errors).Code credit
Diljit Singh wrote the T6050 sleep path and the T8140 slot watch.