]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Dec 2017 10:58:04 +0000 (11:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Dec 2017 10:58:04 +0000 (11:58 +0100)
added patches:
thermal-drivers-hisi-fix-multiple-alarm-interrupts-firing.patch
thermal-hisilicon-handle-return-value-of-clk_prepare_enable.patch

queue-4.4/series
queue-4.4/thermal-drivers-hisi-fix-multiple-alarm-interrupts-firing.patch [new file with mode: 0644]
queue-4.4/thermal-hisilicon-handle-return-value-of-clk_prepare_enable.patch [new file with mode: 0644]

index 695be88323d0a9b625c23543d9da98bea6eed62e..aa4b7a05d1e9955acc55d24d813d12091e3f350c 100644 (file)
@@ -71,3 +71,5 @@ fm10k-ensure-we-process-sm-mbx-when-processing-vf-mbx.patch
 tcp-fix-under-evaluated-ssthresh-in-tcp-vegas.patch
 rtc-set-the-alarm-to-the-next-expiring-timer.patch
 cpuidle-fix-broadcast-control-when-broadcast-can-not-be-entered.patch
+thermal-hisilicon-handle-return-value-of-clk_prepare_enable.patch
+thermal-drivers-hisi-fix-multiple-alarm-interrupts-firing.patch
diff --git a/queue-4.4/thermal-drivers-hisi-fix-multiple-alarm-interrupts-firing.patch b/queue-4.4/thermal-drivers-hisi-fix-multiple-alarm-interrupts-firing.patch
new file mode 100644 (file)
index 0000000..cfa2117
--- /dev/null
@@ -0,0 +1,76 @@
+From db2b0332608c8e648ea1e44727d36ad37cdb56cb Mon Sep 17 00:00:00 2001
+From: Daniel Lezcano <daniel.lezcano@linaro.org>
+Date: Thu, 19 Oct 2017 19:05:47 +0200
+Subject: thermal/drivers/hisi: Fix multiple alarm interrupts firing
+
+From: Daniel Lezcano <daniel.lezcano@linaro.org>
+
+commit db2b0332608c8e648ea1e44727d36ad37cdb56cb upstream.
+
+The DT specifies a threshold of 65000, we setup the register with a value in
+the temperature resolution for the controller, 64656.
+
+When we reach 64656, the interrupt fires, the interrupt is disabled. Then the
+irq thread runs and calls thermal_zone_device_update() which will call in turn
+hisi_thermal_get_temp().
+
+The function will look if the temperature decreased, assuming it was more than
+65000, but that is not the case because the current temperature is 64656
+(because of the rounding when setting the threshold). This condition being
+true, we re-enable the interrupt which fires immediately after exiting the irq
+thread. That happens again and again until the temperature goes to more than
+65000.
+
+Potentially, there is here an interrupt storm if the temperature stabilizes at
+this temperature. A very unlikely case but possible.
+
+In any case, it does not make sense to handle dozens of alarm interrupt for
+nothing.
+
+Fix this by rounding the threshold value to the controller resolution so the
+check against the threshold is consistent with the one set in the controller.
+
+Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
+Reviewed-by: Leo Yan <leo.yan@linaro.org>
+Tested-by: Leo Yan <leo.yan@linaro.org>
+Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
+Signed-off-by: Kevin Wangtao <kevin.wangtao@hisilicon.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/thermal/hisi_thermal.c |   10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/drivers/thermal/hisi_thermal.c
++++ b/drivers/thermal/hisi_thermal.c
+@@ -76,6 +76,12 @@ static inline long _temp_to_step(long te
+       return ((temp / 1000 - HISI_TEMP_BASE) * 255 / 200);
+ }
++static inline long hisi_thermal_round_temp(int temp)
++{
++      return hisi_thermal_step_to_temp(
++              hisi_thermal_temp_to_step(temp));
++}
++
+ static long hisi_thermal_get_sensor_temp(struct hisi_thermal_data *data,
+                                        struct hisi_thermal_sensor *sensor)
+ {
+@@ -223,7 +229,7 @@ static irqreturn_t hisi_thermal_alarm_ir
+       sensor = &data->sensors[data->irq_bind_sensor];
+       dev_crit(&data->pdev->dev, "THERMAL ALARM: T > %d\n",
+-               sensor->thres_temp / 1000);
++               sensor->thres_temp);
+       mutex_unlock(&data->thermal_lock);
+       for (i = 0; i < HISI_MAX_SENSORS; i++)
+@@ -256,7 +262,7 @@ static int hisi_thermal_register_sensor(
+       for (i = 0; i < of_thermal_get_ntrips(sensor->tzd); i++) {
+               if (trip[i].type == THERMAL_TRIP_PASSIVE) {
+-                      sensor->thres_temp = trip[i].temperature;
++                      sensor->thres_temp = hisi_thermal_round_temp(trip[i].temperature);
+                       break;
+               }
+       }
diff --git a/queue-4.4/thermal-hisilicon-handle-return-value-of-clk_prepare_enable.patch b/queue-4.4/thermal-hisilicon-handle-return-value-of-clk_prepare_enable.patch
new file mode 100644 (file)
index 0000000..536a8a7
--- /dev/null
@@ -0,0 +1,35 @@
+From 919054fdfc8adf58c5512fe9872eb53ea0f5525d Mon Sep 17 00:00:00 2001
+From: Arvind Yadav <arvind.yadav.cs@gmail.com>
+Date: Tue, 6 Jun 2017 15:04:46 +0530
+Subject: thermal: hisilicon: Handle return value of clk_prepare_enable
+
+From: Arvind Yadav <arvind.yadav.cs@gmail.com>
+
+commit 919054fdfc8adf58c5512fe9872eb53ea0f5525d upstream.
+
+clk_prepare_enable() can fail here and we must check its return value.
+
+Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
+Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
+Signed-off-by: Kevin Wangtao <kevin.wangtao@hisilicon.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/thermal/hisi_thermal.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/thermal/hisi_thermal.c
++++ b/drivers/thermal/hisi_thermal.c
+@@ -389,8 +389,11 @@ static int hisi_thermal_suspend(struct d
+ static int hisi_thermal_resume(struct device *dev)
+ {
+       struct hisi_thermal_data *data = dev_get_drvdata(dev);
++      int ret;
+-      clk_prepare_enable(data->clk);
++      ret = clk_prepare_enable(data->clk);
++      if (ret)
++              return ret;
+       data->irq_enabled = true;
+       hisi_thermal_enable_bind_irq_sensor(data);