Re: [PATCH v2 2/3] PCI/IOV: Restore initial VF ReBAR sizes on SR-IOV disable/failure

[email protected] Mon, 03 Aug 2026 10:46:56 +0000
Newsgroups org.kernel.vger.linux-pci
Message-ID <[email protected]>
> PF drivers can resize a VF BAR via pci_iov_vf_bar_set_size(). The new
> size persists in config space. A subsequent reprobe/unplug-rescan may
> then cause the PCI core to reserve MMIO based on the inflated VF BAR
> registers in the SR-IOV capability, often multiplied by TotalVFs.
> On platforms with tight apertures, later SR-IOV enable can fail due to
> lack of space.
>=20
> Restore the initial VF BAR sizes saved at SR-IOV init time when SR-IOV
> is disabled and when SR-IOV enable fails. This covers both the resource
> allocation failures later in sriov_enable() and the earlier validation
> failures that can otherwise leave a resized VF BAR in hardware while
> num_VFs remains zero.
>=20
> Restore is only performed when VF Memory Space is disabled, which is the
> precondition of pci_iov_vf_bar_set_size() and is true at all the new
> call sites.
>=20
> Note: this changes user-visible behavior for drivers that rely on the
> resized VF BAR persisting across an enable/disable cycle. After this
> change drivers must call pci_iov_vf_bar_set_size() before each
> pci_enable_sriov() if a non-default size is desired.
>=20
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/5937
> Signed-off-by: Marcin Bernatowicz <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260803103007.2096=
[email protected]?part=3D2