PCI resource ALT allocation and resource allocation test module

Session information has not yet been published for this event.


One Line Summary

New resource ALT allocation (small size than alignment)
and test module for pci resource allocation.


Add alt_size resource allocation support

On system with several pcie switches, BIOS allocate very tight resources
to the bridge bar, and it is not aligned to min_align as kernel allocation

For example:

18:00.0 need 0×10000000, and 0×00010000.

BIOS only allocate 0×10100000 to 0d:04.0 and above bridges.
Later after using /sys/bus/pci/devices/0000:0c:00.0/remove to remove 0c:00.0,
rescan with /sys/bus/pci/rescan can not allocate 0×18000000 to 0c:00.0.
as current min_align solution will need 0×18000000.

Another example:

06:00.0 need 0×4000000 and 0×800000.

BIOS only allocate 0×4800000 to 05:19.0 and 04:00.0.
when 05:19.0 get removed via /sys/bus/pci/devices/0000:05:19.0/remove,
rescan with /sys/bus/pci/rescan will fail.
pci 0000:05:19.0: BAR 14: no space for [mem size 0×06000000]
pci 0000:05:19.0: BAR 14: failed to assign [mem size 0×06000000]
pci 0000:06:00.0: BAR 2: no space for [mem size 0×04000000 64bit]
pci 0000:06:00.0: BAR 2: failed to assign [mem size 0×04000000 64bit]
pci 0000:06:00.0: BAR 0: no space for [mem size 0×00800000]
pci 0000:06:00.0: BAR 0: failed to assign [mem size 0×00800000]
current code try to use align 0×2000000 and size 0×6000000, but parent
bridge only have 0×4800000.

Introduce alt_align/alt_size and store them in realloc list in addition
to addon info, and will try it after min_align/min_size allocation fails.

The alt_align is max_align, and alt_size is aligned size with bridge
minimum window alignment.

Add PCI_TEST module for resource allocation

Read from data file and mask file, to build simulated data, and have pci_ops
to use them.

Extract calling for pci_create_root_bus, scan_child_bus, resource survey
and resource assign … to see if those functions work as expected to
simulated data.

mask is with rw bits on pci registers, so we can make pci BAR sizing working.

It also support bus number assign-all.


PCI, alt-size, resource, allocation, test-module


  • Yinghai Lu



    Linux Bringup Engineer at Oracle.

    Contribute to kernel on x86 and PCI.