Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH v6 0/4] PCI: Fix isolated function probing and enable ARI for s390
@ 2026-12-04 14:14 Niklas Schnelle
  2026-12-04 14:14 ` [PATCH v6 1/4] jailhouse: Fix leak of device node in jailhouse_paravirt() on non-x86 Niklas Schnelle
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Niklas Schnelle @ 2026-12-04 14:14 UTC (permalink / raw)
  To: Bjorn Helgaas, Huacai Chen, Jan Kiszka, Rob Herring
  Cc: Juergen Gross, Ajay Kaher, Alexey Makhalov,
	Broadcom internal kernel review list, Thomas Gleixner,
	Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Bibo Mao, linux-s390, loongarch,
	Farhan Ali, Matthew Rosato, Tianrui Zhao, Gerald Schaefer,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Sven Schnelle,
	Christian Borntraeger, Gerd Bayer, linux-s390, linux-pci,
	virtualization, x86, Niklas Schnelle

Hi Bjorn, Hi Huacai,

This series originally aimed to correctly detect ARI as being used on
s390. I had missed however that this breaks the isolated function
probing because the ARI chain may be broken due to only a subset of the
chain being passed through. So instead of following ARI chains simply
probe all possible functions blindly. On platforms with virtualized
config space accesses this is generally safe and on s390 at least, it is
also fast as config access for non-existent functions gets
short-circuited..

Besides the effect on s390 moving ari_enabled to the bus should also
ensure that VFs on a virtual bus created via virtfn_add_bus() correctly
present ARI as enabled. Sadly, I don't have access to any affected
device to test this.

In v5 it turned out however that this breaks Loongson systems with
hidden functions which must not be touched. So now the first patch
detangles the LoongArch bare metal use case for handling missing
function 0 from the hypervisor use case and drop LoongArch's claim
for the latter.

If LoongArch still requires the hypervisor use-case too we could add
a virtualization check in hypervisor_isolated_pci_functions() and get
the existing behavior on bare metal and blind probing in VMs where it is
safe but so far I could not find evidence that LoongArch actually relies
on the hypervisor use case.

Note on Testing: 
- Tested on a Xeon Sapphire Rapids x86_64 system with both as is and
  with a temporary hack to return true from
  hypervisor_isolated_pci_functions(). 
- Tested on s390 as is and with a temporary disable of the special
  handling of VFs with their parent PF not visible introduced by commit
  25f39d3dcb48 ("s390/pci: Ignore RID for isolated VFs")
- I need help testing on Loongson as I don't have the hardware

Thanks,
Niklas

Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Changes in v6:
- Detangle LoongArch's missing function 0 from the use of
  hypervisor_isolated_pci_functions()
- On s390 don't disable ARI on a bus just because one device
  doesn't have the capability, ARI is always enabled.
- Add a leak fix for jailhouse_paravirt() on non-x86
  found by LLM review.
- Link to v5: https://lore.kernel.org/r/20251029-ari_no_bus_dev-v5-0-d9a5eab67ed0@linux.ibm.com

Changes in v5:
- Rename variables to match "fn" abbreviation
- Add Cc stable
- Rebase on v6.18-rc3
- Link to v4: https://lore.kernel.org/r/20251023-ari_no_bus_dev-v4-0-8482e2ed10bd@linux.ibm.com

---
Niklas Schnelle (4):
      jailhouse: Fix leak of device node in jailhouse_paravirt() on non-x86
      PCI: loongson: Handle missing function 0 explicitly not via isolated functions
      PCI: Fix isolated PCI function probing with ARI and SR-IOV
      PCI: s390: Handle ARI on bus without associated struct pci_dev

 arch/s390/pci/pci_bus.c               |  9 ++++++++-
 drivers/pci/controller/pci-loongson.c | 16 +++++++++++++++
 drivers/pci/pci.c                     |  4 ++--
 drivers/pci/probe.c                   | 38 ++++++++++++++++++++++-------------
 include/linux/hypervisor.h            |  7 +++----
 include/linux/pci.h                   |  5 +++--
 6 files changed, 56 insertions(+), 23 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20240724-ari_no_bus_dev-52b2a27f3466

Best regards,
-- 
Niklas Schnelle


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-12-04 15:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 14:14 [PATCH v6 0/4] PCI: Fix isolated function probing and enable ARI for s390 Niklas Schnelle
2026-12-04 14:14 ` [PATCH v6 1/4] jailhouse: Fix leak of device node in jailhouse_paravirt() on non-x86 Niklas Schnelle
2026-12-04 14:14 ` [PATCH v6 2/4] PCI: loongson: Handle missing function 0 explicitly not via isolated functions Niklas Schnelle
2026-12-04 14:45   ` sashiko-bot
2026-12-04 14:14 ` [PATCH v6 3/4] PCI: Fix isolated PCI function probing with ARI and SR-IOV Niklas Schnelle
2026-12-04 15:02   ` sashiko-bot
2026-12-04 14:14 ` [PATCH v6 4/4] PCI: s390: Handle ARI on bus without associated struct pci_dev Niklas Schnelle
2026-12-04 15:25   ` sashiko-bot
2026-12-04 15:25 ` [PATCH v6 0/4] PCI: Fix isolated function probing and enable ARI for s390 sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox