Repository navigation
PCI: apple: radio: take the radio SIDs from apple,managed-sids and admit port 2 - #1962
IronsideXXVI wants to merge 5 commits into
Conversation
DjDeveloperr
left a comment
There was a problem hiding this comment.
Review of the draft, mainly to answer question 1 so the series can go one way or the other.
Question 1, managed or unmanaged. Aurora's J604 tree runs this host under the managed contract on purpose: t8132-apcie-port2.dtsi keeps port 2 and dart_apcie2 disabled "until it admits a second port and its stream". The direction our tree documents is therefore the managed transaction admitting port 2, not a second, unmanaged relink path next to it.
What stands in the way is that the managed transaction in pcie-apple-radio.c only runs for of_machine_is_compatible("apple,j713") with exactly SIDs 1 and 2. That's a board gate we wouldn't accept in new code either. Our preference would be:
- select the managed transaction by what the host node presents (
apple,managed-sids, its ports and their DARTs), which gives the J604 deep sleep on the managed path; - admit port 2 on top of that.
If you've found a hardware reason the managed transaction can't cover two ports, please write it up here, because that would change the answer. The same decision decides #1966 and #1998.
Question 2, the J713. Every T8132 board inherits apple,managed-sids from t8132-jxxx.dtsi, so nothing in our tree reaches the unmanaged branch today.
On the code itself, whichever way it goes: selecting by the host's own compatible (apple,t8132-pcie) is fine under our rules. Restoring each DART only once its own port is clocked again, matched by bus-range, is the right shape.
11b4286 to
758ded5
Compare
|
Thanks, that settles it: managed. Pushed 758ded5. The managed transaction now registers by what the host node presents (a T8132 host whose We found no hardware reason against the managed path. The J604's ADT has Wi-Fi on SID 1 and Bluetooth on SID 2 on |
|
Port 2 is on top now, head 1de6d08:
W=1 is clean, checkpatch --strict is clean, the J604 dtb passes |
|
host-tests went red on 1de6d08 in |
915b146 to
d5cd764
Compare
|
Blockers: 3.
HW row: J604 on this head, default command line, SD card inserted: 10 firmware deep-sleep cycles; each wake logs "native radio power-loss recovery complete" and "dart ... restored after its host came back" for dart_apcie2, no "not back after the deep sleep"; Wi-Fi, BT and the SD card (read back a file) all work after every wake. Same 10 cycles on the J713 for no regression, and one boot plus 3 cycles on a J773g or J623/J624. 0 AVC, 0 failed units, no new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
The managed radio transaction has the radio's functions on SIDs 1 and 2 written into the code, and the host probe accepts apple,managed-sids only when it is exactly <1 2> and only on the boards that apple_t8132_managed_radio() lists. So the SIDs are fixed one layer up, and any other value can never reach the transaction. Take the contract from the host node instead: - the probe accepts apple,managed-sids on a T8132 host with 1 to 15 distinct SIDs, whatever the board, and no longer requires <1 2>; - the transaction takes each function's SID from apple,managed-sids, in RID order. The bind already checks them against the host's iommu-map and the endpoints' IDs, so a host whose node names other SIDs than its radio uses still fails the bind and refuses a firmware suspend. The firmware suspend itself stays on the J713. It is the only T8132 host that has run it; the other T8132 boards still refuse a firmware suspend with -EBUSY until one of them has a deep-sleep row. Every T8132 board in the tree presents <1 2> today, so nothing changes on real hardware. Signed-off-by: Dylan Ironside <[email protected]>
…anaged-sids The snapshot test compiles apple_radio_snapshot() from the driver against its own struct apple_radio_sleep. The previous commit moved the radio functions' SIDs into that struct (sid[], from the host's apple,managed-sids), so the test no longer built and the host-tests job failed on it. Give the fixture the field, with SIDs 1 and 2 for the existing cases, and add a host whose apple,managed-sids is <3 5>: its admitted words pass, a function routed to the other admitted SID fails, and so does a SID outside apple,managed-sids. The retained-link checks are unchanged. Signed-off-by: Dylan Ironside <[email protected]>
The managed contract is the host's: every port of a host with apple,managed-sids gets managed RID-to-SID admission, and the radio transaction registers only on a host with a single port. The J604's built-in host also has port 2, the SD card reader, behind a DART of its own (dart-apcie2, which carries no apple,managed-sids), so the port stays disabled and the reader with it. Take the contract per port: a port is managed when the DART its bus maps to through the host's iommu-map carries apple,managed-sids, as the radio's does; any other port uses the ordinary RID-to-SID routing for its own table. A port whose DART cannot be told stays managed. The radio transaction keeps the host's one managed port, port 0, and admits the others: each other port's DART waits for its host after a wake (apple_dart_set_host_resumes(), linked to resume first), the port's interrupt is held with the radio port's, and its link state, MSI and RID-to-SID routes are saved once the transaction is sealed. On a power-loss wake, after the radio's recovery is published, each port is brought up as probe does it with those routes written back and read back, then its DART is restored; a port that was down is only clocked again, for its DART. A port that does not come back keeps its DART gated and its interrupt off; the radio does not depend on it. A refused or retained sleep only gives the interrupts back. The other ports are admitted all or none. When another port's DART has not probed yet as the host binds the radio, the radio stays bound and the ports are admitted from a PM notifier at PM_SUSPEND_PREPARE, before devices are prepared, so the device link orders that sleep; until then prepare refuses a firmware suspend with -EBUSY. A failed admission, and the radio's teardown, undo every admitted port: the device link is removed, the DART's host_resumes is cleared through the new apple_dart_clear_host_resumes(), and the reference is dropped. On a host with only port 0, as on the J713, nothing changes. The transaction still registers on the J713 only, so the port admission does not run on a real host until another T8132 board is allowed the firmware suspend. The radio PM host test checks the order: the other ports are saved only after the seal, and restored only after the radio's recovery. Signed-off-by: Dylan Ironside <[email protected]>
The built-in host now admits a port with ordinary routing next to the managed radio port, so enable the J604's port 2 (the GL9755 SD card reader) and its DART, and map the port's bus in the host's iommu-map: the reader's stream is SID 1 on dart-apcie2 (ADT pcie-sdreader iommu-parent mapper-apcie2, reg 1). dart-apcie2 carries no apple,managed-sids, so the port uses ordinary RID-to-SID routing. Update the port 2 include's note to say how a board uses it. Signed-off-by: Dylan Ironside <[email protected]>
"PCI: apple: radio: admit the host's other ports into the managed sleep" made apple_pcie_port_teardown() decide whether a port owns its IRQ block from port->managed (its bus maps to the DART that carries apple,managed-sids) instead of from the host's managed_sids. The test builds that function into its fixture, whose struct apple_pcie_port has no managed member, so the fixture no longer compiled: error: 'struct apple_pcie_port' has no member named 'managed' The radio's SIDs are not what changed. The J604 device tree compiled before and after "arm64: dts: apple: t8132-j604: enable the SD card reader's port" maps the radio's bus the same way: iommu-map entry <0x100 &dart_apcie0 1 2>, dart_apcie0 apple,managed-sids = <1 2>, radio bus-range <1 1>. The only additions are <0x200 &dart_apcie2 1 1> and port 2 with dart_apcie2 (no managed SIDs) enabled. So the test follows the driver and the device tree stays as it is. Give the fixture port the managed member and mark the radio's port managed, so the busy-admission teardown is checked exactly as before: no INTMSK write until a domain exists, one write after. Add the case the new host has: another port of the same managed host whose DART carries no managed SIDs (the SD reader's port 2) runs ordinary routing and owns its IRQ block, so teardown masks it even before a domain exists. With the old host-wide condition put back, that case fails. The managed-SID admission, publication and quarantine checks of the radio's SIDs 1 and 2 are unchanged. Signed-off-by: Dylan Ironside <[email protected]>
d5cd764 to
de49b80
Compare
|
Thanks Ryan. All three are addressed in de49b80 (force-pushed, same five commits, reworked):
What I ran on de49b80 (on
Not run yet: any hardware on this revision. The J604 row you gave (10 deep-sleep cycles with the SD card in, both log lines for |
|
None of this is on integration/aurora: the tip's host probe still accepts apple,managed-sids only on the board list and only as <1 2>. All five commits apply cleanly to 110861f. Head de49b80 reworks the three points from the last review and is waiting on a re-review. Still needed from hardware: the J604 row with port 2 up and an SD card inserted (deep-sleep cycles with Wi-Fi, Bluetooth and the card working after each wake), plus the J713 no-regression cycles. Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches; CHECK_DTBS over every Apple DTB: no new warnings against the tip. Host tests (tools/asahi/run-host-tests.py --only) on 110861f plus this change: radio-pm-tests passes (1/1); radio-sleep-snapshot-tests passes (1/1). |
|
@IronsideXXVI checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
What: The radio's managed sleep transaction now takes each function's SID from
apple,managed-sids(T8132 hosts, 1 to 15 distinct SIDs) instead of a hard-coded 1 and 2. The host's other ports join the managed sleep with ordinary RID-to-SID routing. The J604 DT enables the SD card reader's port 2 anddart_apcie2. The managed firmware suspend itself stays J713-only, so on the J604 port 2 comes up at boot and its sleep path stays dormant until a J604 deep-sleep row exists.Tested: No J604 or J713 hardware run on this revision (de49b80). Checked on top of
integration/aurora5b596e6: checkpatch --strict is clean on each commit,drivers/pci/controller/anddrivers/iommu/build with W=1 (clang and gcc) with no warnings at the base, the first commit and the head, the Apple dtbs passCHECK_DTBSwith no new warnings, and every radio and bcm4377 host test passes.Risk: two-way · the J713, the only host that registers the managed transaction (its SIDs now come from
apple,managed-sidsinstead of the code), and the J604 (M4), where port 2 is now enabled at boot. On a host with only port 0, nothing changes.Not yet: A J604 deep-sleep row on a unit kernel that lets the J604 through the gate: 10 firmware deep-sleep cycles with Wi-Fi, BT and SD read back after every wake. The gate stays as it is until that row passes. Also a J713 run on this revision.
Full description
Reworked after the second review. The J604 now describes the managed contract (
apple,managed-sids, Bluetooth on SID 2), but the managed firmware suspend itself stays J713-only. No J604 deep-sleep row exists yet, so on the J604 the SD reader port added here comes up at boot, and its sleep path stays dormant until a row exists.Five commits:
PCI: apple: radio: take the radio's SIDs from apple,managed-sids: the transaction takes each function's SID fromapple,managed-sidsin RID order, instead of having 1 and 2 written into the code. The probe accepts the property on a T8132 host with 1 to 15 distinct SIDs; it no longer requires<1 2>or checks the board list.apple_radio_register()keeps itsapple,j713gate (with a comment why), so the other T8132 boards still refuse a firmware suspend with -EBUSY. Every T8132 board in the tree presents<1 2>today, so nothing changes on real hardware.tools/asahi: radio-sleep-snapshot-tests: follow the SIDs from apple,managed-sids: the host test's fixture follows the new field and checks SIDs other than 1 and 2.PCI: apple: radio: admit the host's other ports into the managed sleep: the managed contract is per port (the port whoseiommu-mapDART carriesapple,managed-sids). Other ports use ordinary RID-to-SID routing, and the transaction takes them down and brings them back after its own recovery, each DART behind its own port. The port bind is now lazy and all-or-none:device_link_remove(), the newapple_dart_clear_host_resumes(),put_device());PM_SUSPEND_PREPARE, which runs beforedpm_prepare(), so the device link still orders the sleep. While a port is still pending, prepare returns -EBUSY;arm64: dts: apple: t8132-j604: enable the SD card reader's port: port 2 anddart_apcie2on, bus 2 mapped to SID 1 ondart_apcie2(J604 ADT:pcie-sdreaderundermapper-apcie2, reg 1). The radio's mapping is unchanged:<0x100 &dart_apcie0 1 2>,apple,managed-sids = <1 2>.selftests: apple: bcm4377-radio-sids: follow the per-port managed flag: the test's fixture gets the port'smanagedflag that teardown now reads, and checks that a non-managed port of the same host (the SD reader's) masks its IRQ block on teardown.Why managed on the J604: we found no hardware reason the managed transaction can't serve it. The J604's ADT maps Wi-Fi to SID 1 and Bluetooth to SID 2 on
dart-apcie0, as the J713's does, with the SD reader on its own DART, and its radio is the same BCM4388 (14e4:4434, 14e4:5f72) the bind checks for.apple_t8132_managed_radio()still exists, but only for the radio's reg-on GPIO in gpio-macsmc and the DART's radio IRQ; it no longer decides which transaction runs.Not run on the J604 yet. The next measurement is a J604 deep-sleep row on a unit kernel that lets the J604 through the gate: 10 firmware deep-sleep cycles with Wi-Fi, BT and SD read-back after every wake. Until that row passes, the gate stays as it is. One difference from boot that we see in the code: the transaction's port restore writes 0xffffffff at port offset 0x104, where aura writes 0xfffffff0 on T8132, and it does not zero 0x3000-0x303c as aura does. The J713 wakes with it; we'll compare on the J604 before calling it a problem.
The earlier unmanaged version (2 commits) stays on our fork as
j604-pcie-radio-relink-sleep-unmanaged.Checked on top of
integration/aurora5b596e6:drivers/pci/controller/anddrivers/iommu/build with W=1, clang and gcc, with no warnings at the head, at the first commit and at the base;CHECK_DTBS, with the same warnings at the base and at the head (none new, none on the PCIe nodes);Not run: J604 or J713 hardware on this revision.