public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Narayana Murty N <nnmlinux@linux•ibm.com>
To: mahesh@linux•ibm.com, maddy@linux•ibm.com, mpe@ellerman•id.au,
	christophe.leroy@csgroup•eu, gregkh@linuxfoundation•org,
	oohall@gmail•com, npiggin@gmail•com
Cc: linuxppc-dev@lists•ozlabs.org, linux-kernel@vger•kernel.org,
	tyreld@linux•ibm.com, vaibhav@linux•ibm.com, sbhat@linux•ibm.com,
	ganeshgr@linux•ibm.com, sourabhjain@linux•ibm.com,
	haren@linux•ibm.com, nnmlinux@linux•ibm.com, thuth@redhat•com
Subject: [PATCH v2 5/5] powerpc/powernv: Map EEH error types to OPAL error injection types
Date: Wed, 27 May 2026 12:54:33 +0530	[thread overview]
Message-ID: <20260527072433.94510-6-nnmlinux@linux.ibm.com> (raw)
In-Reply-To: <20260527072433.94510-1-nnmlinux@linux.ibm.com>

Add a mapping layer in pnv_eeh_err_inject() to translate generic EEH
error types to OPAL-specific error injection types. This decouples the
VFIO error injection interface from OPAL implementation details.

Map EEH_ERR_TYPE_32 to OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR and
EEH_ERR_TYPE_64 to OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64. Return -EINVAL
for unsupported error types.

This provides better abstraction between the generic EEH layer and
platform-specific implementation.

Signed-off-by: Narayana Murty N <nnmlinux@linux•ibm.com>
---
 arch/powerpc/include/uapi/asm/eeh.h          | 20 ++++++++++++++++++--
 arch/powerpc/platforms/powernv/eeh-powernv.c | 11 +++++++++--
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/uapi/asm/eeh.h b/arch/powerpc/include/uapi/asm/eeh.h
index 86645cab2827..d88d82796905 100644
--- a/arch/powerpc/include/uapi/asm/eeh.h
+++ b/arch/powerpc/include/uapi/asm/eeh.h
@@ -16,8 +16,24 @@
 #define EEH_PE_STATE_UNAVAIL		5	/* Unavailable		*/
 
 /* EEH error types and functions */
-#define EEH_ERR_TYPE_32			0       /* 32-bits error	*/
-#define EEH_ERR_TYPE_64			1       /* 64-bits error	*/
+#define EEH_ERR_TYPE_FATAL                  0x1   /* Fatal error */
+#define EEH_ERR_TYPE_RECOVERED_RANDOM       0x2   /* Recovered random event */
+#define EEH_ERR_TYPE_RECOVERED_SPECIAL      0x3   /* Recovered special event */
+#define EEH_ERR_TYPE_CORRUPTED_PAGE         0x4   /* Corrupted page */
+#define EEH_ERR_TYPE_CORRUPTED_SLB          0x5   /* Corrupted SLB */
+#define EEH_ERR_TYPE_TRANSLATOR_FAILURE     0x6   /* Translator failure */
+#define EEH_ERR_TYPE_32                     0x7   /* 32-bit IOA bus error */
+#define EEH_ERR_TYPE_PLATFORM_SPECIFIC      0x8   /* Platform specific */
+#define EEH_ERR_TYPE_CORRUPTED_DCACHE_START 0x9   /* Corrupted D-cache start */
+#define EEH_ERR_TYPE_CORRUPTED_DCACHE_END   0xA   /* Corrupted D-cache end */
+#define EEH_ERR_TYPE_CORRUPTED_ICACHE_START 0xB   /* Corrupted I-cache start */
+#define EEH_ERR_TYPE_CORRUPTED_ICACHE_END   0xC   /* Corrupted I-cache end */
+#define EEH_ERR_TYPE_CORRUPTED_TLB_START    0xD   /* Corrupted TLB start */
+#define EEH_ERR_TYPE_CORRUPTED_TLB_END      0xE   /* Corrupted TLB end */
+#define EEH_ERR_TYPE_64                     0xF   /* 64-bit IOA bus error */
+#define EEH_ERR_TYPE_UPSTREAM_IO_ERROR      0x10  /* Upstream IO error */
+
+/* EEH supported function types */
 #define EEH_ERR_FUNC_MIN		0
 #define EEH_ERR_FUNC_LD_MEM_ADDR	0	/* Memory load	*/
 #define EEH_ERR_FUNC_LD_MEM_DATA	1
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index db3370d1673c..ee156d397e93 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -1169,8 +1169,15 @@ static int pnv_eeh_err_inject(struct eeh_pe *pe, int type, int func,
 	struct pnv_phb *phb = hose->private_data;
 	s64 rc;
 
-	if (type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR &&
-	    type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64) {
+	/* Map generic EEH Type to OPAL Type */
+	switch (type) {
+	case EEH_ERR_TYPE_32:
+		type = OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR;
+		break;
+	case EEH_ERR_TYPE_64:
+		type = OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64;
+		break;
+	default:
 		pr_warn("%s: Invalid error type %d\n",
 			__func__, type);
 		return -ERANGE;
-- 
2.54.0



  parent reply	other threads:[~2026-05-27  7:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27  7:24 [PATCH v2 0/5] powerpc/pseries: Add full RTAS-based error injection support Narayana Murty N
2026-05-27  7:24 ` [PATCH v2 1/5] powerpc/rtas: Handle special return format for RTAS_FN_IBM_OPEN_ERRINJCT Narayana Murty N
2026-06-07 11:19   ` Sourabh Jain
2026-05-27  7:24 ` [PATCH v2 2/5] powerpc/pseries: Add RTAS error injection buffer infrastructure Narayana Murty N
2026-05-27  7:24 ` [PATCH v2 3/5] powerpc/pseries: Add RTAS error injection validation helpers Narayana Murty N
2026-06-07 12:17   ` Sourabh Jain
2026-05-27  7:24 ` [PATCH v2 4/5] powerpc/pseries: Implement RTAS error injection via pseries_eeh_err_inject Narayana Murty N
2026-06-07 13:35   ` Sourabh Jain
2026-05-27  7:24 ` Narayana Murty N [this message]
2026-06-07 13:46   ` [PATCH v2 5/5] powerpc/powernv: Map EEH error types to OPAL error injection types Sourabh Jain

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=20260527072433.94510-6-nnmlinux@linux.ibm.com \
    --to=nnmlinux@linux$(echo .)ibm.com \
    --cc=christophe.leroy@csgroup$(echo .)eu \
    --cc=ganeshgr@linux$(echo .)ibm.com \
    --cc=gregkh@linuxfoundation$(echo .)org \
    --cc=haren@linux$(echo .)ibm.com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=maddy@linux$(echo .)ibm.com \
    --cc=mahesh@linux$(echo .)ibm.com \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=npiggin@gmail$(echo .)com \
    --cc=oohall@gmail$(echo .)com \
    --cc=sbhat@linux$(echo .)ibm.com \
    --cc=sourabhjain@linux$(echo .)ibm.com \
    --cc=thuth@redhat$(echo .)com \
    --cc=tyreld@linux$(echo .)ibm.com \
    --cc=vaibhav@linux$(echo .)ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox