Re: [PATCH v2] PCI: tegra194: Handle errors in BPMP response

From: Thierry Reding
Date: Wed Apr 05 2023 - 08:55:17 EST


On Wed, Feb 08, 2023 at 04:27:35PM +0200, Mikko Perttunen wrote:
> From: Mikko Perttunen <mperttunen@xxxxxxxxxx>
>
> The return value from tegra_bpmp_transfer indicates the success or
> failure of the IPC transaction with BPMP. If the transaction
> succeeded, we also need to check the actual command's result code.
> Add code to do this.
>
> Signed-off-by: Mikko Perttunen <mperttunen@xxxxxxxxxx>
> ---
> drivers/pci/controller/dwc/pcie-tegra194.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)

Lorenzo asked whether the error check could be incorporated into
tegra_bpmp_transfer() in reply to an earlier version of this. It would
be possible, but I think it has the downside of loosing some context.
The end result would still be the same, but it would make it impossible
for the caller to distinguish between a failure of tegra_bpmp_transfer()
and a failure of the message transaction.

For example the cpufreq driver checks for msg.rx.ret == -BPMP_EINVAL and
if that's returned will mark the given cluster as not available. This is
special behavior that only makes sense within the context of cpufreq. It
wouldn't be possible to make these decisions if tegra_bpmp_transfer()
did some automated conversion and effectively rolled the message error
into the function return error.

So I think this will need to stay as-is to make sure we can handle these
errors correctly.

Acked-by: Thierry Reding <treding@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature