Hi, In v4, the approach to extending the BAR was changed to follow the suggestion from Christian. The control is now entirely on the driver side, with PCI subsystem checking whether the resource fits during VF enabling. I also added helpers to move between IOV / BAR # (suggested by Ilpo), since the ifdefs started to look mighty ugly after addressing some of the review feedback. v3 can be found here: https://lore.kernel.org/dri-devel/20241010103203.382898-1-michal.winiarski@xxxxxxxxx/ For regular BAR, drivers can use pci_resize_resource to resize it to the desired size provided that it is supported by the hardware, which the driver can query using pci_rebar_get_possible_sizes. This series expands the API to work with IOV BAR as well. It also adds the additional API for drivers to change the VF BAR size without resizing the entire underlying reservation (within the original resource boundary). Thanks, -Michał v1 -> v2: - Add pci_iov_resource_extend() and usage in Xe driver - Reduce the number of ifdefs (Christian) - Drop patch 2/2 from v1 (Christian) - Add a helper to avoid upsetting static analysis tools (Krzysztof) v2 -> v3: - Extract introducing pci_resource_is_iov to separate commit and use it elsewhere in PCI subsystem (Christian) - Extract restoring VF rebar state to separate commit (Christian) - Reorganize memory decoding check (Christian) - Don't use dev_WARN (Ilpo) - Fix build without CONFIG_PCI_IOV (CI) v3 -> v4: - Change the approach to extending the BAR (Christian) - Tidy the commit messages, use 80 line limit where necessary (Bjorn) - Add kerneldocs to exported functions (Bjorn) - Add pci_resource_to_iov() / pci_resource_from_iov() helpers (Ilpo) - Use FIELD_GET(), tidy whitespace (Ilpo) Michał Winiarski (7): PCI/IOV: Restore VF resizable BAR state after reset PCI: Add a helper to identify IOV resources PCI: Add a helper to convert between standard and IOV resources PCI: Allow IOV resources to be resized in pci_resize_resource() PCI/IOV: Check that VF BAR fits within the reservation PCI: Allow drivers to control VF BAR size drm/xe/pf: Set VF LMEM BAR size drivers/gpu/drm/xe/regs/xe_bars.h | 1 + drivers/gpu/drm/xe/xe_pci_sriov.c | 22 +++++ drivers/pci/iov.c | 158 +++++++++++++++++++++++++++--- drivers/pci/pci.c | 10 +- drivers/pci/pci.h | 45 ++++++++- drivers/pci/setup-bus.c | 9 +- drivers/pci/setup-res.c | 40 ++++++-- include/linux/pci.h | 6 ++ include/uapi/linux/pci_regs.h | 1 + 9 files changed, 261 insertions(+), 31 deletions(-) -- 2.47.0