[PATCH v2 0/3] ppc/pnv: Fix panics and refactor pnv_php.c

From: Aditya Gupta

Date: Wed May 27 2026 - 14:08:52 EST


Overview
========

Since below upstream commit, powernv systems get a panic during boot when an
OpenCAPI hotplug slot is detected:

commit 80f9fc2362797538ebd4fd70a1dfa838cc2c2cdb
Date: Tue Jul 15 16:36:55 2025 -0500

PCI: pnv_php: Work around switches with broken presence detection

The panic log is present in patch #1

Patch #1: Adds null checks around null pointer dereferences
Patch #2: Rework the driver code to separate PCIe-specific and common code
Patch #3 (optional): Group PCIe functionality together, only code movements

Note: Patch 1 is important and independent of the other patches

Note2: Patch 2 & 3 can be squashed into 1 commit. Intentionally kept patch #2 as
small as possible for ease of review.

Changelog
=========
v1 -> v2:
* Sashiko pointed out various null pointer dereferences including a kernel panic triggered by userspace, fixed them
* Add rework patches, so that PCIe-specific and common code can be separated
cleanly

Aditya Gupta (3):
ppc/pnv: Add null checks for OpenCapi PHBs
ppc/pnv: Refactor PNV PCI hotplug driver
ppc/pnv: Refactor PNV PCI Hotplug to group PCIe functions

arch/powerpc/include/asm/pnv-pci.h | 16 +
drivers/pci/hotplug/pnv_php.c | 554 ++++++++++++++++-------------
2 files changed, 328 insertions(+), 242 deletions(-)

--
2.54.0