Re: [PATCH v3 5/5] powerpc/powernv/eeh: Map VFIO EEH error injection to OPAL

Sourabh Jain <[email protected]>
Newsgroups gmane.linux.ports.ppc.embedded,gmane.linux.kernel
Message-ID <[email protected]>

On 05/08/26 11:53, Narayana Murty N wrote:
> Hi Sourabh,
>
> On 05/08/26 12:01 AM, Sourabh Jain wrote:
>>
>>
>> As per the title this series is about RTAS-based error injection on 
>> pSeries.
>>
>> Then why do we have powernv/opal patch part of this series?
>>
>> - Sourabh Jain
>>
> The guest running on povernv host also a pseries guest. VFIO will take 
> care of
> translating the calls to respective platforms. So as a platform 
> comparability
> the changes are made in this series.

Oh, okay. These changes are for a pSeries guest running on a PowerNV 
platform.
Thanks for the clarification.

- Sourabh Jain

>
> Regards,
> Narayana.
>
>>
>> On 21/07/26 09:08, Narayana Murty N wrote:
>>> The EEH error-injection interface passes the generic userspace ABI
>>> values EEH_ERR_TYPE_32 and EEH_ERR_TYPE_64 to the platform backend.
>>>
>>> The PowerNV backend currently compares those generic values directly
>>> with OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR and
>>> OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64. Although the corresponding values
>>> are currently numerically identical, this implicitly couples the
>>> generic EEH ABI to the OPAL firmware encoding.
>>>
>>> Explicitly translate the generic EEH error types to their OPAL
>>> equivalents in pnv_eeh_err_inject(). Keep the platform-specific
>>> encoding within the PowerNV backend and reject unsupported generic
>>> types with -EINVAL.
>>>
>>> No userspace ABI values are changed.
>>>
>>> Signed-off-by: Narayana Murty N <[email protected]>
>>> ---
>>>   arch/powerpc/platforms/powernv/eeh-powernv.c | 36 
>>> +++++++++++++++++---
>>>   1 file changed, 32 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c 
>>> b/arch/powerpc/platforms/powernv/eeh-powernv.c
>>> index db3370d1673c..b0bcd014a133 100644
>>> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
>>> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
>>> @@ -1169,11 +1169,39 @@ 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) {
>>> -        pr_warn("%s: Invalid error type %d\n",
>>> +    /*
>>> +     * Map generic EEH error-type ABI values to OPAL-specific type 
>>> codes.
>>> +     * EEH_ERR_TYPE_32 and EEH_ERR_TYPE_64 are the only types 
>>> supported by
>>> +     * OPAL.  Additional generic types defined in the UAPI header 
>>> are valid
>>> +     * for pSeries RTAS but unsupported here; return -EOPNOTSUPP 
>>> for those.
>>> +     * Unknown or invalid values return -EINVAL.
>>> +     *
>>> +     * Note: currently OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR  == 0 ==
>>> +     * EEH_ERR_TYPE_32 and OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64 == 1 ==
>>> +     * EEH_ERR_TYPE_64, but the explicit switch makes the coupling
>>> +     * visible and allows the values to diverge independently.
>>> +     */
>>> +    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;
>>> +    case EEH_ERR_TYPE_RECOVERED_SPECIAL_EVENT:
>>> +    case EEH_ERR_TYPE_CORRUPTED_PAGE:
>>> +    case EEH_ERR_TYPE_CORRUPTED_DCACHE_START:
>>> +    case EEH_ERR_TYPE_CORRUPTED_DCACHE_END:
>>> +    case EEH_ERR_TYPE_CORRUPTED_ICACHE_START:
>>> +    case EEH_ERR_TYPE_CORRUPTED_ICACHE_END:
>>> +    case EEH_ERR_TYPE_CORRUPTED_TLB_START:
>>> +    case EEH_ERR_TYPE_CORRUPTED_TLB_END:
>>> +        pr_warn("%s: EEH error type %d not supported by OPAL\n",
>>>               __func__, type);
>>> -        return -ERANGE;
>>> +        return -EOPNOTSUPP;
>>> +    default:
>>> +        pr_warn("%s: unsupported EEH error type %d\n", __func__, 
>>> type);
>>> +        return -EINVAL;
>>>       }
>>>         if (func < OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_ADDR ||
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.