aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-05-09 17:28:41 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-05-10 04:47:35 -0400
commit9ed0985332a6576efbc3e435459a857e50e0d72c (patch)
tree7ce977c8cd154a648b135c6ca01c5253eb14ce71
parent8f5e823f9131a430b12f73e9436d7486e20c16f5 (diff)
x86: intel_epb: Take CONFIG_PM into account
Commit b9c273babce7 ("PM / arch: x86: MSR_IA32_ENERGY_PERF_BIAS sysfs interface") caused kernels built with CONFIG_PM unset to crash on systems supporting the Performance and Energy Bias Hint (EPB), because it attempts to add files to sysfs directories that don't exist on those systems. Prevent that from happening by taking CONFIG_PM into account so that the code depending on it is not compiled at all when it is not set. Fixes: b9c273babce7 ("PM / arch: x86: MSR_IA32_ENERGY_PERF_BIAS sysfs interface") Reported-by: Ido Schimmel <idosch@mellanox.com> Tested-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/cpu/intel_epb.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/intel_epb.c b/arch/x86/kernel/cpu/intel_epb.c
index f4dd73396f28..ebb14a26f117 100644
--- a/arch/x86/kernel/cpu/intel_epb.c
+++ b/arch/x86/kernel/cpu/intel_epb.c
@@ -97,6 +97,7 @@ static void intel_epb_restore(void)
97 wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, (epb & ~EPB_MASK) | val); 97 wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, (epb & ~EPB_MASK) | val);
98} 98}
99 99
100#ifdef CONFIG_PM
100static struct syscore_ops intel_epb_syscore_ops = { 101static struct syscore_ops intel_epb_syscore_ops = {
101 .suspend = intel_epb_save, 102 .suspend = intel_epb_save,
102 .resume = intel_epb_restore, 103 .resume = intel_epb_restore,
@@ -193,6 +194,25 @@ static int intel_epb_offline(unsigned int cpu)
193 return 0; 194 return 0;
194} 195}
195 196
197static inline void register_intel_ebp_syscore_ops(void)
198{
199 register_syscore_ops(&intel_epb_syscore_ops);
200}
201#else /* !CONFIG_PM */
202static int intel_epb_online(unsigned int cpu)
203{
204 intel_epb_restore();
205 return 0;
206}
207
208static int intel_epb_offline(unsigned int cpu)
209{
210 return intel_epb_save();
211}
212
213static inline void register_intel_ebp_syscore_ops(void) {}
214#endif
215
196static __init int intel_epb_init(void) 216static __init int intel_epb_init(void)
197{ 217{
198 int ret; 218 int ret;
@@ -206,7 +226,7 @@ static __init int intel_epb_init(void)
206 if (ret < 0) 226 if (ret < 0)
207 goto err_out_online; 227 goto err_out_online;
208 228
209 register_syscore_ops(&intel_epb_syscore_ops); 229 register_intel_ebp_syscore_ops();
210 return 0; 230 return 0;
211 231
212err_out_online: 232err_out_online: