diff options
author | Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> | 2014-08-03 05:24:05 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-08-05 01:40:41 -0400 |
commit | 6174bac8c7ff73a86ae9a967d1c9cadc478023ae (patch) | |
tree | a5ac87e70111d42797dc6aa68eb61e3a4cfa6177 /drivers/cpufreq | |
parent | b00fc6ec1f24f9d7af9b8988b6a198186eb3408c (diff) |
powerpc/cpufreq: Add pr_warn() on OPAL firmware failures
Cpufreq depends on platform firmware to implement PStates. In case of
platform firmware failure, cpufreq should not panic host kernel with
BUG_ON(). Less severe pr_warn() will suffice.
Add firmware_has_feature(FW_FEATURE_OPALv3) check to
skip probing for device-tree on non-powernv platforms.
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Acked-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/powernv-cpufreq.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index bb1d08dc8cc8..379c0837f5a9 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/of.h> | 28 | #include <linux/of.h> |
29 | 29 | ||
30 | #include <asm/cputhreads.h> | 30 | #include <asm/cputhreads.h> |
31 | #include <asm/firmware.h> | ||
31 | #include <asm/reg.h> | 32 | #include <asm/reg.h> |
32 | #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */ | 33 | #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */ |
33 | 34 | ||
@@ -98,7 +99,11 @@ static int init_powernv_pstates(void) | |||
98 | return -ENODEV; | 99 | return -ENODEV; |
99 | } | 100 | } |
100 | 101 | ||
101 | WARN_ON(len_ids != len_freqs); | 102 | if (len_ids != len_freqs) { |
103 | pr_warn("Entries in ibm,pstate-ids and " | ||
104 | "ibm,pstate-frequencies-mhz does not match\n"); | ||
105 | } | ||
106 | |||
102 | nr_pstates = min(len_ids, len_freqs) / sizeof(u32); | 107 | nr_pstates = min(len_ids, len_freqs) / sizeof(u32); |
103 | if (!nr_pstates) { | 108 | if (!nr_pstates) { |
104 | pr_warn("No PStates found\n"); | 109 | pr_warn("No PStates found\n"); |
@@ -131,7 +136,12 @@ static unsigned int pstate_id_to_freq(int pstate_id) | |||
131 | int i; | 136 | int i; |
132 | 137 | ||
133 | i = powernv_pstate_info.max - pstate_id; | 138 | i = powernv_pstate_info.max - pstate_id; |
134 | BUG_ON(i >= powernv_pstate_info.nr_pstates || i < 0); | 139 | if (i >= powernv_pstate_info.nr_pstates || i < 0) { |
140 | pr_warn("PState id %d outside of PState table, " | ||
141 | "reporting nominal id %d instead\n", | ||
142 | pstate_id, powernv_pstate_info.nominal); | ||
143 | i = powernv_pstate_info.max - powernv_pstate_info.nominal; | ||
144 | } | ||
135 | 145 | ||
136 | return powernv_freqs[i].frequency; | 146 | return powernv_freqs[i].frequency; |
137 | } | 147 | } |
@@ -321,6 +331,10 @@ static int __init powernv_cpufreq_init(void) | |||
321 | { | 331 | { |
322 | int rc = 0; | 332 | int rc = 0; |
323 | 333 | ||
334 | /* Don't probe on pseries (guest) platforms */ | ||
335 | if (!firmware_has_feature(FW_FEATURE_OPALv3)) | ||
336 | return -ENODEV; | ||
337 | |||
324 | /* Discover pstates from device tree and init */ | 338 | /* Discover pstates from device tree and init */ |
325 | rc = init_powernv_pstates(); | 339 | rc = init_powernv_pstates(); |
326 | if (rc) { | 340 | if (rc) { |