Subject: Re: [PATCH v3 1/3] powerpc/rtas: Export rtas_error_rc

From: Nathan Lynch <[email-masked]>
Date: Fri, 24 Apr 2020 11:07:43 -0500

Sam Bobroff <[email-masked]> writes:
> Export rtas_error_rc() so that it can be used by other users of
> rtas_call() (which is already exported).

This will do the right thing for your ibm,configure-pe use case in patch
2, but the -900x => errno translations in rtas_error_rc() appear
tailored for the indicator- and sensor-related calls that currently use
it. From my reading of PAPR+, the meaning of a -900x RTAS status word
depends on the call. For example, -9002 commonly means "not authorized",
which we would typically translate to -EPERM, but rtas_error_rc() would
translate it to -ENODEV.

Also the semantics of -9001 as a return value seem to vary a bit.

So I don't think rtas_error_rc() should be advertised as a generically
useful facility in its current form.

(I have had some thoughts about how firmware/hypervisor call status can
be translated to meaningful Linux error values without tedious switch
statements, which I'm happy to expand on if anyone is interested, but I
don't want to hijack your submission for that discussion.)