This patch series introduces RTAS-based PCI error injection infrastructure
for the QEMU pseries (sPAPR) platform. The goal is to enable QEMU to simulate
enhanced error handling (EEH) behavior for PCI devices using RTAS interfaces,
aligned with existing firmware (OPAL/RTAS) conventions on IBM Power systems.
The proposed implementation supports:
- Backend error injection via VFIO for passthrough PCI devices
- RTAS calls for injecting specific PCI errors (e.g., cache/TLB/bus errors)
- Controlled access to error injection via open/close RTAS calls
- Device Tree (DT) updates to advertise supported error injection tokens
This series tested on pseries host with kernel version v6.16.0-rc7
This series has been split into four self-contained patches for clarity:
Patch 1 introduces the VFIO error injection backend:
- Adds 'spapr_phb_vfio_errinjct()' which injects EEH-like faults
- Includes minimal enum definitions ('rtas_err_type', 'EEH_ERR_FUNC_...')
- Introduces stub and headers to integrate with the PHB VFIO path
Patch 2 implements the 'ibm,errinjct' RTAS call handler:
- Adds 'rtas_ibm_errinjct()' in spapr_pci.c
- Handles parameter parsing, validation, and backend call dispatch
- Registers the token in 'spapr_pci_rtas_init()'
Patch 3 adds support for session control:
- Introduces 'ibm,open-errinjct' and 'ibm,close-errinjct' handlers
- Tracks exclusive access using 'SpaprMachineState'
- Provides useful RTAS return codes for access errors
Patch 4 updates the device tree:
- Adds 'ibm,errinjct-tokens' under each PHB node
- Lists supported tokens for guest firmware/userspace to query
- Adds fallback blob support for token discovery
Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
---
Narayana Murty N (4):
ppc/spapr: Add VFIO EEH error injection backend
ppc/spapr: Add ibm,errinjct RTAS call handler
ppc/spapr: Add support for 'ibm,open-errinjct' and
'ibm,close-errinjct'
ppc/spapr: Advertise RTAS error injection call support via FDT
property
include/hw/pci-host/spapr.h | 7 ++
include/hw/ppc/spapr.h | 56 ++++++++-
hw/ppc/spapr.c | 106 +++++++++++++++++
hw/ppc/spapr_pci.c | 220 ++++++++++++++++++++++++++++++++++++
hw/ppc/spapr_pci_vfio.c | 53 +++++++++
5 files changed, 441 insertions(+), 1 deletion(-)
--
2.51.0