Files
geramyloveless c3c8521137 PCI restore puts back the BARs and MSI-X a device reset clears
A mode1 reset clears the GPU's configuration (BARs, command, MSI-X) and
nothing in macOS writes it again; upstream caches it before the reset
and restores it after (amdgpu_device_cache_pci_state/load_pci_state).
pci_restore_state refused any BAR change (-ESTALE, the transport-fault
latch) and never restored MSI-X, so a device reset could only end in a
quarantine.

The saved state now also holds the MSI-X capability's control word and
the table entries DriverKit programmed (read from the table's BAR
through the kernel, dext_pci_bar_read32), the vectors in use first.
Restore checks it is the same function with the same capability layout,
then writes back the header as the host assigned it (cache line and
latency, BAR0-5, the ROM BAR, the interrupt line) with memory decode off
until every BAR reads back its value, the PCIe controls, MSI-X (function
masked while the table is written, each entry verified, then the saved
control), and the command last. A BAR or table entry that does not take
its value fails the restore as before. The values are the host's own
assignment: nothing moves behind the host bridge.

test_pci_dext covers a reset that cleared the BARs, ROM and command, a
BAR that does not take its value, MSI-X saved and written back, and a
table entry that does not take its value.
2026-10-06 17:18:27 -07:00
..
2026-10-02 20:56:19 -07:00
2026-10-03 17:50:21 -07:00
2026-10-03 17:50:21 -07:00