Skip to content

RFC ppc/spapr: Add support for RTAS PCI error injection on pseries

Narayana Murty N qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4ppc/spapr: Add VFIO EEH error injection backendhw/ppc/spapr_pci_vfio.c include/hw/pci-host/spapr.h include/hw/ppc/spapr.h+104 -00 replies
2/4ppc/spapr: Add ibm,errinjct RTAS call handlerhw/ppc/spapr_pci.c include/hw/ppc/spapr.h+160 -10 replies
3/4ppc/spapr: Add support for 'ibm, open-errinjct' and 'ibm, close-errinjct'hw/ppc/spapr_pci.c include/hw/ppc/spapr.h+72 -10 replies
4/4ppc/spapr: Advertise RTAS error injection call support via FDT propertyhw/ppc/spapr.c+106 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC 0/4] ppc/spapr: Add support for RTAS PCI error injection on pseries

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

---
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(-)
Signature · 1 line
2.51.0