Skip to content

PCI/IOV: Restore initial VF BAR sizing after VF ReBAR

Marcin Bernatowicz intel-xe linux-pci lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 2 repliesIn review
  2. v13 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- 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().

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3PCI/IOV: Remember initial VF BAR sizesdrivers/pci/iov.c drivers/pci/pci.h+3 -10 replies
2/3PCI/IOV: Restore initial VF ReBAR sizes on SR-IOV disable/failuredrivers/pci/iov.c+68 -110 replies
3/3PCI/IOV: Restore initial VF ReBAR sizes on PF driver removedrivers/pci/iov.c+5 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

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

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(-)
Signature · 1 line
2.43.0