All of lore.kernel.org
 help / color / mirror / Atom feed
From: Narayana Murty N <nnmlinux@linux.ibm.com>
To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, mahesh@linux.ibm.com,
	sbhat@linux.ibm.com, anushree.mathur@linux.vnet.ibm.com,
	clg@redhat.com, sourabhjain@linux.ibm.com, adityag@linux.ibm.com,
	nikhilks@linux.ibm.com
Cc: pierrick.bouvier@oss.qualcomm.com, rathc@linux.ibm.com,
	npiggin@gmail.com,  harshpb@linux.ibm.com,
	amachhiw@linux.ibm.com, hbathini@linux.ibm.com,
	shivangu@linux.ibm.com
Subject: [PATCH v4 0/6] ppc/spapr: Add RTAS error injection support for VFIO EEH
Date: Mon, 31 Aug 2026 12:49:52 +0530	[thread overview]
Message-ID: <20260831071958.58824-1-nnmlinux@linux.ibm.com> (raw)

This patch series implements comprehensive RTAS-based error injection
support for VFIO EEH (Enhanced Error Handling) on PowerPC sPAPR platforms.
The implementation enables guest-initiated PCI error injection for improved
testing and diagnostics of EEH recovery mechanisms.

Background
----------
EEH is a critical feature on PowerPC platforms that provides error detection,
isolation, and recovery for PCI devices. Testing EEH recovery paths requires
the ability to inject various types of errors into the system. While physical
hardware supports error injection through firmware interfaces, QEMU's VFIO
implementation previously lacked this capability.

This series bridges that gap by implementing the IBM RTAS error injection
interface, allowing guests to inject PCI errors through the same firmware
calls used on physical hardware. This enables comprehensive testing of device
drivers' EEH recovery code paths in virtualized environments.

Implementation Overview
-----------------------
The patch series introduces three new RTAS calls:
  - ibm,open-errinjct:  Opens an error injection session
  - ibm,errinjct:       Injects a specific error type
  - ibm,close-errinjct: Closes the error injection session

The implementation supports multiple error types including:
  - IOA bus errors (32-bit and 64-bit addressing)

For IOA bus-error types, QEMU uses the BUID from the RTAS parameter buffer to
select the target PHB. For address-scoped IOA injections, QEMU translates the
guest BAR address to the corresponding host resource address before invoking
the VFIO EEH backend.

RTAS IOA error types are converted to the EEH type values expected by
VFIO_EEH_PE_INJECT_ERR:

 - RTAS_ERR_TYPE_IOA_BUS_ERROR    -> EEH_ERR_TYPE_32
 - RTAS_ERR_TYPE_IOA_BUS_ERROR_64 -> EEH_ERR_TYPE_64

Requests with addr=0 and mask=0 are treated as non-address-scoped IOA
injections and are forwarded without address translation.

Non-IOA RTAS error types are parsed and validated, but return
RTAS_OUT_NOT_SUPPORTED in this series because their RTAS work buffers do not
carry enough target information to safely select a VFIO PE.

Tested on pseries and PowerNV hosts with KVM guests using the powerpc-utils
errinjct tool.
Kernel side EEH patch v4:
https://lore.kernel.org/all/20260831065441.48654-1-nnmlinux@linux.ibm.com/

Patch Organization
------------------
Patch 1: Adds the VFIO backend for error injection
Patch 2: Implements the ibm,errinjct RTAS call handler
Patch 3: Adds session management (open/close) RTAS calls
Patch 4: Advertises capabilities via device tree properties
Patch 5: Refactors EEH specific code/stubs to new files.
Patch 6: Updates MAINTAINERS file

Changelog:
----------
v4: 
  - Removed the first-PHB assumption in ibm,errinjct.
  - Use BUID from the IOA RTAS parameter buffer to select the target PHB.
  - Added guest BAR to host resource address translation for address-scoped
  IOA injections.
  - Skip address translation for addr=0 and mask=0 IOA requests.
  - Convert RTAS IOA error types to VFIO EEH type values before issuing
  VFIO_EEH_PE_INJECT_ERR.
  - Keep spapr_phb_vfio_errinjct() signature unchanged.
  - Validate non-IOA RTAS error types but return RTAS_OUT_NOT_SUPPORTED.
  - Removed host /proc/device-tree/rtas/ibm,errinjct-tokens probing.
  - Always build the guest-facing ibm,errinjct-tokens blob in QEMU.
  - Fixed ibm,open-errinjct return-cell layout on error paths.
  - Fixed ibm,close-errinjct token validation when no session is open.
  - Initialized errinject_tokens to NULL.
  - Removed stale CONFIG_DEVICES include after dropping the associated ifdefs
  - Renamed the split EEH file to hw/ppc/spapr_eeh.c.
  - Added Pierrick's Reviewed-by tag on the refactor patch.
  - Adding self as sPAPR EEH reviewer.
v3: 
  - Fixed the build failure reported at https://github.com/p-b-o/qemu-ci/actions/runs/26094993976
  - Also fixed a gitlab CI breakage in patch 2 (qemu_log_mask LOG_UNIMP)
v2: Addressed refactor suggestions from Cedric, Pierrick
v1: https://lore.kernel.org/all/20260512071112.9675-1-nnmlinux@linux.ibm.com/

Narayana Murty N (6):
  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
  ppc/spapr: Split VFIO EEH support from general VFIO code
  MAINTAINERS: Add self as sPAPR EEH reviewer under PPC RAS

 MAINTAINERS                 |   3 +-
 hw/ppc/meson.build          |   6 +-
 hw/ppc/spapr.c              |  61 ++++
 hw/ppc/spapr_eeh.c          | 572 ++++++++++++++++++++++++++++++++++++
 hw/ppc/spapr_pci.c          | 192 ++++++++++++
 hw/ppc/spapr_pci_vfio.c     | 317 ++------------------
 include/hw/pci-host/spapr.h |  19 ++
 include/hw/ppc/spapr.h      |  69 ++++-
 8 files changed, 936 insertions(+), 303 deletions(-)
 create mode 100644 hw/ppc/spapr_eeh.c

-- 
2.54.0



             reply	other threads:[~2026-08-31  7:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  7:19 Narayana Murty N [this message]
2026-08-31  7:19 ` [PATCH v4 1/6] ppc/spapr: Add VFIO EEH error injection backend Narayana Murty N
2026-08-31  7:19 ` [PATCH v4 2/6] ppc/spapr: Add ibm,errinjct RTAS call handler Narayana Murty N
2026-08-31  7:19 ` [PATCH v4 3/6] ppc/spapr: Add support for ibm, open-errinjct and ibm, close-errinjct Narayana Murty N
2026-08-31  7:19 ` [PATCH v4 4/6] ppc/spapr: Advertise RTAS error injection call support via FDT property Narayana Murty N
2026-08-31  7:19 ` [PATCH v4 5/6] ppc/spapr: Split VFIO EEH support from general VFIO code Narayana Murty N
2026-08-31  7:19 ` [PATCH v4 6/6] MAINTAINERS: Add self as sPAPR EEH reviewer under PPC RAS Narayana Murty N
2026-08-31 11:56   ` Cédric Le Goater
2026-08-31 14:22     ` Narayana Murty N

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260831071958.58824-1-nnmlinux@linux.ibm.com \
    --to=nnmlinux@linux.ibm.com \
    --cc=adityag@linux.ibm.com \
    --cc=amachhiw@linux.ibm.com \
    --cc=anushree.mathur@linux.vnet.ibm.com \
    --cc=clg@redhat.com \
    --cc=harshpb@linux.ibm.com \
    --cc=hbathini@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=nikhilks@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rathc@linux.ibm.com \
    --cc=sbhat@linux.ibm.com \
    --cc=shivangu@linux.ibm.com \
    --cc=sourabhjain@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.