Skip to content

Allow custom PCI resource alignment on pseries

Shawn Anastasio linux-pci linuxppc-dev lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 15 repliesIn review
  2. v23 patches 0 repliesSuperseded
  3. v1 posting 2/23 patches 3 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 posting 1/23 patches0 repliesSuperseded

Changes in v3 from the cover letter

- Fix wrong return type of ppc pcibios_ignore_alignment_request (Not sure how my local compile didn't catch that!)

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3PCI: Introduce pcibios_ignore_alignment_requestdrivers/pci/pci.c include/linux/pci.h+8 -214 replies
2/3powerpc/64: Enable pcibios_after_init hook on ppc64arch/powerpc/include/asm/machdep.h arch/powerpc/kernel/pci_64.c+5 -20 replies
3/3powerpc/pseries: Allow user-specified PCI resource alignment after initarch/powerpc/include/asm/machdep.h arch/powerpc/kernel/pci-common.c arch/powerpc/platforms/pseries/setup.c+34 -01 reply

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/3] Allow custom PCI resource alignment on pseries

Changes from v2 to v3:
- Fix wrong return type of ppc pcibios_ignore_alignment_request (Not sure how my local compile didn't catch that!)

Hello all,

This patch set implements support for user-specified PCI resource alignment on the pseries platform for hotplugged PCI devices. Currently on pseries, PCI resource alignments specified with the pci=resource_alignment commandline argument are ignored, since the firmware is in charge of managing the PCI resources. In the case of hotplugged devices, though, the kernel is in charge of configuring the resources and should obey alignment requirements.

The current behavior of ignoring the alignment for hotplugged devices results in sub-page BARs landing between page boundaries and becoming un-mappable from userspace via the VFIO framework. This issue was observed on a pseries KVM guest with hotplugged ivshmem devices.

With these changes, users can specify an appropriate pci=resource_alignment argument on boot for devices they wish to use with VFIO.

In the future, this could be extended to provide page-aligned resources by default for hotplugged devices, similar to what is done on powernv by commit 382746376993 ("powerpc/powernv: Override pcibios_default_alignment() to force PCI devices to be page aligned").

Feedback is appreciated.

Thanks,
Shawn

Shawn Anastasio (3):
PCI: Introduce pcibios_ignore_alignment_request powerpc/64: Enable pcibios_after_init hook on ppc64 powerpc/pseries: Allow user-specified PCI resource alignment after
init

 arch/powerpc/include/asm/machdep.h     |  6 ++++--
 arch/powerpc/kernel/pci-common.c       |  9 +++++++++
 arch/powerpc/kernel/pci_64.c           |  4 ++++
 arch/powerpc/platforms/pseries/setup.c | 22 ++++++++++++++++++++++
 drivers/pci/pci.c                      |  9 +++++++--
 include/linux/pci.h                    |  1 +
 6 files changed, 47 insertions(+), 4 deletions(-)
Signature · 1 line
2.20.1