[PATCH v2 0/3] PCI/IOV: Restore initial VF BAR sizing after VF ReBAR
Marcin Bernatowicz <[email protected]> Mon, 3 Aug 2026 12:30:04 +0200
| Newsgroups | org.freedesktop.lists.intel-xe,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
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 detached. 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(). v1 -> v2: - Addressed sashiko-bot feedback. - Restore VF BAR sizes on early sriov_enable() validation failures too. - Move the detach-time restore from sriov_release() to pci_iov_remove(). 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 driver remove drivers/pci/iov.c | 86 ++++++++++++++++++++++++++++++++++++++++------- drivers/pci/pci.h | 3 +- 2 files changed, 76 insertions(+), 13 deletions(-) -- 2.43.0