diff mbox series

[2/5] reset: tegra-bpmp: Handle errors in BPMP response

Message ID 20210915085517.1669675-2-mperttunen@nvidia.com
State Not Applicable
Headers show
Series [1/5] thermal: tegra-bpmp: Handle errors in BPMP response | expand

Commit Message

Mikko Perttunen Sept. 15, 2021, 8:55 a.m. UTC
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@nvidia.com>
---
 drivers/reset/tegra/reset-bpmp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Philipp Zabel Oct. 5, 2021, 9:55 a.m. UTC | #1
On Wed, 2021-09-15 at 11:55 +0300, Mikko Perttunen wrote:
> 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@nvidia.com>

Thank you, applied to reset/fixes.

regards
Philipp
Jon Hunter Oct. 28, 2021, 11:54 a.m. UTC | #2
Hi Philipp,

On 15/09/2021 09:55, Mikko Perttunen wrote:
> 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@nvidia.com>
> ---
>   drivers/reset/tegra/reset-bpmp.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/reset/tegra/reset-bpmp.c b/drivers/reset/tegra/reset-bpmp.c
> index 24d3395964cc..4c5bba52b105 100644
> --- a/drivers/reset/tegra/reset-bpmp.c
> +++ b/drivers/reset/tegra/reset-bpmp.c
> @@ -20,6 +20,7 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
>   	struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc);
>   	struct mrq_reset_request request;
>   	struct tegra_bpmp_message msg;
> +	int err;
>   
>   	memset(&request, 0, sizeof(request));
>   	request.cmd = command;
> @@ -30,7 +31,13 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
>   	msg.tx.data = &request;
>   	msg.tx.size = sizeof(request);
>   
> -	return tegra_bpmp_transfer(bpmp, &msg);
> +	err = tegra_bpmp_transfer(bpmp, &msg);
> +	if (err)
> +		return err;
> +	if (msg.rx.ret)
> +		return -EINVAL;
> +
> +	return 0;
>   }
>   
>   static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,
> 


I see that you have pulled this into the mainline for v5.15. 
Unfortunately, this is causing a regression for the Tegra HDA 
controller. We need to fix the Tegra HDA driver but this is too late now 
for v5.15 and so we need to revert this change for v5.15. Sorry about 
this, but I did not expect this to be pulled in so late.

Jon
Philipp Zabel Nov. 2, 2021, 1:10 p.m. UTC | #3
Hi Jon,

On Thu, 2021-10-28 at 12:54 +0100, Jon Hunter wrote:
> Hi Philipp,
> 
> On 15/09/2021 09:55, Mikko Perttunen wrote:
> > 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@nvidia.com>
> > ---
> >   drivers/reset/tegra/reset-bpmp.c | 9 ++++++++-
> >   1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/reset/tegra/reset-bpmp.c b/drivers/reset/tegra/reset-bpmp.c
> > index 24d3395964cc..4c5bba52b105 100644
> > --- a/drivers/reset/tegra/reset-bpmp.c
> > +++ b/drivers/reset/tegra/reset-bpmp.c
> > @@ -20,6 +20,7 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
> >   	struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc);
> >   	struct mrq_reset_request request;
> >   	struct tegra_bpmp_message msg;
> > +	int err;
> >   
> > 
> >   	memset(&request, 0, sizeof(request));
> >   	request.cmd = command;
> > @@ -30,7 +31,13 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
> >   	msg.tx.data = &request;
> >   	msg.tx.size = sizeof(request);
> >   
> > 
> > -	return tegra_bpmp_transfer(bpmp, &msg);
> > +	err = tegra_bpmp_transfer(bpmp, &msg);
> > +	if (err)
> > +		return err;
> > +	if (msg.rx.ret)
> > +		return -EINVAL;
> > +
> > +	return 0;
> >   }
> >   
> > 
> >   static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,
> 
> I see that you have pulled this into the mainline for v5.15. 
> Unfortunately, this is causing a regression for the Tegra HDA 
> controller. We need to fix the Tegra HDA driver but this is too late now 
> for v5.15 and so we need to revert this change for v5.15. Sorry about 
> this, but I did not expect this to be pulled in so late.

I'm sorry, I picked this up as a fix and went on vacation. Now that
v5.15 has already been released, could you send a revert for stable?

regards
Philipp
Jon Hunter Nov. 12, 2021, 11:30 a.m. UTC | #4
Hi Philipp,

On 02/11/2021 13:10, Philipp Zabel wrote:

...

> I'm sorry, I picked this up as a fix and went on vacation. Now that
> v5.15 has already been released, could you send a revert for stable?

No problem. I have sent a revert for this. If we could pull that into 
the mainline for v5.16 that would be great. Then I will get it 
backported to stable. We will undo this revert in the mainline once we 
have sorted out the problem with the HDA driver.

Thanks!
Jon
diff mbox series

Patch

diff --git a/drivers/reset/tegra/reset-bpmp.c b/drivers/reset/tegra/reset-bpmp.c
index 24d3395964cc..4c5bba52b105 100644
--- a/drivers/reset/tegra/reset-bpmp.c
+++ b/drivers/reset/tegra/reset-bpmp.c
@@ -20,6 +20,7 @@  static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
 	struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc);
 	struct mrq_reset_request request;
 	struct tegra_bpmp_message msg;
+	int err;
 
 	memset(&request, 0, sizeof(request));
 	request.cmd = command;
@@ -30,7 +31,13 @@  static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
 	msg.tx.data = &request;
 	msg.tx.size = sizeof(request);
 
-	return tegra_bpmp_transfer(bpmp, &msg);
+	err = tegra_bpmp_transfer(bpmp, &msg);
+	if (err)
+		return err;
+	if (msg.rx.ret)
+		return -EINVAL;
+
+	return 0;
 }
 
 static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,