Hi Sourabh,
On 07/06/26 7:16 PM, Sourabh Jain wrote:
With the cover letter, this patch series seems to be about RTAS/pseries.
I am not able to understand why powernv changes are part of this
patch series. Could you please explain why they are included here?
Thanks for raising this.
Although most of the series implements RTAS error injection for pseries,
it also updates the generic EEH error types used through the
|VFIO_EEH_PE_INJECT_ERR|interface.
Userspace passes the generic |EEH_ERR_TYPE_32|or |EEH_ERR_TYPE_64|value
through VFIO.
On PowerNV, |pnv_eeh_err_inject()|must translate that generic EEH value
to the corresponding
platform-specific value:
|EEH_ERR_TYPE_32 -> OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR EEH_ERR_TYPE_64 ->
OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64|
Without this translation, the generic error types introduced for the
VFIO/EEH interface would
be passed directly to OPAL and could be interpreted incorrectly.
I have clarified this dependency in the v3 cover letter and PowerNV
patch description:
[PATCH v3 5/5] powerpc/powernv: Map generic EEH error types to OPAL types
Thanks,
Narayana
On 27/05/26 12:54, Narayana Murty N wrote:
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 <[email protected]>
---
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;