[PATCH 0/3] PCI/IOV: Restore initial VF BAR sizing after VF ReBAR

From: Marcin Bernatowicz

Date: Tue May 05 2026 - 13:00:40 EST


PF drivers can resize a VF BAR using VF Resizable BAR (ReBAR) support via
pci_iov_vf_bar_set_size(). The new size persists in the SR-IOV capability
config space. A later reprobe / unplug-rescan / next pci_enable_sriov()
then sees the inflated VF BAR registers, and the PCI core reserves MMIO
based on that size multiplied by TotalVFs.

On platforms with tight apertures, this can make subsequent SR-IOV enable
fail due to lack of address space.

This series records the initial per-VF BAR sizes during SR-IOV init and
restores those sizes when SR-IOV is disabled, when SR-IOV enable fails,
or when the PF driver is unbound.

Note on user-visible behavior: drivers that rely on a resized VF BAR
persisting across an enable/disable cycle must now call
pci_iov_vf_bar_set_size() again before each pci_enable_sriov().

Marcin Bernatowicz (3):
PCI/IOV: Remember initial VF BAR sizes
PCI/IOV: Restore initial VF ReBAR sizes on SR-IOV disable/failure
PCI/IOV: Restore initial VF ReBAR sizes on PF release

drivers/pci/iov.c | 64 +++++++++++++++++++++++++++++++++++++++++------
drivers/pci/pci.h | 3 ++-
2 files changed, 59 insertions(+), 8 deletions(-)

--
2.43.0