Re: [PATCH v1] sysfs: Include bridge window address size flags

From: David Matlack

Date: Tue Jun 30 2026 - 16:30:31 EST


On Fri, Jun 26, 2026 at 2:31 PM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:
>
> sysfs_get_resources() fills d->base_addr[] with CPU addresses of PCI BARs
> (the CPU addresses in sysfs 'resource' differ from the BARs when a host
> bridge applies an offset between CPU and PCI addresses).
>
> 119c1376f9ca ("libpci: Add support for filling bridge resources") fills
> d->bridge_base_addr[] for bridge windows, but unlike for d->base_addr[], it
> did not include the low-order four bits of 'flags'. For I/O windows, those
> bits indicate 16- or 32-bit addressing; for prefetchable memory windows,
> they indicate 32- or 64-bit addressing.
>
> ccf68033a452 ("lspci: Use PCI_FILL_BRIDGE_BASES to detect if range behind
> bridge is disabled or unsupported") tests the d->bridge_base_addr[] flag
> bits to learn those properties, but since they weren't included by
> 119c1376f9ca, 32-bit I/O windows were labeled as "[16-bit]" and 64-bit
> prefetchable windows were labeled as "[32-bit]".
>
> Previous output of "lspci -v" on a bridge:
>
> I/O behind bridge: 2000-2fff [size=4K] [16-bit]
> Prefetchable memory behind bridge: 48030000000-480401fffff [size=258M] [32-bit]
>
> Similar output after this commit:
>
> I/O behind bridge: 00002000-00002fff [size=4K] [32-bit]
> Prefetchable memory behind bridge: 0000048030000000-00000480401fffff [size=258M] [64-bit]
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>

Thanks for the fix!

Tested-by: David Matlack <dmatlack@xxxxxxxxxx>