Page MenuHomeFreeBSD

pci_iov: Reuse downstream bridge bus window if it already covers VF bus
AcceptedPublic

Authored by chandrakanth.patil_broadcom.com on Aug 26 2025, 8:11 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 30, 6:58 AM
Unknown Object (File)
Nov 26 2025, 11:09 AM
Unknown Object (File)
Nov 23 2025, 4:40 AM
Unknown Object (File)
Nov 9 2025, 8:34 AM
Unknown Object (File)
Nov 9 2025, 8:34 AM
Unknown Object (File)
Nov 9 2025, 4:33 AM
Unknown Object (File)
Nov 7 2025, 12:40 AM
Unknown Object (File)
Nov 6 2025, 2:53 AM
Subscribers
None

Details

Summary

If the parent bridge's [secondary, subordinate] window already covers
the VF bus (e.g., programmed by BIOS or a prior PF), skip allocating
PCI_RES_BUS. This avoids a duplicate rman allocation in the multi-PF
case while still allocating when growth is actually needed.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

I need to think about this. I don't really want to have the PCI bus directly reading the config registers from the parent bridge. It's also true that you want to not release the bus until all VFs using that bus have been torn down, so you really kind of want a refcounted bus_alloc_resource here (in essence). It might be that just switching from RF_ACTIVE to RF_SHAREABLE when calling bus_alloc_resource is sufficient however.

In D52163#1195416, @jhb wrote:

I need to think about this. I don't really want to have the PCI bus directly reading the config registers from the parent bridge. It's also true that you want to not release the bus until all VFs using that bus have been torn down, so you really kind of want a refcounted bus_alloc_resource here (in essence). It might be that just switching from RF_ACTIVE to RF_SHAREABLE when calling bus_alloc_resource is sufficient however.

ok. I tried with "RF_SHAREABLE" but still the "bus_alloc_resource" was returning NULL for VFs created on other PFs.

Hi John,
I wanted to check if there are any updates on the suggestion I had asked.

Hi john,

Please share your inputs on this. We have added the code and tested it for a couple of months and it is working as expected. I would appreciate your review and go-ahead.

This revision is now accepted and ready to land.Fri, Jan 30, 6:58 AM