From: Narayana Murty N <nnmlinux@linux.ibm.com>
To: Sourabh Jain <sourabhjain@linux.ibm.com>,
Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
"Oliver O'Halloran" <oohall@gmail.com>,
Timothy Pearson <tpearson@raptorengineering.com>,
Alex Williamson <alex@shazbot.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <chleroy@kernel.org>,
Ritesh Harjani <ritesh.list@gmail.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, sbhat@linux.ibm.com, harshpb@linux.ibm.com
Subject: Re: [PATCH v6 5/5] powerpc/powernv/eeh: Map generic EEH error types to OPAL
Date: Fri, 20 Nov 2026 13:09:10 +0530 [thread overview]
Message-ID: <9efa20ba-d79b-47b8-9677-474c19aa9168@linux.ibm.com> (raw)
In-Reply-To: <2ed69cf8-eca2-41ed-a100-844f9d84c2ad@linux.ibm.com>
Hi Sourabh,
On 19/11/26 1:11 AM, Sourabh Jain wrote:
> Hello Narayana,
>
> For my understanding, could you clarify why this change is needed as
> part of this series?
> The series is about enabling RTAS-based error injection, and PowerNV
> doesn't support RTAS.
> How does this change fit with the earlier patches in the series?
>
The intention was to decouple the generic EEH error types from the
platform-specific OPAL encodings, similar to the explicit mapping
introduced for pSeries.
However, the generic EEH error-type values remain unchanged, and
the PowerNV mapping is not a prerequisite for RTAS-based error
injection.
I'll drop this patch from the next revision and will post it as seperate
patch.
Thanks,
Narayana Murty.
> On 23/10/26 13:06, Narayana Murty N wrote:
>> eeh_pe_inject_err() is called with generic EEH error types defined in
>> the VFIO/EEH userspace ABI (EEH_ERR_TYPE_32, EEH_ERR_TYPE_64). The
>> PowerNV backend previously compared these generic values directly against
>> OPAL firmware constants (OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR and
>> OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64).
>>
>> This is fragile: it relies on the generic EEH ABI values being
>> numerically identical to OPAL-specific values, and would silently
>> misbehave if they ever diverged.
>>
>> Add an explicit mapping in pnv_eeh_err_inject() that translates:
>> EEH_ERR_TYPE_32 -> OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR
>> EEH_ERR_TYPE_64 -> OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64
>>
>> Return -ERANGE for unsupported error types, preserving the behavior
>> of the original code. Decouples the VFIO/EEH interface from OPAL
>> implementation details.
>>
>> No change to existing userspace ABI or PowerNV behavior.
>>
>> Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
>> ---
>> arch/powerpc/platforms/powernv/eeh-powernv.c | 22 +++++++++++++++-----
>> 1 file changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/
>> powerpc/platforms/powernv/eeh-powernv.c
>> index db3370d1673c..01dae760cecb 100644
>> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
>> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
>> @@ -1167,12 +1167,24 @@ static int pnv_eeh_err_inject(struct eeh_pe
>> *pe, int type, int func,
>> {
>> struct pci_controller *hose = pe->phb;
>> struct pnv_phb *phb = hose->private_data;
>> + int opal_err_type;
>> s64 rc;
>> - if (type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR &&
>> - type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64) {
>> - pr_warn("%s: Invalid error type %d\n",
>> - __func__, type);
>> + /*
>> + * eeh_pe_inject_err() receives generic EEH error types from the
>> + * VFIO/EEH userspace ABI. The PowerNV backend must not rely on
>> + * these generic values being numerically identical to OPAL firmware
>> + * values. Translate to OPAL-specific types before calling
>> firmware.
>> + */
>> + switch (type) {
>> + case EEH_ERR_TYPE_32:
>> + opal_err_type = OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR;
>> + break;
>> + case EEH_ERR_TYPE_64:
>> + opal_err_type = OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64;
>> + break;
>> + default:
>> + pr_warn("%s: Invalid error type %d\n", __func__, type);
>> return -ERANGE;
>> }
>> @@ -1192,7 +1204,7 @@ static int pnv_eeh_err_inject(struct eeh_pe *pe,
>> int type, int func,
>> /* Do error injection */
>> rc = opal_pci_err_inject(phb->opal_id, pe->addr,
>> - type, func, addr, mask);
>> + opal_err_type, func, addr, mask);
>> if (rc != OPAL_SUCCESS) {
>> pr_warn("%s: Failure %lld injecting error "
>> "%d-%d to PHB#%x-PE#%x\n",
>
next prev parent reply other threads:[~2026-11-20 7:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 7:36 [PATCH v6 0/5] powerpc: Add RTAS based error injection support for pSeries Narayana Murty N
2026-10-23 7:36 ` [PATCH v6 1/5] powerpc/rtas: Handle ibm,open-errinjct return format Narayana Murty N
2026-11-18 11:13 ` Sourabh Jain
2026-11-20 4:36 ` Narayana Murty N
2026-10-23 7:36 ` [PATCH v6 2/5] powerpc/pseries/eeh: Add RTAS error injection helpers Narayana Murty N
2026-10-23 7:49 ` sashiko-bot
2026-11-20 4:45 ` Narayana Murty N
2026-11-18 16:43 ` Sourabh Jain
2026-11-20 7:19 ` Narayana Murty N
2026-10-23 7:36 ` [PATCH v6 3/5] powerpc/pseries/eeh: Implement RTAS-based EEH error injection Narayana Murty N
2026-11-18 19:14 ` Sourabh Jain
2026-11-20 7:32 ` Narayana Murty N
2026-10-23 7:36 ` [PATCH v6 4/5] vfio/spapr_tce: Normalize EEH IOA error injection addresses Narayana Murty N
2026-11-18 19:35 ` Sourabh Jain
2026-11-20 7:36 ` Narayana Murty N
2026-10-23 7:36 ` [PATCH v6 5/5] powerpc/powernv/eeh: Map generic EEH error types to OPAL Narayana Murty N
2026-11-18 19:41 ` Sourabh Jain
2026-11-20 7:39 ` Narayana Murty N [this message]
2026-11-10 19:21 ` [PATCH v6 0/5] powerpc: Add RTAS based error injection support for pSeries tasmiya
2026-11-20 7:40 ` 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=9efa20ba-d79b-47b8-9677-474c19aa9168@linux.ibm.com \
--to=nnmlinux@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=chleroy@kernel.org \
--cc=harshpb@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mahesh@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=oohall@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=sbhat@linux.ibm.com \
--cc=sourabhjain@linux.ibm.com \
--cc=sshegde@linux.ibm.com \
--cc=tpearson@raptorengineering.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox