thermal: tegra-bpmp: Handle errors in BPMP response
Subsystems (7)
PATCH 1/5 thermal: tegra-bpmp: Handle errors in BPMP response
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.
--- drivers/thermal/tegra/tegra-bpmp-thermal.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/thermal/tegra/tegra-bpmp-thermal.c +12 -1
@@ -52,6 +52,8 @@ static int tegra_bpmp_thermal_get_temp(void *data, int *out_temp) err =tegra_bpmp_transfer (zone->tegra->bpmp, &msg);if (err)return err; +if (msg.rx.ret) +return -EINVAL ; *out_temp = reply.get_temp.temp;
@@ -63,6 +65,7 @@ static int tegra_bpmp_thermal_set_trips(void *data, int low, int high)struct tegra_bpmp_thermal_zone *zone = data;struct mrq_thermal_host_to_bpmp_request req;struct tegra_bpmp_message msg; +int err;memset (&req,0 ,sizeof (req)); req.type =CMD_THERMAL_SET_TRIP ;
@@ -76,7 +79,13 @@ static int tegra_bpmp_thermal_set_trips(void *data, int low, int high) msg.tx.data = &req; msg.tx.size =sizeof (req); -return tegra_bpmp_transfer (zone->tegra->bpmp, &msg); + err =tegra_bpmp_transfer (zone->tegra->bpmp, &msg); +if (err) +return err; +if (msg.rx.ret) +return -EINVAL ; + +return 0 ; }static void tz_device_update_work_fn (struct work_struct *work)
@@ -140,6 +149,8 @@ static int tegra_bpmp_thermal_get_num_zones(struct tegra_bpmp *bpmp, err =tegra_bpmp_transfer (bpmp, &msg);if (err)return err; +if (msg.rx.ret) +return -EINVAL ; *num_zones = reply.get_num_zones.num;
Signature · 1 line
2.32.0
PATCH 2/5 reset: tegra-bpmp: Handle errors in BPMP response
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.
--- drivers/reset/tegra/reset-bpmp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/reset/tegra/reset-bpmp.c +8 -1
@@ -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,
Signature · 1 line
2.32.0
Re: [PATCH 2/5] reset: tegra-bpmp: Handle errors in BPMP response
Quoted 6 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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 <[email protected]>
Thank you, applied to reset/fixes.
regards
Philipp
Jon Hunter
maintainerRe: [PATCH 2/5] reset: tegra-bpmp: Handle errors in BPMP response
In reply to Mikko PerttunenHi Philipp,
Quoted 28 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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 <[email protected]>--- drivers/reset/tegra/reset-bpmp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/reset/tegra/reset-bpmp.c +1
-1@@ -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);
drivers/reset/tegra/reset-bpmp.c static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, · line 43
Quoted 10 lines
drivers/reset/tegra/reset-bpmp.c +7
-0+ 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
Signature · 1 line
nvpublic
Philipp Zabel
maintainerRe: [PATCH 2/5] reset: tegra-bpmp: Handle errors in BPMP response
Hi Jon,
Quoted 42 lines · Jon Hunter
Hi Philipp,
Quoted 39 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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 <[email protected]>---
drivers/reset/tegra/reset-bpmp.c | 9 ++++++++-1 file changed, 8 insertions(+), 1 deletion(-)drivers/reset/tegra/reset-bpmp.c +1
-0@@ -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;drivers/reset/tegra/reset-bpmp.c +0
-0@@ -30,7 +31,13 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, msg.tx.data = &request; msg.tx.size = sizeof(request);drivers/reset/tegra/reset-bpmp.c +7
-1-return tegra_bpmp_transfer (bpmp, &msg); + err =tegra_bpmp_transfer (bpmp, &msg); +if (err) +return err; +if (msg.rx.ret) +return -EINVAL ; + +return 0 ;}
Quoted 7 lines
Quoted 1 line
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
maintainerRe: [PATCH 2/5] reset: tegra-bpmp: Handle errors in BPMP response
Hi Philipp,
On 02/11/2021 13:10, Philipp Zabel wrote:
...
Quoted 2 lines
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
Signature · 1 line
nvpublic
PATCH 3/5 memory: tegra186-emc: Handle errors in BPMP response
In reply to Mikko PerttunenThe 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.
--- drivers/memory/tegra/tegra186-emc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/memory/tegra/tegra186-emc.c +4 -0
@@ -197,6 +197,10 @@ static int tegra186_emc_probe(struct platform_device *pdev)dev_err (&pdev->dev,"failed to EMC DVFS pairs: %d\n" , err); goto put_bpmp; } +if (msg.rx.ret <0 ) { +dev_err (&pdev->dev,"EMC DVFS MRQ failed: %d (BPMP error code)\n" , msg.rx.ret); + goto put_bpmp; + } emc->debugfs.min_rate =ULONG_MAX ; emc->debugfs.max_rate =0 ;
Signature · 1 line
2.32.0
Krzysztof Kozlowski
AppliedRe: (subset) [PATCH 3/5] memory: tegra186-emc: Handle errors in BPMP response
Quoted 6 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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.
Applied, thanks!
[3/5] memory: tegra186-emc: Handle errors in BPMP response
commit: 13324edbe9269e6fbca4d0f5146b18ef8478c958
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>
PATCH 4/5 cpufreq: tegra186/tegra194: Handle errors in BPMP response
In reply to Mikko PerttunenThe 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.
While at it, explicitly handle missing CPU clusters, which can occur on floorswept chips. This worked before as well, but possibly only by accident.
--- drivers/cpufreq/tegra186-cpufreq.c | 4 ++++ drivers/cpufreq/tegra194-cpufreq.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/cpufreq/tegra186-cpufreq.c +4 -0
@@ -159,6 +159,10 @@ static struct cpufreq_frequency_table *init_vhint_table( table =ERR_PTR (err); goto free; } +if (msg.rx.ret) { + table =ERR_PTR (-EINVAL ); + goto free; + }for (i = data->vfloor; i <= data->vceil; i++) {u16 ndiv = data->ndiv[i];
drivers/cpufreq/tegra194-cpufreq.c +7 -1
@@ -242,7 +242,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)smp_call_function_single (policy->cpu, get_cpu_cluster, &cl, true); -if (cl >= data->num_clusters) +if (cl >= data->num_clusters || !data->tables[cl])return -EINVAL ;/* set same policy for all cpus in a cluster */
@@ -310,6 +310,12 @@ init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp, err =tegra_bpmp_transfer (bpmp, &msg);if (err)return ERR_PTR (err); +if (msg.rx.ret == -BPMP_EINVAL ) { +/* Cluster not available */ +return NULL ; + } +if (msg.rx.ret) +return ERR_PTR (-EINVAL );/* * Make sure frequency table step is a multiple of mdiv to match
Signature · 1 line
2.32.0
Viresh Kumar
maintainerRe: [PATCH 4/5] cpufreq: tegra186/tegra194: Handle errors in BPMP response
Quoted 9 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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.While at it, explicitly handle missing CPU clusters, which can occur on floorswept chips. This worked before as well, but possibly only by accident.
Quoted 5 lines
Signed-off-by Mikko Perttunen <[email protected]>--- drivers/cpufreq/tegra186-cpufreq.c | 4 ++++ drivers/cpufreq/tegra194-cpufreq.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
Should I apply it alone ?
Signature · 1 line
viresh
Re: [PATCH 4/5] cpufreq: tegra186/tegra194: Handle errors in BPMP response
Quoted 10 lines · Viresh Kumar
Quoted 9 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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.While at it, explicitly handle missing CPU clusters, which can occur on floorswept chips. This worked before as well, but possibly only by accident.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Mikko Perttunen <[email protected]>--- drivers/cpufreq/tegra186-cpufreq.c | 4 ++++ drivers/cpufreq/tegra194-cpufreq.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-)Should I apply it alone ?
Yes please, all of these patches are independent of each other.
Mikko
Re: [PATCH 4/5] cpufreq: tegra186/tegra194: Handle errors in BPMP response
In reply to Mikko PerttunenQuoted 46 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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.While at it, explicitly handle missing CPU clusters, which can occur on floorswept chips. This worked before as well, but possibly only by accident.
Signed-off-by Mikko Perttunen <[email protected]>--- drivers/cpufreq/tegra186-cpufreq.c | 4 ++++ drivers/cpufreq/tegra194-cpufreq.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-)drivers/cpufreq/tegra186-cpufreq.c +4
-0@@ -159,6 +159,10 @@ static struct cpufreq_frequency_table *init_vhint_table( table =ERR_PTR (err); goto free; } +if (msg.rx.ret) { + table =ERR_PTR (-EINVAL ); + goto free; + }for (i = data->vfloor; i <= data->vceil; i++) {u16 ndiv = data->ndiv[i];drivers/cpufreq/tegra194-cpufreq.c +1
-1@@ -242,7 +242,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)smp_call_function_single (policy->cpu, get_cpu_cluster, &cl, true); -if (cl >= data->num_clusters) +if (cl >= data->num_clusters || !data->tables[cl])return -EINVAL ;/* set same policy for all cpus in a cluster */ @@ -310,6 +310,12 @@ init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp, err =tegra_bpmp_transfer (bpmp, &msg);if (err)
drivers/cpufreq/tegra194-cpufreq.c init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp, · line 321
Quoted 10 lines
drivers/cpufreq/tegra194-cpufreq.c +6
-0return ERR_PTR (err); +if (msg.rx.ret == -BPMP_EINVAL ) { +/* Cluster not available */ +return NULL ; + } +if (msg.rx.ret) +return ERR_PTR (-EINVAL );/* * Make sure frequency table step is a multiple of mdiv to match
Applied. Thanks.
Signature · 1 line
viresh
Re: [PATCH 4/5] cpufreq: tegra186/tegra194: Handle errors in BPMP response
Quoted 55 lines · Viresh Kumar
Quoted 54 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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.While at it, explicitly handle missing CPU clusters, which can occur on floorswept chips. This worked before as well, but possibly only by accident.
Signed-off-by Mikko Perttunen <[email protected]>--- drivers/cpufreq/tegra186-cpufreq.c | 4 ++++ drivers/cpufreq/tegra194-cpufreq.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-)drivers/cpufreq/tegra186-cpufreq.c +4
-0@@ -159,6 +159,10 @@ static struct cpufreq_frequency_table *init_vhint_table( table =ERR_PTR (err); goto free; } +if (msg.rx.ret) { + table =ERR_PTR (-EINVAL ); + goto free; + }for (i = data->vfloor; i <= data->vceil; i++) {u16 ndiv = data->ndiv[i];drivers/cpufreq/tegra194-cpufreq.c +7
-1@@ -242,7 +242,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)smp_call_function_single (policy->cpu, get_cpu_cluster, &cl, true); -if (cl >= data->num_clusters) +if (cl >= data->num_clusters || !data->tables[cl])return -EINVAL ;/* set same policy for all cpus in a cluster */ @@ -310,6 +310,12 @@ init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp, err =tegra_bpmp_transfer (bpmp, &msg);if (err)return ERR_PTR (err); +if (msg.rx.ret == -BPMP_EINVAL ) { +/* Cluster not available */ +return NULL ; + } +if (msg.rx.ret) +return ERR_PTR (-EINVAL );
Quoted 5 lines
drivers/cpufreq/tegra194-cpufreq.c init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp, · line 321
Quoted 2 lines
drivers/cpufreq/tegra194-cpufreq.c +0
-0/* * Make sure frequency table step is a multiple of mdiv to match Applied. Thanks.
Thanks!
Mikko
PATCH 5/5 PCI: tegra194: Handle errors in BPMP response
In reply to Mikko PerttunenThe 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.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-tegra194.c +8 -1
@@ -1162,6 +1162,7 @@ static int tegra_pcie_bpmp_set_ctrl_state(struct tegra_pcie_dw *pcie,struct mrq_uphy_response resp;struct tegra_bpmp_message msg;struct mrq_uphy_request req; +int err;/* Controller-5 doesn't need to have its state set by BPMP-FW */ if (pcie->cid ==5 )
@@ -1181,7 +1182,13 @@ static int tegra_pcie_bpmp_set_ctrl_state(struct tegra_pcie_dw *pcie, msg.rx.data = &resp; msg.rx.size =sizeof (resp); -return tegra_bpmp_transfer (pcie->bpmp, &msg); + err =tegra_bpmp_transfer (pcie->bpmp, &msg); +if (err) +return err; +if (msg.rx.ret) +return -EINVAL ; + +return 0 ; } static int tegra_pcie_bpmp_set_pll_state(struct tegra_pcie_dw *pcie,
Signature · 1 line
2.32.0
Re: [PATCH 5/5] PCI: tegra194: Handle errors in BPMP response
Quoted 9 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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 <[email protected]>--- drivers/pci/controller/dwc/pcie-tegra194.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
Lorenzo Pieralisi
Acked-byRe: [PATCH 5/5] PCI: tegra194: Handle errors in BPMP response
Quoted 6 lines · Thierry Reding
Quoted 5 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Mikko Perttunen <[email protected]>--- drivers/pci/controller/dwc/pcie-tegra194.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)Acked-by Thierry Reding <[email protected]>
Hi Thierry,
can I pull this patch into the PCI tree ? Or if you want the series to go via another tree:
Re: [PATCH 5/5] PCI: tegra194: Handle errors in BPMP response
Quoted 12 lines · Lorenzo Pieralisi
Quoted 11 lines · Thierry Reding
Quoted 9 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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 <[email protected]>--- drivers/pci/controller/dwc/pcie-tegra194.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 8 lines
Quoted 1 line
Acked-by Thierry Reding <[email protected]>Hi Thierry,
can I pull this patch into the PCI tree ? Or if you want the series to go via another tree:
Hi,
I would like to ask please how you want this series to be handled.
Thanks,
Lorenzo
Re: [PATCH 5/5] PCI: tegra194: Handle errors in BPMP response
Quoted 17 lines · Lorenzo Pieralisi
Quoted 16 lines · Lorenzo Pieralisi
Quoted 6 lines · Thierry Reding
Quoted 5 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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.Quoted 6 lines
Quoted 4 lines
Signed-off-by Mikko Perttunen <[email protected]>--- drivers/pci/controller/dwc/pcie-tegra194.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)Acked-by Thierry Reding <[email protected]>Hi Thierry,
Quoted 8 lines
Quoted 4 lines
can I pull this patch into the PCI tree ? Or if you want the series to go via another tree:
Hi,
I would like to ask please how you want this series to be handled.
Should I apply this patch stand-alone ?
I will mark all other patches in this series as Not Applicable in the PCI queue.
Thanks,
Lorenzo
Quoted 9 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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 <[email protected]>--- drivers/thermal/tegra/tegra-bpmp-thermal.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Perhaps this should be moved into tegra_bpmp_transfer() or some new helper to make sure we can keep this consistent across all callers.
For instance, I'm not sure -EINVAL is the right (or best) error code in all the cases. Either way, seems fine in this case and this is certainly an improvement, so:
Daniel Lezcano
AppliedQuoted 11 lines · Thierry Reding
Quoted 9 lines · Mikko Perttunen
The return value from
tegra_bpmp_transferindicates 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 <[email protected]>--- drivers/thermal/tegra/tegra-bpmp-thermal.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Quoted 8 lines
Perhaps this should be moved into
tegra_bpmp_transfer()or some new helper to make sure we can keep this consistent across all callers.For instance, I'm not sure
-EINVALis the right (or best) error code in all the cases. Either way, seems fine in this case and this is certainly an improvement, so:Acked-by Thierry Reding <[email protected]>
Applied, thanks
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
The following commit has been merged into the thermal/next branch of thermal:
The following commit has been merged into the thermal/next branch of thermal:
Commit-ID: 1a7c9213d5f9bfd5e1bf4f87df1abc166ce48ffc Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//1a7c9213d5f9bfd5e1bf4f87df1abc166ce48ffc Author: Mikko Perttunen <[email protected]> AuthorDate: Wed, 15 Sep 2021 11:55:13 +03:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Tue, 08 Mar 2022 21:26:09 +01:00
thermal: tegra-bpmp: Handle errors in BPMP response
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.
--- drivers/thermal/tegra/tegra-bpmp-thermal.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/thermal/tegra/tegra-bpmp-thermal.c +12 -1
@@ -52,6 +52,8 @@ static int tegra_bpmp_thermal_get_temp(void *data, int *out_temp) err =tegra_bpmp_transfer (zone->tegra->bpmp, &msg);if (err)return err; +if (msg.rx.ret) +return -EINVAL ; *out_temp = reply.get_temp.temp;
@@ -63,6 +65,7 @@ static int tegra_bpmp_thermal_set_trips(void *data, int low, int high)struct tegra_bpmp_thermal_zone *zone = data;struct mrq_thermal_host_to_bpmp_request req;struct tegra_bpmp_message msg; +int err;memset (&req,0 ,sizeof (req)); req.type =CMD_THERMAL_SET_TRIP ;
@@ -76,7 +79,13 @@ static int tegra_bpmp_thermal_set_trips(void *data, int low, int high) msg.tx.data = &req; msg.tx.size =sizeof (req); -return tegra_bpmp_transfer (zone->tegra->bpmp, &msg); + err =tegra_bpmp_transfer (zone->tegra->bpmp, &msg); +if (err) +return err; +if (msg.rx.ret) +return -EINVAL ; + +return 0 ; }static void tz_device_update_work_fn (struct work_struct *work)
@@ -140,6 +149,8 @@ static int tegra_bpmp_thermal_get_num_zones(struct tegra_bpmp *bpmp, err =tegra_bpmp_transfer (bpmp, &msg);if (err)return err; +if (msg.rx.ret) +return -EINVAL ; *num_zones = reply.get_num_zones.num;