HomeFreeBSD

Use the correct address when creating pci resources

Description

Use the correct address when creating pci resources

When the PCI and CPU physical addresses are identical it doesn't matter
which is used to create the resources, however on some systems, e.g.
qemu armv7 virt, they are different. This leads to a panic as we try to
map the wrong physical address into the kernel address space.

Reported by: Jenkins via trasz
Sponsored by: Innovate UK

Details

Provenance
andrewAuthored on
Parents
rS362396: ZFS: Allow setting checksum=skein on boot pools
Branches
Unknown
Tags
Unknown

Event Timeline

This is now inconsistent with pci_host_generic_core_alloc_resource(). It seems to me that you are using the rman to manage PCI bus addresses, then trying to allocate CPU addresses out of that. When those ranges do not overlap, the allocation always fails.

Trying to place physical addresses in rman has other problems, e.g., I think somewhere we assume that PCI bridge window addresses will be 32 bits, which is fine but the CPU address may be offset from that above the 4 GB limit (as with the Pi4).

I think the right thing to do is to store the PCI addresses in the rman at the time of pci_host_generic_core_alloc_resource(), and then translate them to CPU addresses only in generic_pcie_activate_resource().

Potential resolution: https://reviews.freebsd.org/D25394