From 3fbf11feebe59ca5f8f49b2bdd0c6595d360b196 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 14 Jul 2014 10:41:48 -0700 Subject: [PATCH] 3.4-stable patches added patches: hwmon-adm1029-ensure-the-fan_div-cache-is-updated-in-set_fan_div.patch hwmon-amc6821-fix-permissions-for-temp2_input.patch powerpc-perf-never-program-book3s-pmcs-with-values-0x80000000.patch --- ..._div-cache-is-updated-in-set_fan_div.patch | 36 ++++++++++++ ...6821-fix-permissions-for-temp2_input.patch | 31 ++++++++++ ...m-book3s-pmcs-with-values-0x80000000.patch | 57 +++++++++++++++++++ queue-3.4/series | 3 + 4 files changed, 127 insertions(+) create mode 100644 queue-3.4/hwmon-adm1029-ensure-the-fan_div-cache-is-updated-in-set_fan_div.patch create mode 100644 queue-3.4/hwmon-amc6821-fix-permissions-for-temp2_input.patch create mode 100644 queue-3.4/powerpc-perf-never-program-book3s-pmcs-with-values-0x80000000.patch diff --git a/queue-3.4/hwmon-adm1029-ensure-the-fan_div-cache-is-updated-in-set_fan_div.patch b/queue-3.4/hwmon-adm1029-ensure-the-fan_div-cache-is-updated-in-set_fan_div.patch new file mode 100644 index 00000000000..947d918e80b --- /dev/null +++ b/queue-3.4/hwmon-adm1029-ensure-the-fan_div-cache-is-updated-in-set_fan_div.patch @@ -0,0 +1,36 @@ +From 1035a9e3e9c76b64a860a774f5b867d28d34acc2 Mon Sep 17 00:00:00 2001 +From: Axel Lin +Date: Wed, 2 Jul 2014 08:29:55 +0800 +Subject: hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div + +From: Axel Lin + +commit 1035a9e3e9c76b64a860a774f5b867d28d34acc2 upstream. + +Writing to fanX_div does not clear the cache. As a result, reading +from fanX_div may return the old value for up to two seconds +after writing a new value. + +This patch ensures the fan_div cache is updated in set_fan_div(). + +Reported-by: Guenter Roeck +Signed-off-by: Axel Lin +Signed-off-by: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwmon/adm1029.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/hwmon/adm1029.c ++++ b/drivers/hwmon/adm1029.c +@@ -231,6 +231,9 @@ static ssize_t set_fan_div(struct device + /* Update the value */ + reg = (reg & 0x3F) | (val << 6); + ++ /* Update the cache */ ++ data->fan_div[attr->index] = reg; ++ + /* Write value */ + i2c_smbus_write_byte_data(client, + ADM1029_REG_FAN_DIV[attr->index], reg); diff --git a/queue-3.4/hwmon-amc6821-fix-permissions-for-temp2_input.patch b/queue-3.4/hwmon-amc6821-fix-permissions-for-temp2_input.patch new file mode 100644 index 00000000000..e3b8e6e5f78 --- /dev/null +++ b/queue-3.4/hwmon-amc6821-fix-permissions-for-temp2_input.patch @@ -0,0 +1,31 @@ +From df86754b746e9a0ff6f863f690b1c01d408e3cdc Mon Sep 17 00:00:00 2001 +From: Axel Lin +Date: Wed, 2 Jul 2014 07:44:44 +0800 +Subject: hwmon: (amc6821) Fix permissions for temp2_input + +From: Axel Lin + +commit df86754b746e9a0ff6f863f690b1c01d408e3cdc upstream. + +temp2_input should not be writable, fix it. + +Reported-by: Guenter Roeck +Signed-off-by: Axel Lin +Signed-off-by: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwmon/amc6821.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/hwmon/amc6821.c ++++ b/drivers/hwmon/amc6821.c +@@ -715,7 +715,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_alar + get_temp_alarm, NULL, IDX_TEMP1_MAX); + static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, + get_temp_alarm, NULL, IDX_TEMP1_CRIT); +-static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO | S_IWUSR, ++static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, + get_temp, NULL, IDX_TEMP2_INPUT); + static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp, + set_temp, IDX_TEMP2_MIN); diff --git a/queue-3.4/powerpc-perf-never-program-book3s-pmcs-with-values-0x80000000.patch b/queue-3.4/powerpc-perf-never-program-book3s-pmcs-with-values-0x80000000.patch new file mode 100644 index 00000000000..48b38ef8042 --- /dev/null +++ b/queue-3.4/powerpc-perf-never-program-book3s-pmcs-with-values-0x80000000.patch @@ -0,0 +1,57 @@ +From f56029410a13cae3652d1f34788045c40a13ffc7 Mon Sep 17 00:00:00 2001 +From: Anton Blanchard +Date: Thu, 29 May 2014 08:15:38 +1000 +Subject: powerpc/perf: Never program book3s PMCs with values >= 0x80000000 + +From: Anton Blanchard + +commit f56029410a13cae3652d1f34788045c40a13ffc7 upstream. + +We are seeing a lot of PMU warnings on POWER8: + + Can't find PMC that caused IRQ + +Looking closer, the active PMC is 0 at this point and we took a PMU +exception on the transition from negative to 0. Some versions of POWER8 +have an issue where they edge detect and not level detect PMC overflows. + +A number of places program the PMC with (0x80000000 - period_left), +where period_left can be negative. We can either fix all of these or +just ensure that period_left is always >= 1. + +This patch takes the second option. + +Signed-off-by: Anton Blanchard +Signed-off-by: Benjamin Herrenschmidt +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/perf/core-book3s.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +--- a/arch/powerpc/perf/core-book3s.c ++++ b/arch/powerpc/perf/core-book3s.c +@@ -472,7 +472,22 @@ static void power_pmu_read(struct perf_e + } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev); + + local64_add(delta, &event->count); +- local64_sub(delta, &event->hw.period_left); ++ ++ /* ++ * A number of places program the PMC with (0x80000000 - period_left). ++ * We never want period_left to be less than 1 because we will program ++ * the PMC with a value >= 0x800000000 and an edge detected PMC will ++ * roll around to 0 before taking an exception. We have seen this ++ * on POWER8. ++ * ++ * To fix this, clamp the minimum value of period_left to 1. ++ */ ++ do { ++ prev = local64_read(&event->hw.period_left); ++ val = prev - delta; ++ if (val < 1) ++ val = 1; ++ } while (local64_cmpxchg(&event->hw.period_left, prev, val) != prev); + } + + /* diff --git a/queue-3.4/series b/queue-3.4/series index 343e24d7239..12e5c3f453b 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -2,3 +2,6 @@ usb-option-add-id-for-telewell-tw-lte-4g-v2.patch usb-cp210x-add-support-for-corsair-usb-dongle.patch usb-ftdi_sio-add-extra-pid.patch cpuset-mempolicy-fix-sleeping-function-called-from-invalid-context.patch +hwmon-amc6821-fix-permissions-for-temp2_input.patch +hwmon-adm1029-ensure-the-fan_div-cache-is-updated-in-set_fan_div.patch +powerpc-perf-never-program-book3s-pmcs-with-values-0x80000000.patch -- 2.47.3