Page MenuHomeFreeBSD

pci: split host bridge mmio around reserved holes
Needs ReviewPublic

Authored by jtranoleary_google.com on Thu, Sep 17, 6:10 PM.

Details

Reviewers
jhb
markj
kevans
Summary

Generic PCIe host bridges decode MMIO windows defined by platform
firmware (via ACPI _CRS or FDT ranges). If any preexisting platform
reservation occupies space within a bridge's decoded window, the parent
bus resource allocation fails completely. Because the host bridge cannot
allocate its window, downstream PCI devices are unable to map their
BARs, leading to driver attach failures and boot panics.

Resolve this by allowing generic host bridges to allocate parent bus
resources around reserved holes.

First, add rman_first_free_subregion() in subr_rman.c to locate the
first available unallocated sub-interval within a target range.

Second, in pci_host_generic.c, split parent physical allocations into
discrete chunks around reserved holes, while keeping the full window
in the bridge's rman so downstream PCI decoding remains intact. Record
reserved holes as unallocated placeholders for address translation.

Third, in generic_pcie_map_resource() and generic_pcie_unmap_resource(),
look up the containing range using the requested sub-range rather than
the full parent resource.

Finally, fix rman_adjust_resource() to correctly handle discontiguous
rmans.

While this issue was diagnosed on Google Cloud C4A (Axion) ARM64
bare metal instances, this condition can occur on any system topology
where platform firmware places static reservations within a PCIe host
bridge window.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped