Skip to content

Commit ef8ee1c

Browse files
anderssonvireshk
authored andcommitted
cpufreq: qcom-hw: Delay enabling throttle_irq
In the event that the SoC is under thermal pressure while booting it's possible for the dcvs notification to happen inbetween the cpufreq framework calling init and it actually updating the policy's related_cpus cpumask. Prior to the introduction of the thermal pressure update helper an empty cpumask would simply result in the thermal pressure of no cpus being updated, but the new code will attempt to dereference an invalid per_cpu variable. Avoid this problem by using the newly reintroduced "ready" callback, to postpone enabling the IRQ until the related_cpus cpumask is filled in. Fixes: 0258cb1 ("cpufreq: qcom-cpufreq-hw: Use new thermal pressure update function") Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 4f774c4 commit ef8ee1c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
388388

389389
snprintf(data->irq_name, sizeof(data->irq_name), "dcvsh-irq-%u", policy->cpu);
390390
ret = request_threaded_irq(data->throttle_irq, NULL, qcom_lmh_dcvs_handle_irq,
391-
IRQF_ONESHOT, data->irq_name, data);
391+
IRQF_ONESHOT | IRQF_NO_AUTOEN, data->irq_name, data);
392392
if (ret) {
393393
dev_err(&pdev->dev, "Error registering %s: %d\n", data->irq_name, ret);
394394
return 0;
@@ -542,6 +542,14 @@ static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy)
542542
return 0;
543543
}
544544

545+
static void qcom_cpufreq_ready(struct cpufreq_policy *policy)
546+
{
547+
struct qcom_cpufreq_data *data = policy->driver_data;
548+
549+
if (data->throttle_irq >= 0)
550+
enable_irq(data->throttle_irq);
551+
}
552+
545553
static struct freq_attr *qcom_cpufreq_hw_attr[] = {
546554
&cpufreq_freq_attr_scaling_available_freqs,
547555
&cpufreq_freq_attr_scaling_boost_freqs,
@@ -561,6 +569,7 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
561569
.fast_switch = qcom_cpufreq_hw_fast_switch,
562570
.name = "qcom-cpufreq-hw",
563571
.attr = qcom_cpufreq_hw_attr,
572+
.ready = qcom_cpufreq_ready,
564573
};
565574

566575
static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)