diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-05-02 15:54:37 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-05-12 08:03:14 -0400 |
commit | 0a3b15ac3cc3ddc791901e12bdc930b5fa11a30a (patch) | |
tree | 63de3276107f6aa99686cdcb472ed39a87edd4d9 | |
parent | f722406faae2d073cc1d01063d1123c35425939e (diff) |
ACPI / PM: Move processor suspend/resume to syscore_ops
The system suspend routine of the ACPI processor driver saves
the BUS_MASTER_RLD register and its resume routine restores it.
However, there can be only one such register in the system and it
really should be saved after non-boot CPUs have been offlined and
restored before they are put back online during resume.
For this reason, move the saving and restoration of BUS_MASTER_RLD
to syscore suspend and syscore resume, respectively, and drop the no
longer necessary suspend/resume callbacks from the ACPI processor
driver.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/processor_driver.c | 8 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 29 | ||||
-rw-r--r-- | include/acpi/processor.h | 10 |
3 files changed, 31 insertions, 16 deletions
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index bec717ffd25f..c266cdc11784 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -95,9 +95,6 @@ static const struct acpi_device_id processor_device_ids[] = { | |||
95 | }; | 95 | }; |
96 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); | 96 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); |
97 | 97 | ||
98 | static SIMPLE_DEV_PM_OPS(acpi_processor_pm, | ||
99 | acpi_processor_suspend, acpi_processor_resume); | ||
100 | |||
101 | static struct acpi_driver acpi_processor_driver = { | 98 | static struct acpi_driver acpi_processor_driver = { |
102 | .name = "processor", | 99 | .name = "processor", |
103 | .class = ACPI_PROCESSOR_CLASS, | 100 | .class = ACPI_PROCESSOR_CLASS, |
@@ -107,7 +104,6 @@ static struct acpi_driver acpi_processor_driver = { | |||
107 | .remove = acpi_processor_remove, | 104 | .remove = acpi_processor_remove, |
108 | .notify = acpi_processor_notify, | 105 | .notify = acpi_processor_notify, |
109 | }, | 106 | }, |
110 | .drv.pm = &acpi_processor_pm, | ||
111 | }; | 107 | }; |
112 | 108 | ||
113 | #define INSTALL_NOTIFY_HANDLER 1 | 109 | #define INSTALL_NOTIFY_HANDLER 1 |
@@ -934,6 +930,8 @@ static int __init acpi_processor_init(void) | |||
934 | if (result < 0) | 930 | if (result < 0) |
935 | return result; | 931 | return result; |
936 | 932 | ||
933 | acpi_processor_syscore_init(); | ||
934 | |||
937 | acpi_processor_install_hotplug_notify(); | 935 | acpi_processor_install_hotplug_notify(); |
938 | 936 | ||
939 | acpi_thermal_cpufreq_init(); | 937 | acpi_thermal_cpufreq_init(); |
@@ -956,6 +954,8 @@ static void __exit acpi_processor_exit(void) | |||
956 | 954 | ||
957 | acpi_processor_uninstall_hotplug_notify(); | 955 | acpi_processor_uninstall_hotplug_notify(); |
958 | 956 | ||
957 | acpi_processor_syscore_exit(); | ||
958 | |||
959 | acpi_bus_unregister_driver(&acpi_processor_driver); | 959 | acpi_bus_unregister_driver(&acpi_processor_driver); |
960 | 960 | ||
961 | return; | 961 | return; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f0df2c9434d2..eb133c77aadb 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/sched.h> /* need_resched() */ | 34 | #include <linux/sched.h> /* need_resched() */ |
35 | #include <linux/clockchips.h> | 35 | #include <linux/clockchips.h> |
36 | #include <linux/cpuidle.h> | 36 | #include <linux/cpuidle.h> |
37 | #include <linux/syscore_ops.h> | ||
37 | 38 | ||
38 | /* | 39 | /* |
39 | * Include the apic definitions for x86 to have the APIC timer related defines | 40 | * Include the apic definitions for x86 to have the APIC timer related defines |
@@ -210,33 +211,41 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, | |||
210 | 211 | ||
211 | #endif | 212 | #endif |
212 | 213 | ||
214 | #ifdef CONFIG_PM_SLEEP | ||
213 | static u32 saved_bm_rld; | 215 | static u32 saved_bm_rld; |
214 | 216 | ||
215 | static void acpi_idle_bm_rld_save(void) | 217 | int acpi_processor_suspend(void) |
216 | { | 218 | { |
217 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); | 219 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); |
220 | return 0; | ||
218 | } | 221 | } |
219 | static void acpi_idle_bm_rld_restore(void) | 222 | |
223 | void acpi_processor_resume(void) | ||
220 | { | 224 | { |
221 | u32 resumed_bm_rld; | 225 | u32 resumed_bm_rld; |
222 | 226 | ||
223 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); | 227 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); |
228 | if (resumed_bm_rld == saved_bm_rld) | ||
229 | return; | ||
224 | 230 | ||
225 | if (resumed_bm_rld != saved_bm_rld) | 231 | acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); |
226 | acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); | ||
227 | } | 232 | } |
228 | 233 | ||
229 | int acpi_processor_suspend(struct device *dev) | 234 | static struct syscore_ops acpi_processor_syscore_ops = { |
235 | .suspend = acpi_processor_suspend, | ||
236 | .resume = acpi_processor_resume, | ||
237 | }; | ||
238 | |||
239 | void acpi_processor_syscore_init(void) | ||
230 | { | 240 | { |
231 | acpi_idle_bm_rld_save(); | 241 | register_syscore_ops(&acpi_processor_syscore_ops); |
232 | return 0; | ||
233 | } | 242 | } |
234 | 243 | ||
235 | int acpi_processor_resume(struct device *dev) | 244 | void acpi_processor_syscore_exit(void) |
236 | { | 245 | { |
237 | acpi_idle_bm_rld_restore(); | 246 | unregister_syscore_ops(&acpi_processor_syscore_ops); |
238 | return 0; | ||
239 | } | 247 | } |
248 | #endif /* CONFIG_PM_SLEEP */ | ||
240 | 249 | ||
241 | #if defined(CONFIG_X86) | 250 | #if defined(CONFIG_X86) |
242 | static void tsc_check_state(int state) | 251 | static void tsc_check_state(int state) |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index b327b5a9296d..ea69367fdd3b 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -329,10 +329,16 @@ int acpi_processor_power_init(struct acpi_processor *pr); | |||
329 | int acpi_processor_power_exit(struct acpi_processor *pr); | 329 | int acpi_processor_power_exit(struct acpi_processor *pr); |
330 | int acpi_processor_cst_has_changed(struct acpi_processor *pr); | 330 | int acpi_processor_cst_has_changed(struct acpi_processor *pr); |
331 | int acpi_processor_hotplug(struct acpi_processor *pr); | 331 | int acpi_processor_hotplug(struct acpi_processor *pr); |
332 | int acpi_processor_suspend(struct device *dev); | ||
333 | int acpi_processor_resume(struct device *dev); | ||
334 | extern struct cpuidle_driver acpi_idle_driver; | 332 | extern struct cpuidle_driver acpi_idle_driver; |
335 | 333 | ||
334 | #ifdef CONFIG_PM_SLEEP | ||
335 | void acpi_processor_syscore_init(void); | ||
336 | void acpi_processor_syscore_exit(void); | ||
337 | #else | ||
338 | static inline void acpi_processor_syscore_init(void) {} | ||
339 | static inline void acpi_processor_syscore_exit(void) {} | ||
340 | #endif | ||
341 | |||
336 | /* in processor_thermal.c */ | 342 | /* in processor_thermal.c */ |
337 | int acpi_processor_get_limit_info(struct acpi_processor *pr); | 343 | int acpi_processor_get_limit_info(struct acpi_processor *pr); |
338 | extern const struct thermal_cooling_device_ops processor_cooling_ops; | 344 | extern const struct thermal_cooling_device_ops processor_cooling_ops; |