Skip to content

PCI: Resizable BAR improvements

Ilpo Järvinen amd-gfx dri-devel intel-gfx intel-xe linux-doc linux-pci lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest11 patches 1 replyIn review
  2. v311 patches 4 repliesApplied
  3. v211 patches 16 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v111 patches7 repliesSuperseded

Changes in v4 from the cover letter

- Rebased on top of pci/resource changes to solve conflicts

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11PCI: Move Resizable BAR code to rebar.cDocumentation/driver-api/pci/pci.rst drivers/pci/Makefile drivers/pci/pci.c +3 more+252 -2350 replies
2/11PCI: Clean up pci_rebar_bytes_to_size() and move to rebar.cdrivers/pci/rebar.c include/linux/pci.h+26 -70 replies
3/11PCI: Move pci_rebar_size_to_bytes() and export itdrivers/pci/pci.h drivers/pci/rebar.c include/linux/pci.h+13 -40 replies
4/11PCI: Improve Resizable BAR functions kernel docdrivers/pci/rebar.c+21 -140 replies
5/11PCI: Add pci_rebar_size_supported() helperdrivers/pci/iov.c drivers/pci/rebar.c include/linux/pci.h+21 -130 replies
6/11drm/i915/gt: Use pci_rebar_size_supported()drivers/gpu/drm/i915/gt/intel_region_lmem.c+3 -70 replies
7/11drm/xe/vram: Use PCI rebar helpers in resize_vram_bar()drivers/gpu/drm/xe/xe_vram.c+7 -120 replies
8/11PCI: Add pci_rebar_get_max_size()drivers/pci/rebar.c include/linux/pci.h+24 -00 replies
9/11drm/xe/vram: Use pci_rebar_get_max_size()drivers/gpu/drm/xe/xe_vram.c+7 -80 replies
10/11drm/amdgpu: Use pci_rebar_get_max_size()drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+5 -30 replies
11/11PCI: Convert BAR sizes bitmasks to u64drivers/gpu/drm/xe/xe_vram.c drivers/pci/iov.c drivers/pci/pci-sysfs.c +2 more+6 -60 replies

Reviews trailers per patch

All 11 patches have a Reviewed-by or Acked-by.

PatchChristian KönigMichael J. RuhlAndi ShytiJani NikulaRodrigo Vivi
1/11R-b
2/11R-b R-b
3/11R-b
4/11R-b
5/11R-b R-b
6/11A-b R-b R-b A-b
7/11A-b A-b
8/11R-b
9/11A-b A-b
10/11R-b
11/11R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/11] PCI: Resizable BAR improvements

pci.c has been used as catch everything that doesn't fits elsewhere within PCI core and thus resizable BAR code has been placed there as well. Move Resizable BAR related code to a newly introduced rebar.c to reduce size of pci.c. After move, there are no pci_rebar_*() calls from pci.c indicating this is indeed well-defined subset of PCI core.

Endpoint drivers perform Resizable BAR related operations which could well be performed by PCI core to simplify driver-side code. This series adds a few new API functions to that effect and converts the drivers to use the new APIs (in separate patches).

While at it, also convert BAR sizes bitmask to u64 as PCIe spec already specifies more sizes than what will fit u32 to make the API typing more future-proof. The extra sizes beyond 128TB are not added at this point.

Some parts of this are to be used by the resizable BAR changes into the resource fitting/assingment logic but these seem to stand on their own so sending these out now to reduce the size of the other patch series.

This v4 rebases what's currently in pci/rebar on top of the BAR resize changes in pci/resource as they'd have nasty conflicts otherwise so they can start to peacefully coexist in the pci/resource branch.

v4:
- Rebased on top of pci/resource changes to solve conflicts

v3: https://lore.kernel.org/linux-pci/[email protected]/
- Rebased to solve minor conflicts

v2: https://lore.kernel.org/linux-pci/[email protected]/
- Kerneldoc:
- Improve formatting of errno returns
- Open "ctrl" -> "control"
- Removed mislead "bit" words (when referring to BAR size)
- Rewrote pci_rebar_get_possible_sizes() kernel doc to not claim the returned bitmask is defined in PCIe spec as the capability bits now span across two registers in the spec and are not continuous (we
don't support the second block of bits yet, but this API is expected
to return the bits without the hole so it will not be matching with
the spec layout).
- Dropped superfluous zero check from pci_rebar_size_supported()
- Small improvement to changelog of patch 7

Ilpo Järvinen (11):
PCI: Move Resizable BAR code to rebar.c
PCI: Clean up pci_rebar_bytes_to_size() and move to rebar.c
PCI: Move pci_rebar_size_to_bytes() and export it
PCI: Improve Resizable BAR functions kernel doc
PCI: Add pci_rebar_size_supported() helper drm/i915/gt: Use pci_rebar_size_supported() drm/xe/vram: Use PCI rebar helpers in resize_vram_bar()
PCI: Add pci_rebar_get_max_size()
drm/xe/vram: Use pci_rebar_get_max_size() drm/amdgpu: Use pci_rebar_get_max_size()
PCI: Convert BAR sizes bitmasks to u64

 Documentation/driver-api/pci/pci.rst        |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  |   8 +-
 drivers/gpu/drm/i915/gt/intel_region_lmem.c |  10 +-
 drivers/gpu/drm/xe/xe_vram.c                |  32 +-
 drivers/pci/Makefile                        |   2 +-
 drivers/pci/iov.c                           |  10 +-
 drivers/pci/pci-sysfs.c                     |   2 +-
 drivers/pci/pci.c                           | 149 ---------
 drivers/pci/pci.h                           |   5 +-
 drivers/pci/rebar.c                         | 325 ++++++++++++++++++++
 drivers/pci/setup-res.c                     |  85 -----
 include/linux/pci.h                         |  15 +-
 12 files changed, 361 insertions(+), 285 deletions(-)
 create mode 100644 drivers/pci/rebar.c

base-commit: 5388d5c3a95dd4f28714a4689c2877ba8c990b6b

Signature · 1 line
2.39.5