Skip to content

Commit c2ace21

Browse files
cyndisvireshk
authored andcommitted
cpufreq: tegra186/tegra194: 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. 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]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 6065a67 commit c2ace21

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

drivers/cpufreq/tegra186-cpufreq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ static struct cpufreq_frequency_table *init_vhint_table(
159159
table = ERR_PTR(err);
160160
goto free;
161161
}
162+
if (msg.rx.ret) {
163+
table = ERR_PTR(-EINVAL);
164+
goto free;
165+
}
162166

163167
for (i = data->vfloor; i <= data->vceil; i++) {
164168
u16 ndiv = data->ndiv[i];

drivers/cpufreq/tegra194-cpufreq.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
242242

243243
smp_call_function_single(policy->cpu, get_cpu_cluster, &cl, true);
244244

245-
if (cl >= data->num_clusters)
245+
if (cl >= data->num_clusters || !data->tables[cl])
246246
return -EINVAL;
247247

248248
/* set same policy for all cpus in a cluster */
@@ -310,6 +310,12 @@ init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp,
310310
err = tegra_bpmp_transfer(bpmp, &msg);
311311
if (err)
312312
return ERR_PTR(err);
313+
if (msg.rx.ret == -BPMP_EINVAL) {
314+
/* Cluster not available */
315+
return NULL;
316+
}
317+
if (msg.rx.ret)
318+
return ERR_PTR(-EINVAL);
313319

314320
/*
315321
* Make sure frequency table step is a multiple of mdiv to match

0 commit comments

Comments
 (0)