]> www.infradead.org Git - users/jedix/linux-maple.git/commit
PCI: Fix BAR resizing when VF BARs are assigned
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 20 Mar 2025 14:28:37 +0000 (16:28 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 20 Mar 2025 21:44:11 +0000 (16:44 -0500)
commit9ec19bfa78bd788945e2445b09de7b4482dee432
tree7e1d4e6c0a5bcb1b6d9d935efcac07b2c7d0cfc6
parente4cb29386ffc1d12885e412232adf361c77a93ac
PCI: Fix BAR resizing when VF BARs are assigned

__resource_resize_store() attempts to release all resources of the device
before attempting the resize. The loop, however, only covers standard BARs
(< PCI_STD_NUM_BARS). If a device has VF BARs that are assigned,
pci_reassign_bridge_resources() finds the bridge window still has some
assigned child resources and returns -NOENT which makes
pci_resize_resource() to detect an error and abort the resize.

Change the release loop to cover all resources up to VF BARs which allows
the resize operation to release the bridge windows and attempt to assigned
them again with the different size.

If SR-IOV is enabled, disallow resize as it requires releasing also IOV
resources.

Link: https://lore.kernel.org/r/20250320142837.8027-1-ilpo.jarvinen@linux.intel.com
Fixes: 91fa127794ac ("PCI: Expose PCIe Resizable BAR support via sysfs")
Reported-by: Michał Winiarski <michal.winiarski@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
drivers/pci/pci-sysfs.c