Shutdown from reboot_cpuid without stopping other cpus.
Subsystems (35)
cover Shutdown from reboot_cpuid without stopping other cpus.
We recently noticed that reboot of a 1024 cpu machine takes approx 16 minutes of just stopping the cpus. The slowdown was tracked to commit f96972f.
The current implementation does all the work of hot removing the cpus before halting the system. We are switching to just migrating to the reboot_cpu and then continuing with shutdown/reboot.
The patch set is broken into eleven parts. The first two are planned for the stable release. The others move the halt/shutdown/reboot related functions to their own kernel/reboot.c file and then move the handling of the kernel reboot= kernel parameter to generic kernel code.
Changes since -v7.
- Fixed authorship for first patch.
- Rebased to Linus' current tree (51a26ae7a).
Changes since -v6.
- Cross compiled all arm architectures (using v3.9 kernel. Fails with current).
- Added a #define for non-hotplug case.
- Add #define for PF_THREAD_BOUND as compatibility to make stable easier.
- Fixup s/reboot_cpu_id/reboot_cpu/
- Add include of linux/uaccess.h to allow building on arm.
- Removed last remaining checkpatch.pl line length warning on kernel/reboot.c.
- Fixed the duplicate handling or the reboot= kernel parameter.
Changes since -v5.
- Moved the arch/x86 reboot= up to the generic kernel code.
Changes since -v4.
- Integrated Srivatsa S. Bhat creating cpu_hotplug_disable() function
- Integrated comments by Srivatsa S. Bhat.
- Made one more comment consistent with others in function.
Changes since -v3.
- Added a tested-by for the original reporter.
- Fix compile failure found by Joe Perches.
- Integrated comments by Joe Perches.
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
PATCH 1/11 CPU hotplug: Provide a generic helper to disable/enable CPU hotplug
From: "Srivatsa S. Bhat" <[email protected]>
There are instances in the kernel where we would like to disable CPU hotplug (from sysfs) during some important operation. Today the freezer code depends on this and the code to do it was kinda tailor-made for that.
Restructure the code and make it generic enough to be useful for other usecases too.
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
Cc: <[email protected]>
---
Changes since -v6:
- Added a #define for non-hotplug case.
--- include/linux/cpu.h | 3 +++ kernel/cpu.c | 27 +++++++++------------------ 2 files changed, 12 insertions(+), 18 deletions(-)
include/linux/cpu.h +3 -0
@@ -141,6 +141,8 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb) }#endif +extern void cpu_hotplug_disable (void ); +extern void cpu_hotplug_enable (void );int cpu_up (unsigned int cpu);void notify_cpu_starting (unsigned int cpu);extern void cpu_maps_update_begin (void );
@@ -148,6 +150,7 @@ extern void cpu_maps_update_done(void);#else /* CONFIG_SMP */ +#define cpu_hotplug_disable () do { } while (0)#define cpu_notifier (fn, pri) do { (void)(fn); } while (0)static inline int register_cpu_notifier (struct notifier_block *nb)
kernel/cpu.c +9 -18
@@ -541,29 +541,20 @@ static int __init alloc_frozen_cpus(void)core_initcall (alloc_frozen_cpus);/* -* Prevent regular CPU hotplug from racing with the freezer, by disabling CPU -* hotplug when tasks are about to be frozen. Also, don't allow the freezer -* to continue until any currently running CPU hotplug operation gets -* completed. -* To modify the 'cpu_hotplug_disabled' flag, we need to acquire the -* 'cpu_add_remove_lock'. And this same lock is also taken by the regular -* CPU hotplug path and released only after it is complete. Thus, we -* (and hence the freezer) will block here until any currently running CPU -* hotplug operation gets completed. +* Wait for currently running CPU hotplug operations to complete (if any) and +* disable future CPU hotplug (from sysfs). The 'cpu_add_remove_lock' protects +* the 'cpu_hotplug_disabled' flag. The same lock is also acquired by the +* hotplug path before performing hotplug operations. So acquiring that lock +* guarantees mutual exclusion from any currently running hotplug operations. */ -void cpu_hotplug_disable_before_freeze (void ) +void cpu_hotplug_disable (void ) {cpu_maps_update_begin (); cpu_hotplug_disabled =1 ;cpu_maps_update_done (); } - -/* -* When tasks have been thawed, re-enable regular CPU hotplug (which had been -* disabled while beginning to freeze tasks). -*/ -void cpu_hotplug_enable_after_thaw (void ) +void cpu_hotplug_enable (void ) {cpu_maps_update_begin (); cpu_hotplug_disabled =0 ;
@@ -589,12 +580,12 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,case PM_SUSPEND_PREPARE :case PM_HIBERNATION_PREPARE : -cpu_hotplug_disable_before_freeze (); +cpu_hotplug_disable ();break ;case PM_POST_SUSPEND :case PM_POST_HIBERNATION : -cpu_hotplug_enable_after_thaw (); +cpu_hotplug_enable ();break ;default :
Signature · 1 line
1.8.2.1
Re: [PATCH -v8 01/11] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug
Quoted 24 lines · On Tue, 7 May 2013 09:39:45 -0500 Robin Holt <[email protected]> wrote:
From: "Srivatsa S. Bhat" <[email protected]>
There are instances in the kernel where we would like to disable CPU hotplug (from sysfs) during some important operation. Today the freezer code depends on this and the code to do it was kinda tailor-made for that.
Restructure the code and make it generic enough to be useful for other usecases too.
...
include/linux/cpu.h +2
-0@@ -141,6 +141,8 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb) }#endif +extern void cpu_hotplug_disable (void ); +extern void cpu_hotplug_enable (void );int cpu_up (unsigned int cpu);void notify_cpu_starting (unsigned int cpu);extern void cpu_maps_update_begin (void );
include/linux/cpu.h extern void cpu_maps_update_done(void); · line 155
Quoted 6 lines
include/linux/cpu.h +1
-0@@ -148,6 +150,7 @@ extern void cpu_maps_update_done(void);#else /* CONFIG_SMP */ +#define cpu_hotplug_disable () do { } while (0)#define cpu_notifier (fn, pri) do { (void)(fn); } while (0)
Breaks alpha allmodconfig because cpu_hotplug_disable() is absent from vmlinux.
cpu_hotplug_disable() doesn't get compiled unless we've defined CONFIG_PM_SLEEP_SMP. I cannot begin to imagine what the logic is behind that!
I'll stick this in there and see what happens.
include/linux/cpu.h renamed from include/linux/cpu.h~cpu-hotplug-provide-a-generic-helper-to-disable-enable-cpu-hotplug-fix +9 -3
@@ -141,8 +141,6 @@ static inline void unregister_cpu_notifi }#endif -extern void cpu_hotplug_disable (void ); -extern void cpu_hotplug_enable (void );int cpu_up (unsigned int cpu);void notify_cpu_starting (unsigned int cpu);extern void cpu_maps_update_begin (void );
@@ -150,7 +148,6 @@ extern void cpu_maps_update_done(void);#else /* CONFIG_SMP */ -#define cpu_hotplug_disable () do { } while (0)#define cpu_notifier (fn, pri) do { (void)(fn); } while (0)static inline int register_cpu_notifier (struct notifier_block *nb)
@@ -171,6 +168,15 @@ static inline void cpu_maps_update_done( }#endif /* CONFIG_SMP */ + +#ifdef CONFIG_PM_SLEEP_SMP +extern void cpu_hotplug_enable (void ); +extern void cpu_hotplug_disable (void ); +#else +#define cpu_hotplug_enable () do { } while (0) +#define cpu_hotplug_disable () do { } while (0) +#endif +extern struct bus_type cpu_subsys;#ifdef CONFIG_HOTPLUG_CPU
Re: [PATCH -v8 01/11] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug
Quoted 36 lines · Andrew Morton
Quoted 24 lines · On Tue, 7 May 2013 09:39:45 -0500 Robin Holt <[email protected]> wrote:
From: "Srivatsa S. Bhat" <[email protected]>
There are instances in the kernel where we would like to disable CPU hotplug (from sysfs) during some important operation. Today the freezer code depends on this and the code to do it was kinda tailor-made for that.
Restructure the code and make it generic enough to be useful for other usecases too.
...
include/linux/cpu.h +2
-0@@ -141,6 +141,8 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb) }#endif +extern void cpu_hotplug_disable (void ); +extern void cpu_hotplug_enable (void );int cpu_up (unsigned int cpu);void notify_cpu_starting (unsigned int cpu);extern void cpu_maps_update_begin (void );include/linux/cpu.h extern void cpu_maps_update_done(void); · line 155
Quoted 6 lines
include/linux/cpu.h +1
-0@@ -148,6 +150,7 @@ extern void cpu_maps_update_done(void);#else /* CONFIG_SMP */ +#define cpu_hotplug_disable () do { } while (0)#define cpu_notifier (fn, pri) do { (void)(fn); } while (0)Breaks alpha allmodconfig because
cpu_hotplug_disable()is absent from vmlinux.
Quoted 3 lines
cpu_hotplug_disable()doesn't get compiled unless we've definedCONFIG_PM_SLEEP_SMP. I cannot begin to imagine what the logic is behind that!
I suppose it was only used by suspend/hibernate code paths when this was introduced.
Thanks,
Rafael
Re: [PATCH -v8 01/11] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug
Quoted 8 lines · On Fri, 10 May 2013 13:11:51 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
...
Quoted 3 lines
cpu_hotplug_disable()doesn't get compiled unless we've definedCONFIG_PM_SLEEP_SMP. I cannot begin to imagine what the logic is behind that!I suppose it was only used by suspend/hibernate code paths when this was introduced.
OK, well I suspect that what I have now is simply wrong for Robin's application. Robin, can you please check this? We probably want to make the does-something version of cpu_hotplug_disable/enable available if CONFIG_HOTPLUG_CPU.
Re: [PATCH -v8 01/11] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug
Quoted 8 lines · Andrew Morton
Quoted 6 lines · On Fri, 10 May 2013 13:11:51 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
...
Quoted 3 lines
cpu_hotplug_disable()doesn't get compiled unless we've definedCONFIG_PM_SLEEP_SMP. I cannot begin to imagine what the logic is behind that!
Quoted 7 lines
Quoted 2 lines
I suppose it was only used by suspend/hibernate code paths when this was introduced.
OK, well I suspect that what I have now is simply wrong for Robin's application. Robin, can you please check this? We probably want to make the does-something version of cpu_hotplug_disable/enable available if
CONFIG_HOTPLUG_CPU.
This patch came from "Srivatsa S. Bhat" <[email protected]>, I think I need to defer.
I spent all day trying to get an alpha cross compiler to build an unmodified kernel and modules, only to find I didn't need to go that far and could reproduce the failure with just building vmlinux.
Sorry for my slow response,
Robin
Re: [PATCH -v8 01/11] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug
Quoted 12 lines · Robin Holt
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Fri, 10 May 2013 13:11:51 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
...
Quoted 3 lines
cpu_hotplug_disable()doesn't get compiled unless we've definedCONFIG_PM_SLEEP_SMP. I cannot begin to imagine what the logic is behind that!I suppose it was only used by suspend/hibernate code paths when this was introduced.
Quoted 7 lines
Quoted 4 lines
OK, well I suspect that what I have now is simply wrong for Robin's application. Robin, can you please check this? We probably want to make the does-something version of cpu_hotplug_disable/enable available if
CONFIG_HOTPLUG_CPU.This patch came from "Srivatsa S. Bhat" <[email protected]>, I think I need to defer.
Here is a revised patch, which should address all the problems, IMHO. Let me know if you face any issues. (And thanks a lot for fixing up the !SMP case in the previous version.)
--------------------------------------------------------------------->
From: Srivatsa S. Bhat <[email protected]>
Subject: [PATCH] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug
There are instances in the kernel where we would like to disable CPU hotplug (from sysfs) during some important operation. Today the freezer code depends on this and the code to do it was kinda tailor-made for that.
Restructure the code and make it generic enough to be useful for other usecases too.
---
include/linux/cpu.h | 4 ++++ kernel/cpu.c | 55 +++++++++++++++++++++------------------------------ 2 files changed, 27 insertions(+), 32 deletions(-)
include/linux/cpu.h +4 -0
@@ -175,6 +175,8 @@ extern struct bus_type cpu_subsys;extern void get_online_cpus (void );extern void put_online_cpus (void ); +extern void cpu_hotplug_disable (void ); +extern void cpu_hotplug_enable (void );#define hotcpu_notifier (fn, pri) cpu_notifier(fn, pri)#define register_hotcpu_notifier (nb) register_cpu_notifier(nb)#define unregister_hotcpu_notifier (nb) unregister_cpu_notifier(nb)
@@ -198,6 +200,8 @@ static inline void cpu_hotplug_driver_unlock(void)#define get_online_cpus () do { } while (0)#define put_online_cpus () do { } while (0) +#define cpu_hotplug_disable () do { } while (0) +#define cpu_hotplug_enable () do { } while (0)#define hotcpu_notifier (fn, pri) do { (void)(fn); } while (0)/* These aren't inline functions due to a GCC bug. */ #define register_hotcpu_notifier (nb) ({ (void)(nb); 0; })
kernel/cpu.c +23 -32
77 lines not on this page · raw message
Re: [PATCH -v8 01/11] CPU hotplug: Provide a generic helper to disable/enable CPU hotplug
Thank you. That fixed the alpha allmodconfig case for me. I am currently rebuilding all the arm defconfig files and will resubmit -v10 when that is done.
Robin
Quoted 152 lines · Srivatsa S. Bhat
Quoted 12 lines · Robin Holt
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Fri, 10 May 2013 13:11:51 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
...
Quoted 3 lines
cpu_hotplug_disable()doesn't get compiled unless we've definedCONFIG_PM_SLEEP_SMP. I cannot begin to imagine what the logic is behind that!I suppose it was only used by suspend/hibernate code paths when this was introduced.
Quoted 7 lines
Quoted 4 lines
OK, well I suspect that what I have now is simply wrong for Robin's application. Robin, can you please check this? We probably want to make the does-something version of cpu_hotplug_disable/enable available if
CONFIG_HOTPLUG_CPU.This patch came from "Srivatsa S. Bhat" <[email protected]>, I think I need to defer.
Here is a revised patch, which should address all the problems, IMHO. Let me know if you face any issues. (And thanks a lot for fixing up the !SMP case in the previous version.)
--------------------------------------------------------------------->
From: Srivatsa S. Bhat <[email protected]>
Subject: [PATCH] CPU hotplug: Provide a generic helper to disable/enable CPU hotplugThere are instances in the kernel where we would like to disable CPU hotplug (from sysfs) during some important operation. Today the freezer code depends on this and the code to do it was kinda tailor-made for that.
Restructure the code and make it generic enough to be useful for other usecases too.
Signed-off-by Srivatsa S. Bhat <[email protected]>---
include/linux/cpu.h | 4 ++++ kernel/cpu.c | 55 +++++++++++++++++++++------------------------------ 2 files changed, 27 insertions(+), 32 deletions(-)include/linux/cpu.h +4
-0@@ -175,6 +175,8 @@ extern struct bus_type cpu_subsys;extern void get_online_cpus (void );extern void put_online_cpus (void ); +extern void cpu_hotplug_disable (void ); +extern void cpu_hotplug_enable (void );#define hotcpu_notifier (fn, pri) cpu_notifier(fn, pri)#define register_hotcpu_notifier (nb) register_cpu_notifier(nb)#define unregister_hotcpu_notifier (nb) unregister_cpu_notifier(nb)@@ -198,6 +200,8 @@ static inline void cpu_hotplug_driver_unlock(void)#define get_online_cpus () do { } while (0)#define put_online_cpus () do { } while (0) +#define cpu_hotplug_disable () do { } while (0) +#define cpu_hotplug_enable () do { } while (0)#define hotcpu_notifier (fn, pri) do { (void)(fn); } while (0)/* These aren't inline functions due to a GCC bug. */ #define register_hotcpu_notifier (nb) ({ (void)(nb); 0; })kernel/cpu.c +23
-32@@ -133,6 +133,27 @@ static void cpu_hotplug_done(void) mutex_unlock(&cpu_hotplug.lock); } +/* +* Wait for currently running CPU hotplug operations to complete (if any) and +* disable future CPU hotplug (from sysfs). The 'cpu_add_remove_lock' protects +* the 'cpu_hotplug_disabled' flag. The same lock is also acquired by the +* hotplug path before performing hotplug operations. So acquiring that lock +* guarantees mutual exclusion from any currently running hotplug operations. +*/ +void cpu_hotplug_disable (void ) +{ +cpu_maps_update_begin (); + cpu_hotplug_disabled =1 ; +cpu_maps_update_done (); +} + +void cpu_hotplug_enable (void ) +{ +cpu_maps_update_begin (); + cpu_hotplug_disabled =0 ; +cpu_maps_update_done (); +} +#else /* #if CONFIG_HOTPLUG_CPU */ static void cpu_hotplug_begin (void ) {}static void cpu_hotplug_done (void ) {}@@ -541,36 +562,6 @@ static int __init alloc_frozen_cpus(void)core_initcall (alloc_frozen_cpus);/* -* Prevent regular CPU hotplug from racing with the freezer, by disabling CPU -* hotplug when tasks are about to be frozen. Also, don't allow the freezer -* to continue until any currently running CPU hotplug operation gets -* completed. -* To modify the 'cpu_hotplug_disabled' flag, we need to acquire the -* 'cpu_add_remove_lock'. And this same lock is also taken by the regular -* CPU hotplug path and released only after it is complete. Thus, we -* (and hence the freezer) will block here until any currently running CPU -* hotplug operation gets completed. -*/ -void cpu_hotplug_disable_before_freeze (void ) -{ -cpu_maps_update_begin (); - cpu_hotplug_disabled =1 ; -cpu_maps_update_done (); -} - - -/* -* When tasks have been thawed, re-enable regular CPU hotplug (which had been -* disabled while beginning to freeze tasks). -*/ -void cpu_hotplug_enable_after_thaw (void ) -{ -cpu_maps_update_begin (); - cpu_hotplug_disabled =0 ; -cpu_maps_update_done (); -} - -/* * When callbacks for CPU hotplug notifications are being executed, we must * ensure that the state of the system with respect to the tasks being frozen * or not, as reported by the notification, remains unchanged *throughout the @@ -589,12 +580,12 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,case PM_SUSPEND_PREPARE :case PM_HIBERNATION_PREPARE : -cpu_hotplug_disable_before_freeze (); +cpu_hotplug_disable ();break ;case PM_POST_SUSPEND :case PM_POST_HIBERNATION : -cpu_hotplug_enable_after_thaw (); +cpu_hotplug_enable ();break ;default :
PATCH 2/11 Migrate shutdown/reboot to boot cpu.
In reply to Robin HoltWe recently noticed that reboot of a 1024 cpu machine takes approx 16 minutes of just stopping the cpus. The slowdown was tracked to commit f96972f.
The current implementation does all the work of hot removing the cpus before halting the system. We are switching to just migrating to the boot cpu and then continuing with shutdown/reboot.
This also has the effect of not breaking x86's command line parameter for specifying the reboot cpu. Note, this code was shamelessly copied from arch/x86/kernel/reboot.c with bits removed pertaining to the reboot_cpu command line parameter.
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
Cc: <[email protected]>
---
Changes since -v6:
- Add #define for PF_THREAD_BOUND as compatibility to make stable easier.
- Fixup s/reboot_cpu_id/reboot_cpu/
--- kernel/sys.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
kernel/sys.c +26 -3
@@ -362,6 +362,29 @@ int unregister_reboot_notifier(struct notifier_block *nb) }EXPORT_SYMBOL (unregister_reboot_notifier); +/* Add backwards compatibility for stable trees. */ +#ifndef PF_NO_SETAFFINITY +#define PF_NO_SETAFFINITY PF_THREAD_BOUND +#endif + +static void migrate_to_reboot_cpu (void ) +{ +/* The boot cpu is always logical cpu 0 */ +int reboot_cpu =0 ; + +cpu_hotplug_disable (); + +/* Make certain the cpu I'm about to reboot on is online */ +if (!cpu_online (reboot_cpu)) + reboot_cpu =cpumask_first (cpu_online_mask); + +/* Prevent races with other tasks migrating this task */ + current->flags |=PF_NO_SETAFFINITY ; + +/* Make certain I only run on the appropriate processor */ +set_cpus_allowed_ptr (current,cpumask_of (reboot_cpu)); +} +/** * kernel_restart - reboot the system * @cmd: pointer to buffer containing command to execute for restart
@@ -373,7 +396,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier);void kernel_restart (char *cmd) {kernel_restart_prepare (cmd); -disable_nonboot_cpus (); +migrate_to_reboot_cpu ();syscore_shutdown ();if (!cmd)printk (KERN_EMERG "Restarting system.\n" );
@@ -400,7 +423,7 @@ static void kernel_shutdown_prepare(enum system_states state)void kernel_halt (void ) {kernel_shutdown_prepare (SYSTEM_HALT ); -disable_nonboot_cpus (); +migrate_to_reboot_cpu ();syscore_shutdown ();printk (KERN_EMERG "System halted.\n" );kmsg_dump (KMSG_DUMP_HALT );
@@ -419,7 +442,7 @@ void kernel_power_off(void)kernel_shutdown_prepare (SYSTEM_POWER_OFF );if (pm_power_off_prepare)pm_power_off_prepare (); -disable_nonboot_cpus (); +migrate_to_reboot_cpu ();syscore_shutdown ();printk (KERN_EMERG "Power down.\n" );kmsg_dump (KMSG_DUMP_POWEROFF );
Signature · 1 line
1.8.2.1
PATCH 3/11 Remove -stable friendly PF_THREAD_BOUND define
In reply to Robin HoltRemove the prior patch's #define for easier backporting to the stable releases.
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
--- kernel/sys.c | 5 ----- 1 file changed, 5 deletions(-)
kernel/sys.c +0 -5
@@ -362,11 +362,6 @@ int unregister_reboot_notifier(struct notifier_block *nb) }EXPORT_SYMBOL (unregister_reboot_notifier); -/* Add backwards compatibility for stable trees. */ -#ifndef PF_NO_SETAFFINITY -#define PF_NO_SETAFFINITY PF_THREAD_BOUND -#endif -static void migrate_to_reboot_cpu (void ) {/* The boot cpu is always logical cpu 0 */
Signature · 1 line
1.8.2.1
PATCH 4/11 Move shutdown/reboot related functions to kernel/reboot.c
In reply to Robin HoltThis patch is preparatory. It moves reboot related syscall, etc functions from kernel/sys.c to kernel/reboot.c.
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
---
Changes since -v6:
- Add include of linux/uaccess.h to allow building on arm.
--- kernel/Makefile | 2 +- kernel/reboot.c | 347 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ kernel/sys.c | 331 ----------------------------------------------------- 3 files changed, 348 insertions(+), 332 deletions(-) create mode 100644 kernel/reboot.c
kernel/Makefile +1 -1
@@ -9,7 +9,7 @@ obj-y = fork.o exec_domain.o panic.o printk.o \ rcupdate.o extable.o params.o posix-timers.o \ kthread.o wait.o sys_ni.o posix-cpu-timers.o mutex.o \ hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ - notifier.o ksysfs.o cred.o \ + notifier.o ksysfs.o cred.o reboot.o \ async.o range.o groups.o lglock.o smpboot.o ifdef CONFIG_FUNCTION_TRACER
kernel/reboot.c new file +347 -0
347 lines not on this page · raw message
kernel/sys.c +0 -331
349 lines not on this page · raw message
Signature · 1 line
1.8.2.1
PATCH 5/11 checkpatch.pl the new kernel/reboot.c file.
In reply to Robin HoltGet the new file to pass scripts/checkpatch.pl
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
---
Changes since v6:
- Removed last remaining line length warning.
--- include/linux/reboot.h | 2 +- kernel/reboot.c | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-)
include/linux/reboot.h +1 -1
@@ -26,7 +26,7 @@ extern void machine_shutdown(void);struct pt_regs ;extern void machine_crash_shutdown (struct pt_regs *); -/* +/* * Architecture independent implemenations of sys_reboot commands. */
kernel/reboot.c +13 -15
@@ -4,6 +4,8 @@* Copyright (C) 2013 Linus Torvalds */ +#define pr_fmt (fmt) "reboot: " fmt +#include <linux/export.h> #include <linux/kexec.h> #include <linux/kmod.h>
@@ -114,9 +116,9 @@ void kernel_restart(char *cmd)migrate_to_reboot_cpu ();syscore_shutdown ();if (!cmd) -printk (KERN_EMERG "Restarting system.\n" ); +pr_emerg ("Restarting system\n" );else -printk (KERN_EMERG "Restarting system with command '%s'.\n" , cmd); +pr_emerg ("Restarting system with command '%s'\n" , cmd);kmsg_dump (KMSG_DUMP_RESTART );machine_restart (cmd); }
@@ -125,7 +127,7 @@ EXPORT_SYMBOL_GPL(kernel_restart);static void kernel_shutdown_prepare (enum system_states state) {blocking_notifier_call_chain (&reboot_notifier_list, - (state ==SYSTEM_HALT )?SYS_HALT :SYS_POWER_OFF ,NULL ); + (state ==SYSTEM_HALT ) ?SYS_HALT :SYS_POWER_OFF ,NULL ); system_state = state;usermodehelper_disable ();device_shutdown ();
@@ -140,11 +142,10 @@ void kernel_halt(void)kernel_shutdown_prepare (SYSTEM_HALT );migrate_to_reboot_cpu ();syscore_shutdown (); -printk (KERN_EMERG "System halted.\n" ); +pr_emerg ("System halted\n" );kmsg_dump (KMSG_DUMP_HALT );machine_halt (); } -EXPORT_SYMBOL_GPL (kernel_halt);/**
@@ -159,7 +160,7 @@ void kernel_power_off(void)pm_power_off_prepare ();migrate_to_reboot_cpu ();syscore_shutdown (); -printk (KERN_EMERG "Power down.\n" ); +pr_emerg ("Power down\n" );kmsg_dump (KMSG_DUMP_POWEROFF );machine_power_off (); }
@@ -188,10 +189,10 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,/* For safety, we require "magic" arguments. */ if (magic1 !=LINUX_REBOOT_MAGIC1 || - (magic2 !=LINUX_REBOOT_MAGIC2 && - magic2 !=LINUX_REBOOT_MAGIC2A && + (magic2 !=LINUX_REBOOT_MAGIC2 && + magic2 !=LINUX_REBOOT_MAGIC2A && magic2 !=LINUX_REBOOT_MAGIC2B && - magic2 !=LINUX_REBOOT_MAGIC2C )) + magic2 !=LINUX_REBOOT_MAGIC2C ))return -EINVAL ;/*
@@ -234,7 +235,8 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,break ;case LINUX_REBOOT_CMD_RESTART2 : -if (strncpy_from_user (&buffer[0 ], arg,sizeof (buffer) -1 ) <0 ) { + ret =strncpy_from_user (&buffer[0 ], arg,sizeof (buffer) -1 ); +if (ret <0 ) { ret = -EFAULT ;break ; }
@@ -282,7 +284,6 @@ void ctrl_alt_del(void)else kill_cad_pid (SIGINT ,1 ); } -char poweroff_cmd[POWEROFF_CMD_PATH_LEN ] ="/sbin/poweroff" ;
@@ -301,14 +302,11 @@ static int __orderly_poweroff(bool force) ret =call_usermodehelper (argv[0 ], argv, envp,UMH_WAIT_EXEC );argv_free (argv); }else { -printk (KERN_WARNING "%s failed to allocate memory for \"%s\"\n" , - __func__, poweroff_cmd); ret = -ENOMEM ; }if (ret && force) { -printk (KERN_WARNING "Failed to start orderly shutdown: " -"forcing the issue\n" ); +pr_warn ("Failed to start orderly shutdown: forcing the issue\n" );/* * I guess this should try to kick off some daemon to sync and * poweroff asap. Or not even bother syncing if we're doing an
Signature · 1 line
1.8.2.1
PATCH 6/11 x86, prepare reboot_mode for moving to generic kernel code.
In reply to Robin HoltThis patch prepares for the moving the parsing of reboot= to the generic kernel code by making reboot_mode into a more generic form.
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Miguel Boton <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
--- arch/x86/kernel/reboot.c | 12 +++++++----- include/linux/reboot.h | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-)
arch/x86/kernel/reboot.c +7 -5
@@ -36,7 +36,7 @@ void (*pm_power_off)(void);EXPORT_SYMBOL (pm_power_off);static const struct desc_ptr no_idt = {}; -static int reboot_mode; +static enum reboot_mode reboot_mode =REBOOT_COLD ;enum reboot_type reboot_type =BOOT_ACPI ;int reboot_force;
@@ -88,11 +88,11 @@ static int __init reboot_setup(char *str)switch (*str) {case 'w' : - reboot_mode =0x1234 ; + reboot_mode =REBOOT_WARM ;break ;case 'c' : - reboot_mode =0 ; + reboot_mode =REBOOT_COLD ;break ;#ifdef CONFIG_SMP
@@ -536,6 +536,7 @@ static void native_machine_emergency_restart(void)int i;int attempt =0 ;int orig_reboot_type = reboot_type; +unsigned short mode;if (reboot_emergency)emergency_vmx_disable_all ();
@@ -543,7 +544,8 @@ static void native_machine_emergency_restart(void)tboot_shutdown (TB_SHUTDOWN_REBOOT );/* Tell the BIOS if we want cold or warm reboot */ - *((unsigned short *)__va (0x472 )) = reboot_mode; + mode = reboot_mode ==REBOOT_WARM ?0x1234 :0 ; + *((unsigned short *)__va (0x472 )) = mode;for (;;) {/* Could also try the reset bit in the Hammer NB */
@@ -585,7 +587,7 @@ static void native_machine_emergency_restart(void)case BOOT_EFI :if (efi_enabled (EFI_RUNTIME_SERVICES )) - efi.reset_system (reboot_mode ? + efi.reset_system (reboot_mode ==REBOOT_WARM ?EFI_RESET_WARM :EFI_RESET_COLD ,EFI_SUCCESS ,0 ,NULL );
include/linux/reboot.h +5 -0
@@ -10,6 +10,11 @@#define SYS_HALT 0x0002/* Notify of system halt */ #define SYS_POWER_OFF 0x0003/* Notify of system power off */ +enum reboot_mode { +REBOOT_COLD =0 , +REBOOT_WARM , +}; +extern int register_reboot_notifier (struct notifier_block *);extern int unregister_reboot_notifier (struct notifier_block *);
Signature · 1 line
1.8.2.1
PATCH 7/11 unicore32, prepare reboot_mode for moving to generic kernel code.
In reply to Robin HoltThis patch prepares for the moving the parsing of reboot= to the generic kernel code by making reboot_mode into a more generic form.
To: Andrew Morton <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Russell King <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
--- arch/unicore32/kernel/process.c | 10 +++++----- arch/unicore32/kernel/setup.h | 2 +- arch/unicore32/mm/mmu.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/unicore32/kernel/process.c +5 -5
@@ -51,14 +51,14 @@ void arch_cpu_idle(void)local_irq_enable (); } -static char reboot_mode ='h' ; +static enum reboot_mode reboot_mode;int __init reboot_setup (char *str) { - reboot_mode = str[0 ]; +if ('s' == str[0 ]) + reboot_mode =REBOOT_WARM ;return 1 ; } -__setup ("reboot=" , reboot_setup);void machine_halt (void )
@@ -88,7 +88,7 @@ void machine_restart(char *cmd)* we may need it to insert some 1:1 mappings so that * soft boot works. */ -setup_mm_for_reboot (reboot_mode); +setup_mm_for_reboot ();/* Clean and invalidate caches */ flush_cache_all ();
@@ -102,7 +102,7 @@ void machine_restart(char *cmd)/* * Now handle reboot code. */ -if (reboot_mode =='s' ) { +if (reboot_mode ==REBOOT_WARM ) {/* Jump into ROM at address 0xffff0000 */ cpu_reset (VECTORS_BASE ); }else {
arch/unicore32/kernel/setup.h +1 -1
@@ -22,7 +22,7 @@ extern void puv3_ps2_init(void);extern void pci_puv3_preinit (void );extern void __init puv3_init_gpio (void ); -extern void setup_mm_for_reboot (char mode); +extern void setup_mm_for_reboot (void );extern char __stubs_start[], __stubs_end[];extern char __vectors_start[], __vectors_end[];
arch/unicore32/mm/mmu.c +1 -1
@@ -445,7 +445,7 @@ void __init paging_init(void)* the user-mode pages. This will then ensure that we have predictable * results when turning the mmu off */ -void setup_mm_for_reboot (char mode) +void setup_mm_for_reboot (void ) {unsigned long base_pmdval;pgd_t *pgd;
Signature · 1 line
1.8.2.1
PATCH 8/11 arm, Remove unused restart_mode fields from some arm subarchs
In reply to Robin HoltThese restart_mode fields are not used at all. Remove them to make moving the reboot= cmdline options to the general kernel easier.
To: Andrew Morton <[email protected]>
Cc: Russell King <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
--- arch/arm/mach-ebsa110/core.c | 1 - arch/arm/mach-pxa/mioa701.c | 1 - arch/arm/mach-pxa/spitz.c | 3 --- arch/arm/mach-pxa/tosa.c | 1 - 4 files changed, 6 deletions(-)
arch/arm/mach-ebsa110/core.c +0 -1
@@ -321,7 +321,6 @@ MACHINE_START(EBSA110, "EBSA110") .atag_offset = 0x400, .reserve_lp0 = 1, .reserve_lp2 = 1, - .restart_mode = 's', .map_io = ebsa110_map_io, .init_early = ebsa110_init_early, .init_irq = ebsa110_init_irq,
arch/arm/mach-pxa/mioa701.c +0 -1
@@ -756,7 +756,6 @@ static void mioa701_machine_exit(void)MACHINE_START (MIOA701 ,"MIO A701" ) .atag_offset = 0x100, - .restart_mode = 's', .map_io = &pxa27x_map_io, .nr_irqs = PXA_NR_IRQS, .init_irq = &pxa27x_init_irq,
arch/arm/mach-pxa/spitz.c +0 -3
@@ -979,7 +979,6 @@ static void __init spitz_fixup(struct tag *tags, char **cmdline,#ifdef CONFIG_MACH_SPITZ MACHINE_START (SPITZ ,"SHARP Spitz" ) - .restart_mode = 'g', .fixup = spitz_fixup, .map_io = pxa27x_map_io, .nr_irqs = PXA_NR_IRQS,
@@ -993,7 +992,6 @@ MACHINE_END#ifdef CONFIG_MACH_BORZOI MACHINE_START (BORZOI ,"SHARP Borzoi" ) - .restart_mode = 'g', .fixup = spitz_fixup, .map_io = pxa27x_map_io, .nr_irqs = PXA_NR_IRQS,
@@ -1007,7 +1005,6 @@ MACHINE_END#ifdef CONFIG_MACH_AKITA MACHINE_START (AKITA ,"SHARP Akita" ) - .restart_mode = 'g', .fixup = spitz_fixup, .map_io = pxa27x_map_io, .nr_irqs = PXA_NR_IRQS,
arch/arm/mach-pxa/tosa.c +0 -1
@@ -969,7 +969,6 @@ static void __init fixup_tosa(struct tag *tags, char **cmdline, }MACHINE_START (TOSA ,"SHARP Tosa" ) - .restart_mode = 'g', .fixup = fixup_tosa, .map_io = pxa25x_map_io, .nr_irqs = TOSA_NR_IRQS,
Signature · 1 line
1.8.2.1
PATCH 9/11 arm, prepare reboot_mode for moving to generic kernel code.
In reply to Robin HoltThis patch prepares for the moving the parsing of reboot= to the generic kernel code by making reboot_mode into a more generic form.
To: Andrew Morton <[email protected]>
To: Russell King <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
--- arch/arm/include/asm/mach/arch.h | 3 ++- arch/arm/kernel/process.c | 8 ++++---- arch/arm/kernel/setup.c | 6 +++--- arch/arm/mach-footbridge/cats-hw.c | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-)
arch/arm/include/asm/mach/arch.h +2 -1
@@ -9,6 +9,7 @@*/ #ifndef __ASSEMBLY__ +#include <linux/reboot.h> struct tag ;struct meminfo ;
@@ -39,7 +40,7 @@ struct machine_desc { unsigned char reserve_lp0 :1; /* never has lp0 */ unsigned char reserve_lp1 :1; /* never has lp1 */ unsigned char reserve_lp2 :1; /* never has lp2 */ -char restart_mode;/* default restart mode */ +enum reboot_mode reboot_mode;/* default restart mode */ struct smp_operations *smp;/* SMP operations */ void (*fixup)(struct tag *,char **,struct meminfo *);
arch/arm/kernel/process.c +4 -4
@@ -174,14 +174,14 @@ void arch_cpu_idle(void)default_idle (); } -static char reboot_mode ='h' ; +enum reboot_mode reboot_mode; -int __init reboot_setup (char *str) +static int __init reboot_setup (char *str) { - reboot_mode = str[0 ]; +if ('s' == str[0 ]) + reboot_mode =REBOOT_WARM ;return 1 ; } -__setup ("reboot=" , reboot_setup);void machine_shutdown (void )
arch/arm/kernel/setup.c +3 -3
@@ -72,7 +72,7 @@ __setup("fpe=", fpe_setup);extern void paging_init (struct machine_desc *desc);extern void sanity_check_meminfo (void ); -extern void reboot_setup (char *str); +extern enum reboot_mode reboot_mode;extern void setup_dma_zone (struct machine_desc *desc);unsigned int processor_id;
@@ -758,8 +758,8 @@ void __init setup_arch(char **cmdline_p)setup_dma_zone (mdesc); -if (mdesc->restart_mode) -reboot_setup (&mdesc->restart_mode); +if (mdesc->reboot_mode !=REBOOT_COLD ) + reboot_mode = mdesc->reboot_mode; init_mm.start_code = (unsigned long ) _text; init_mm.end_code = (unsigned long ) _etext;
arch/arm/mach-footbridge/cats-hw.c +1 -1
@@ -86,7 +86,7 @@ fixup_cats(struct tag *tags, char **cmdline, struct meminfo *mi)MACHINE_START (CATS ,"Chalice-CATS" )/* Maintainer: Philip Blundell */ .atag_offset = 0x100, - .restart_mode = 's', + .reboot_mode = REBOOT_WARM, .fixup = fixup_cats, .map_io = footbridge_map_io, .init_irq = footbridge_init_irq,
Signature · 1 line
1.8.2.1
PATCH 10/11 arm, change reboot_mode to use enum reboot_mode
In reply to Robin HoltPreparing to move the parsing of reboot= to generic kernel code forces the change in reboot_mode handling to use the enum.
To: Andrew Morton <[email protected]>
Cc: Russell King <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
--- arch/arm/include/asm/hardware/iop3xx.h | 3 ++- arch/arm/include/asm/mach/arch.h | 2 +- arch/arm/include/asm/system_misc.h | 3 ++- arch/arm/kernel/process.c | 5 +++-- arch/arm/mach-at91/at91rm9200.c | 3 ++- arch/arm/mach-at91/generic.h | 5 +++-- arch/arm/mach-bcm2835/bcm2835.c | 4 ++-- arch/arm/mach-clps711x/common.c | 2 +- arch/arm/mach-clps711x/common.h | 4 +++- arch/arm/mach-cns3xxx/core.h | 4 +++- arch/arm/mach-cns3xxx/pm.c | 2 +- arch/arm/mach-davinci/devices-da8xx.c | 3 ++- arch/arm/mach-davinci/devices.c | 3 ++- arch/arm/mach-davinci/include/mach/common.h | 3 ++- arch/arm/mach-davinci/include/mach/da8xx.h | 3 ++- arch/arm/mach-davinci/include/mach/tnetv107x.h | 3 ++- arch/arm/mach-davinci/tnetv107x.c | 3 ++- arch/arm/mach-dove/common.c | 2 +- arch/arm/mach-dove/common.h | 4 +++- arch/arm/mach-ebsa110/core.c | 2 +- arch/arm/mach-ep93xx/core.c | 3 ++- arch/arm/mach-ep93xx/include/mach/platform.h | 4 +++- arch/arm/mach-exynos/common.c | 4 ++-- arch/arm/mach-exynos/common.h | 5 +++-- arch/arm/mach-footbridge/common.c | 4 ++-- arch/arm/mach-footbridge/common.h | 3 ++- arch/arm/mach-footbridge/netwinder-hw.c | 4 ++-- arch/arm/mach-highbank/core.h | 4 +++- arch/arm/mach-highbank/system.c | 5 +++-- arch/arm/mach-imx/common.h | 4 +++- arch/arm/mach-imx/mach-imx6q.c | 3 ++- arch/arm/mach-imx/system.c | 2 +- arch/arm/mach-integrator/common.h | 3 ++- arch/arm/mach-integrator/core.c | 2 +- arch/arm/mach-iop13xx/include/mach/iop13xx.h | 5 ++++- arch/arm/mach-iop13xx/setup.c | 2 +- arch/arm/mach-iop32x/n2100.c | 2 +- arch/arm/mach-ixp4xx/common.c | 4 ++-- arch/arm/mach-ixp4xx/dsmg600-setup.c | 1 + arch/arm/mach-ixp4xx/include/mach/platform.h | 4 +++- arch/arm/mach-ixp4xx/include/mach/timex.h | 2 +- arch/arm/mach-kirkwood/board-lsxl.c | 2 +- arch/arm/mach-kirkwood/common.c | 3 ++- arch/arm/mach-kirkwood/common.h | 4 +++- arch/arm/mach-ks8695/generic.h | 2 +- arch/arm/mach-ks8695/time.c | 4 ++-- arch/arm/mach-lpc32xx/common.c | 6 +++--- arch/arm/mach-lpc32xx/common.h | 3 ++- arch/arm/mach-mmp/common.c | 2 +- arch/arm/mach-mmp/common.h | 3 ++- arch/arm/mach-mmp/include/mach/pxa168.h | 4 +++- arch/arm/mach-mmp/pxa168.c | 2 +- arch/arm/mach-mv78xx0/common.c | 2 +- arch/arm/mach-mv78xx0/common.h | 4 +++- arch/arm/mach-mvebu/common.h | 4 +++- arch/arm/mach-mvebu/system-controller.c | 3 ++- arch/arm/mach-mxs/mach-mxs.c | 4 +++- arch/arm/mach-netx/generic.c | 3 ++- arch/arm/mach-netx/generic.h | 4 +++- arch/arm/mach-nomadik/cpu-8815.c | 2 +- arch/arm/mach-omap1/board-voiceblue.c | 3 ++- arch/arm/mach-omap1/common.h | 3 ++- arch/arm/mach-omap1/reset.c | 3 ++- arch/arm/mach-omap2/am33xx-restart.c | 3 ++- arch/arm/mach-omap2/common.h | 17 +++++++++-------- arch/arm/mach-omap2/omap2-restart.c | 2 +- arch/arm/mach-omap2/omap3-restart.c | 3 ++- arch/arm/mach-omap2/omap4-common.c | 3 ++- arch/arm/mach-orion5x/common.c | 2 +- arch/arm/mach-orion5x/common.h | 4 +++- arch/arm/mach-orion5x/ls-chl-setup.c | 2 +- arch/arm/mach-orion5x/ls_hgl-setup.c | 2 +- arch/arm/mach-orion5x/lsmini-setup.c | 2 +- arch/arm/mach-picoxcell/common.c | 3 ++- arch/arm/mach-prima2/common.h | 4 +++- arch/arm/mach-prima2/rstc.c | 3 ++- arch/arm/mach-pxa/corgi.c | 6 +++--- arch/arm/mach-pxa/generic.h | 4 +++- arch/arm/mach-pxa/mioa701.c | 7 ++++--- arch/arm/mach-pxa/poodle.c | 2 +- arch/arm/mach-pxa/reset.c | 8 ++++---- arch/arm/mach-pxa/spitz.c | 5 +++-- arch/arm/mach-pxa/tosa.c | 5 +++-- arch/arm/mach-realview/realview_eb.c | 3 ++- arch/arm/mach-realview/realview_pb1176.c | 3 ++- arch/arm/mach-realview/realview_pb11mp.c | 3 ++- arch/arm/mach-realview/realview_pba8.c | 3 ++- arch/arm/mach-realview/realview_pbx.c | 3 ++- arch/arm/mach-rpc/riscpc.c | 3 ++- arch/arm/mach-s3c24xx/common.h | 12 +++++++----- arch/arm/mach-s3c24xx/s3c2410.c | 5 +++-- arch/arm/mach-s3c24xx/s3c2412.c | 5 +++-- arch/arm/mach-s3c24xx/s3c2416.c | 5 +++-- arch/arm/mach-s3c24xx/s3c2443.c | 5 +++-- arch/arm/mach-s3c24xx/s3c244x.c | 5 +++-- arch/arm/mach-s3c64xx/common.c | 5 +++-- arch/arm/mach-s3c64xx/common.h | 4 +++- arch/arm/mach-s5p64x0/common.c | 5 +++-- arch/arm/mach-s5p64x0/common.h | 4 +++- arch/arm/mach-s5pc100/common.c | 5 +++-- arch/arm/mach-s5pc100/common.h | 4 +++- arch/arm/mach-s5pv210/common.c | 2 +- arch/arm/mach-s5pv210/common.h | 4 +++- arch/arm/mach-sa1100/generic.c | 5 +++-- arch/arm/mach-sa1100/generic.h | 3 ++- arch/arm/mach-shark/core.c | 3 ++- arch/arm/mach-shmobile/board-armadillo800eva.c | 3 ++- arch/arm/mach-shmobile/board-kzm9g.c | 3 ++- arch/arm/mach-socfpga/socfpga.c | 3 ++- arch/arm/mach-spear/generic.h | 4 +++- arch/arm/mach-spear/restart.c | 5 +++-- arch/arm/mach-sunxi/sunxi.c | 3 ++- arch/arm/mach-tegra/board.h | 3 ++- arch/arm/mach-tegra/common.c | 3 ++- arch/arm/mach-u300/core.c | 6 +++--- arch/arm/mach-versatile/core.c | 3 ++- arch/arm/mach-versatile/core.h | 3 ++- arch/arm/mach-vt8500/vt8500.c | 3 ++- arch/arm/mach-w90x900/cpu.c | 4 ++-- arch/arm/mach-w90x900/nuc9xx.h | 5 ++++- arch/arm/plat-iop/gpio.c | 1 + arch/arm/plat-iop/restart.c | 2 +- drivers/power/reset/restart-poweroff.c | 3 ++- drivers/power/reset/vexpress-poweroff.c | 2 +- include/linux/reboot.h | 1 + include/linux/vexpress.h | 1 + 126 files changed, 283 insertions(+), 167 deletions(-)
arch/arm/include/asm/hardware/iop3xx.h +2 -1
@@ -223,11 +223,12 @@ extern int iop3xx_get_init_atu(void);#ifndef __ASSEMBLY__#include <linux/types.h> +#include <linux/reboot.h> void iop3xx_map_io (void );void iop_init_cp6_handler (void );void iop_init_time (unsigned long tickrate); -void iop3xx_restart (char ,const char *); +void iop3xx_restart (enum reboot_mode ,const char *);static inline u32 read_tmr0 (void ) {
arch/arm/include/asm/mach/arch.h +1 -1
@@ -54,7 +54,7 @@ struct machine_desc {#ifdef CONFIG_MULTI_IRQ_HANDLER void (*handle_irq)(struct pt_regs *);#endif -void (*restart)(char ,const char *); +void (*restart)(enum reboot_mode ,const char *); };/*
arch/arm/include/asm/system_misc.h +2 -1
@@ -6,11 +6,12 @@#include <linux/compiler.h> #include <linux/linkage.h> #include <linux/irqflags.h> +#include <linux/reboot.h> extern void cpu_init (void );void soft_restart (unsigned long ); -extern void (*arm_pm_restart)(char str,const char *cmd); +extern void (*arm_pm_restart)(enum reboot_mode reboot_mode,const char *cmd);extern void (*arm_pm_idle)(void );#define UDBG_UNDEFINED (1 << 0)
arch/arm/kernel/process.c +3 -2
@@ -32,6 +32,7 @@#include <linux/hw_breakpoint.h> #include <linux/cpuidle.h> #include <linux/leds.h> +#include <linux/reboot.h> #include <asm/cacheflush.h> #include <asm/idmap.h>
@@ -112,7 +113,7 @@ void soft_restart(unsigned long addr)BUG (); } -static void null_restart (char mode,const char *cmd) +static void null_restart (enum reboot_mode reboot_mode,const char *cmd) { }
@@ -122,7 +123,7 @@ static void null_restart(char mode, const char *cmd)void (*pm_power_off)(void );EXPORT_SYMBOL (pm_power_off); -void (*arm_pm_restart)(char str,const char *cmd) = null_restart; +void (*arm_pm_restart)(enum reboot_mode reboot_mode,const char *cmd) = null_restart;EXPORT_SYMBOL_GPL (arm_pm_restart);/*
arch/arm/mach-at91/at91rm9200.c +2 -1
@@ -11,6 +11,7 @@*/ #include <linux/module.h> +#include <linux/reboot.h> #include <asm/irq.h> #include <asm/mach/arch.h>
@@ -304,7 +305,7 @@ static void at91rm9200_idle(void)at91_pmc_write (AT91_PMC_SCDR ,AT91_PMC_PCK ); } -static void at91rm9200_restart (char mode,const char *cmd) +static void at91rm9200_restart (enum reboot_mode reboot_mode,const char *cmd) {/* * Perform a hardware reset with the use of the Watchdog timer.
arch/arm/mach-at91/generic.h +3 -2
@@ -10,6 +10,7 @@#include <linux/clkdev.h> #include <linux/of.h> +#include <linux/reboot.h> /* Map io */ extern void __init at91_map_io (void );
@@ -60,8 +61,8 @@ extern void at91sam9_idle(void);/* reset */ extern void at91_ioremap_rstc (u32 base_addr); -extern void at91sam9_alt_restart (char ,const char *); -extern void at91sam9g45_restart (char ,const char *); +extern void at91sam9_alt_restart (enum reboot_mode ,const char *); +extern void at91sam9g45_restart (enum reboot_mode ,const char *);/* shutdown */ extern void at91_ioremap_shdwc (u32 base_addr);
arch/arm/mach-bcm2835/bcm2835.c +2 -2
@@ -53,7 +53,7 @@ static void bcm2835_setup_restart(void)WARN (!wdt_regs,"failed to remap watchdog regs" ); } -static void bcm2835_restart (char mode,const char *cmd) +static void bcm2835_restart (enum reboot_mode mode,const char *cmd) {u32 val;
@@ -91,7 +91,7 @@ static void bcm2835_power_off(void)writel_relaxed (val, wdt_regs +PM_RSTS );/* Continue with normal reset mechanism */ -bcm2835_restart (0 ,"" ); +bcm2835_restart (REBOOT_COLD ,"" ); }static struct map_desc io_map__initdata = {
arch/arm/mach-clps711x/common.c +1 -1
@@ -345,7 +345,7 @@ void __init clps711x_timer_init(void)setup_irq (IRQ_TC2OI , &clps711x_timer_irq); } -void clps711x_restart (char mode,const char *cmd) +void clps711x_restart (enum reboot_mode mode,const char *cmd) {soft_restart (0 ); }
arch/arm/mach-clps711x/common.h +3 -1
@@ -4,6 +4,8 @@* Common bits. */ +#include <linux/reboot.h> +#define CLPS711X_NR_IRQS (33)#define CLPS711X_NR_GPIO (4 * 8 + 3)#define CLPS711X_GPIO (prt, bit) ((prt) * 8 + (bit))
@@ -12,4 +14,4 @@ extern void clps711x_map_io(void);extern void clps711x_init_irq (void );extern void clps711x_timer_init (void );extern void clps711x_handle_irq (struct pt_regs *regs); -extern void clps711x_restart (char mode,const char *cmd); +extern void clps711x_restart (enum reboot_mode mode,const char *cmd);
arch/arm/mach-cns3xxx/core.h +3 -1
@@ -11,6 +11,8 @@#ifndef __CNS3XXX_CORE_H#define __CNS3XXX_CORE_H +#include <linux/reboot.h> +extern void cns3xxx_timer_init (void );#ifdef CONFIG_CACHE_L2X0
@@ -22,6 +24,6 @@ static inline void cns3xxx_l2x0_init(void) {}void __init cns3xxx_map_io (void );void __init cns3xxx_init_irq (void );void cns3xxx_power_off (void ); -void cns3xxx_restart (char ,const char *); +void cns3xxx_restart (enum reboot_mode ,const char *);#endif /* __CNS3XXX_CORE_H */
arch/arm/mach-cns3xxx/pm.c +1 -1
@@ -89,7 +89,7 @@ void cns3xxx_pwr_soft_rst(unsigned int block) }EXPORT_SYMBOL (cns3xxx_pwr_soft_rst); -void cns3xxx_restart (char mode,const char *cmd) +void cns3xxx_restart (enum reboot_mode mode,const char *cmd) {/* * To reset, we hit the on-board reset register
arch/arm/mach-davinci/devices-da8xx.c +2 -1
@@ -16,6 +16,7 @@#include <linux/serial_8250.h> #include <linux/ahci_platform.h> #include <linux/clk.h> +#include <linux/reboot.h> #include <mach/cputype.h> #include <mach/common.h>
@@ -366,7 +367,7 @@ static struct platform_device da8xx_wdt_device = { .resource = da8xx_watchdog_resources, }; -void da8xx_restart (char mode,const char *cmd) +void da8xx_restart (enum reboot_mode mode,const char *cmd) {struct device *dev;
arch/arm/mach-davinci/devices.c +2 -1
@@ -13,6 +13,7 @@#include <linux/platform_device.h> #include <linux/dma-mapping.h> #include <linux/io.h> +#include <linux/reboot.h> #include <mach/hardware.h> #include <linux/platform_data/i2c-davinci.h>
@@ -303,7 +304,7 @@ struct platform_device davinci_wdt_device = { .resource = wdt_resources, }; -void davinci_restart (char mode,const char *cmd) +void davinci_restart (enum reboot_mode mode,const char *cmd) {davinci_watchdog_reset (&davinci_wdt_device); }
arch/arm/mach-davinci/include/mach/common.h +2 -1
@@ -14,6 +14,7 @@#include <linux/compiler.h> #include <linux/types.h> +#include <linux/reboot.h> extern void davinci_timer_init (void );
@@ -81,7 +82,7 @@ extern struct davinci_soc_info davinci_soc_info;extern void davinci_common_init (struct davinci_soc_info *soc_info);extern void davinci_init_ide (void ); -void davinci_restart (char mode,const char *cmd); +void davinci_restart (enum reboot_mode mode,const char *cmd);void davinci_init_late (void );#ifdef CONFIG_DAVINCI_RESET_CLOCKS
arch/arm/mach-davinci/include/mach/da8xx.h +2 -1
@@ -17,6 +17,7 @@#include <linux/davinci_emac.h> #include <linux/spi/spi.h> #include <linux/platform_data/davinci_asp.h> +#include <linux/reboot.h> #include <linux/videodev2.h> #include <mach/serial.h>
@@ -106,7 +107,7 @@ int __init da850_register_vpif_display (struct vpif_display_config *display_config);int __init da850_register_vpif_capture (struct vpif_capture_config *capture_config); -void da8xx_restart (char mode,const char *cmd); +void da8xx_restart (enum reboot_mode mode,const char *cmd);void da8xx_rproc_reserve_cma (void );int da8xx_register_rproc (void );
arch/arm/mach-davinci/include/mach/tnetv107x.h +2 -1
@@ -35,6 +35,7 @@#include <linux/serial_8250.h> #include <linux/input/matrix_keypad.h> #include <linux/mfd/ti_ssp.h> +#include <linux/reboot.h> #include <linux/platform_data/mmc-davinci.h> #include <linux/platform_data/mtd-davinci.h>
@@ -54,7 +55,7 @@ extern struct platform_device tnetv107x_serial_device;extern void __init tnetv107x_init (void );extern void __init tnetv107x_devices_init (struct tnetv107x_device_info *);extern void __init tnetv107x_irq_init (void ); -void tnetv107x_restart (char mode,const char *cmd); +void tnetv107x_restart (enum reboot_mode mode,const char *cmd);#endif
arch/arm/mach-davinci/tnetv107x.c +2 -1
@@ -19,6 +19,7 @@#include <linux/io.h> #include <linux/err.h> #include <linux/platform_device.h> +#include <linux/reboot.h> #include <asm/mach/map.h>
@@ -730,7 +731,7 @@ static void tnetv107x_watchdog_reset(struct platform_device *pdev)__raw_writel (1 , ®s->kick); } -void tnetv107x_restart (char mode,const char *cmd) +void tnetv107x_restart (enum reboot_mode mode,const char *cmd) {tnetv107x_watchdog_reset (&tnetv107x_wdt_device); }
arch/arm/mach-dove/common.c +1 -1
@@ -345,7 +345,7 @@ void __init dove_init(void)dove_xor1_init (); } -void dove_restart (char mode,const char *cmd) +void dove_restart (enum reboot_mode mode,const char *cmd) {/* * Enable soft reset to assert RSTOUTn.
arch/arm/mach-dove/common.h +3 -1
@@ -11,6 +11,8 @@#ifndef __ARCH_DOVE_COMMON_H#define __ARCH_DOVE_COMMON_H +#include <linux/reboot.h> +struct mv643xx_eth_platform_data ;struct mv_sata_platform_data ;
@@ -42,6 +44,6 @@ void dove_spi1_init(void);void dove_i2c_init (void );void dove_sdio0_init (void );void dove_sdio1_init (void ); -void dove_restart (char ,const char *); +void dove_restart (enum reboot_mode ,const char *);#endif
arch/arm/mach-ebsa110/core.c +1 -1
@@ -311,7 +311,7 @@ static int __init ebsa110_init(void)arch_initcall (ebsa110_init); -static void ebsa110_restart (char mode,const char *cmd) +static void ebsa110_restart (enum reboot_mode mode,const char *cmd) {soft_restart (0x80000000 ); }
arch/arm/mach-ep93xx/core.c +2 -1
@@ -35,6 +35,7 @@#include <linux/spi/spi.h> #include <linux/export.h> #include <linux/irqchip/arm-vic.h> +#include <linux/reboot.h> #include <mach/hardware.h> #include <linux/platform_data/video-ep93xx.h>
@@ -921,7 +922,7 @@ void __init ep93xx_init_devices(void)gpio_led_register_device (-1 , &ep93xx_led_data); } -void ep93xx_restart (char mode,const char *cmd) +void ep93xx_restart (enum reboot_mode mode,const char *cmd) {/* * Set then clear the SWRST bit to initiate a software reset
arch/arm/mach-ep93xx/include/mach/platform.h +3 -1
@@ -4,6 +4,8 @@#ifndef __ASSEMBLY__ +#include <linux/reboot.h> +struct i2c_gpio_platform_data ;struct i2c_board_info ;struct spi_board_info ;
@@ -55,7 +57,7 @@ void ep93xx_ide_release_gpio(struct platform_device *pdev);void ep93xx_init_devices (void );extern void ep93xx_timer_init (void ); -void ep93xx_restart (char ,const char *); +void ep93xx_restart (enum reboot_mode ,const char *);void ep93xx_init_late (void );#ifdef CONFIG_CRUNCH
arch/arm/mach-exynos/common.c +2 -2
@@ -313,12 +313,12 @@ static struct map_desc exynos5440_iodesc0[] __initdata = { }, }; -void exynos4_restart (char mode,const char *cmd) +void exynos4_restart (enum reboot_mode mode,const char *cmd) {__raw_writel (0x1 ,S5P_SWRESET ); } -void exynos5_restart (char mode,const char *cmd) +void exynos5_restart (enum reboot_mode mode,const char *cmd) {struct device_node *np;u32 val;
arch/arm/mach-exynos/common.h +3 -2
@@ -12,6 +12,7 @@#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H#define __ARCH_ARM_MACH_EXYNOS_COMMON_H +#include <linux/reboot.h> #include <linux/of.h> extern void mct_init (void );
@@ -22,8 +23,8 @@ struct map_desc;void exynos_init_io (struct map_desc *mach_desc,int size);void exynos4_init_irq (void );void exynos5_init_irq (void ); -void exynos4_restart (char mode,const char *cmd); -void exynos5_restart (char mode,const char *cmd); +void exynos4_restart (enum reboot_mode mode,const char *cmd); +void exynos5_restart (enum reboot_mode mode,const char *cmd);void exynos_init_late (void );/* ToDo: remove these after migrating legacy exynos4 platforms to dt */
arch/arm/mach-footbridge/common.c +2 -2
@@ -198,9 +198,9 @@ void __init footbridge_map_io(void) } } -void footbridge_restart (char mode,const char *cmd) +void footbridge_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) { +if (mode ==REBOOT_WARM ) {/* Jump into the ROM */ soft_restart (0x41000000 ); }else {
arch/arm/mach-footbridge/common.h +2 -1
@@ -1,3 +1,4 @@ +#include <linux/reboot.h> extern void footbridge_timer_init (void );extern void isa_timer_init (void );
@@ -8,4 +9,4 @@ extern void footbridge_map_io(void);extern void footbridge_init_irq (void );extern void isa_init_irq (unsigned int irq); -extern void footbridge_restart (char ,const char *); +extern void footbridge_restart (enum reboot_mode ,const char *);
arch/arm/mach-footbridge/netwinder-hw.c +2 -2
@@ -634,9 +634,9 @@ fixup_netwinder(struct tag *tags, char **cmdline, struct meminfo *mi)#endif } -static void netwinder_restart (char mode,const char *cmd) +static void netwinder_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) { +if (mode ==REBOOT_WARM ) {/* Jump into the ROM */ soft_restart (0x41000000 ); }else {
arch/arm/mach-highbank/core.h +3 -1
@@ -1,8 +1,10 @@#ifndef __HIGHBANK_CORE_H#define __HIGHBANK_CORE_H +#include <linux/reboot.h> +extern void highbank_set_cpu_jump (int cpu,void *jump_addr); -extern void highbank_restart (char ,const char *); +extern void highbank_restart (enum reboot_mode ,const char *);extern void __iomem *scu_base_addr;#ifdef CONFIG_PM_SLEEP
arch/arm/mach-highbank/system.c +3 -2
@@ -15,13 +15,14 @@*/ #include <linux/io.h> #include <asm/proc-fns.h> +#include <linux/reboot.h> #include "core.h" #include "sysregs.h" -void highbank_restart (char mode,const char *cmd) +void highbank_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='h' ) +if (mode ==REBOOT_COLD )highbank_set_pwr_hard_reset ();else highbank_set_pwr_soft_reset ();
arch/arm/mach-imx/common.h +3 -1
@@ -11,6 +11,8 @@#ifndef __ASM_ARCH_MXC_COMMON_H__#define __ASM_ARCH_MXC_COMMON_H__ +#include <linux/reboot.h> +struct platform_device ;struct clk ;enum mxc_cpu_pwr_mode ;
@@ -71,7 +73,7 @@ extern int mx6q_clocks_init(void);extern struct platform_device *mxc_register_gpio (char *name,int id,resource_size_t iobase,resource_size_t iosize,int irq,int irq_high);extern void mxc_set_cpu_type (unsigned int type); -extern void mxc_restart (char ,const char *); +extern void mxc_restart (enum reboot_mode ,const char *);extern void mxc_arch_reset_init (void __iomem *);extern int mx53_revision (void );extern int mx53_display_revision (void );
arch/arm/mach-imx/mach-imx6q.c +2 -1
@@ -26,6 +26,7 @@#include <linux/of_platform.h> #include <linux/opp.h> #include <linux/phy.h> +#include <linux/reboot.h> #include <linux/regmap.h> #include <linux/micrel_phy.h> #include <linux/mfd/syscon.h>
@@ -72,7 +73,7 @@ static int imx6q_revision(void) } } -static void imx6q_restart (char mode,const char *cmd) +static void imx6q_restart (enum reboot_mode mode,const char *cmd) {struct device_node *np;void __iomem *wdog_base;
arch/arm/mach-imx/system.c +1 -1
@@ -34,7 +34,7 @@ static void __iomem *wdog_base;/* * Reset the system. It is called by machine_restart(). */ -void mxc_restart (char mode,const char *cmd) +void mxc_restart (enum reboot_mode mode,const char *cmd) {unsigned int wcr_enable;
arch/arm/mach-integrator/common.h +2 -1
@@ -1,7 +1,8 @@ +#include <linux/reboot.h> #include <linux/amba/serial.h> extern struct amba_pl010_data ap_uart_data;void integrator_init_early (void );int integrator_init (bool is_cp);void integrator_reserve (void ); -void integrator_restart (char ,const char *); +void integrator_restart (enum reboot_mode ,const char *);void integrator_init_sysfs (struct device *parent,u32 id);
arch/arm/mach-integrator/core.c +1 -1
@@ -124,7 +124,7 @@ void __init integrator_reserve(void)/* * To reset, we hit the on-board reset register in the system FPGA */ -void integrator_restart (char mode,const char *cmd) +void integrator_restart (enum reboot_mode mode,const char *cmd) {cm_control (CM_CTRL_RESET ,CM_CTRL_RESET ); }
arch/arm/mach-iop13xx/include/mach/iop13xx.h +4 -1
@@ -2,6 +2,9 @@#define _IOP13XX_HW_H_#ifndef __ASSEMBLY__ + +#include <linux/reboot.h> +/* The ATU offsets can change based on the strapping */ extern u32 iop13xx_atux_pmmr_offset;extern u32 iop13xx_atue_pmmr_offset;
@@ -11,7 +14,7 @@ void iop13xx_map_io(void);void iop13xx_platform_init (void );void iop13xx_add_tpmi_devices (void );void iop13xx_init_irq (void ); -void iop13xx_restart (char ,const char *); +void iop13xx_restart (enum reboot_mode ,const char *);/* CPUID CP6 R0 Page 0 */ static inline int iop13xx_cpu_id (void )
arch/arm/mach-iop13xx/setup.c +1 -1
@@ -597,7 +597,7 @@ __setup("iop13xx_init_adma", iop13xx_init_adma_setup);__setup ("iop13xx_init_uart" , iop13xx_init_uart_setup);__setup ("iop13xx_init_i2c" , iop13xx_init_i2c_setup); -void iop13xx_restart (char mode,const char *cmd) +void iop13xx_restart (enum reboot_mode mode,const char *cmd) {/* * Reset the internal bus (warning both cores are reset)
arch/arm/mach-iop32x/n2100.c +1 -1
@@ -286,7 +286,7 @@ static void n2100_power_off(void) ; } -static void n2100_restart (char mode,const char *cmd) +static void n2100_restart (enum reboot_mode mode,const char *cmd) {gpio_line_set (N2100_HARDWARE_RESET ,GPIO_LOW );gpio_line_config (N2100_HARDWARE_RESET ,GPIO_OUT );
arch/arm/mach-ixp4xx/common.c +2 -2
@@ -531,9 +531,9 @@ static void __init ixp4xx_clockevent_init(void) 0xf, 0xfffffffe); } -void ixp4xx_restart (char mode,const char *cmd) +void ixp4xx_restart (enum reboot_mode mode,const char *cmd) { -if (1 && mode =='s' ) { +if (1 && mode ==REBOOT_WARM ) {/* Jump into ROM at address 0 */ soft_restart (0 ); }else {
arch/arm/mach-ixp4xx/dsmg600-setup.c +1 -0
@@ -27,6 +27,7 @@#include <linux/i2c.h> #include <linux/i2c-gpio.h> +#include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/flash.h>
arch/arm/mach-ixp4xx/include/mach/platform.h +3 -1
@@ -13,6 +13,8 @@#ifndef __ASSEMBLY__ +#include <linux/reboot.h> +#include <asm/types.h> #ifndef __ARMEB__
@@ -123,7 +125,7 @@ extern void ixp4xx_init_early(void);extern void ixp4xx_init_irq (void );extern void ixp4xx_sys_init (void );extern void ixp4xx_timer_init (void ); -extern void ixp4xx_restart (char ,const char *); +extern void ixp4xx_restart (enum reboot_mode ,const char *);extern void ixp4xx_pci_preinit (void );struct pci_sys_data ;extern int ixp4xx_setup (int nr,struct pci_sys_data *sys);
arch/arm/mach-ixp4xx/include/mach/timex.h +1 -1
@@ -3,7 +3,7 @@* */ -#include <mach/hardware.h> +// #include <mach/hardware.h> /* * We use IXP425 General purpose timer for our timer needs, it runs at
arch/arm/mach-kirkwood/board-lsxl.c +1 -1
@@ -35,7 +35,7 @@ static struct mv643xx_eth_platform_data lsxl_ge01_data = {*/ static void lsxl_power_off (void ) { -kirkwood_restart ('h' ,NULL ); +kirkwood_restart (REBOOT_COLD ,NULL ); }void __init lsxl_init (void )
arch/arm/mach-kirkwood/common.c +2 -1
@@ -20,6 +20,7 @@#include <linux/mv643xx_i2c.h> #include <linux/timex.h> #include <linux/kexec.h> +#include <linux/reboot.h> #include <net/dsa.h> #include <asm/page.h> #include <asm/mach/map.h>
@@ -695,7 +696,7 @@ void __init kirkwood_init(void)#endif } -void kirkwood_restart (char mode,const char *cmd) +void kirkwood_restart (enum reboot_mode mode,const char *cmd) {/* * Enable soft reset to assert RSTOUTn.
arch/arm/mach-kirkwood/common.h +3 -1
@@ -11,6 +11,8 @@#ifndef __ARCH_KIRKWOOD_COMMON_H#define __ARCH_KIRKWOOD_COMMON_H +#include <linux/reboot.h> +struct dsa_platform_data ;struct mv643xx_eth_platform_data ;struct mv_sata_platform_data ;
@@ -51,7 +53,7 @@ void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts, int (*dev_ready)(struct mtd_info *));void kirkwood_audio_init (void );void kirkwood_cpuidle_init (void ); -void kirkwood_restart (char ,const char *); +void kirkwood_restart (enum reboot_mode ,const char *);void kirkwood_clk_init (void );/* board init functions for boards not fully converted to fdt */
arch/arm/mach-ks8695/generic.h +1 -1
@@ -12,5 +12,5 @@extern __init void ks8695_map_io (void );extern __init void ks8695_init_irq (void ); -extern void ks8695_restart (char ,const char *); +extern void ks8695_restart (enum reboot_mode ,const char *);extern void ks8695_timer_init (void );
arch/arm/mach-ks8695/time.c +2 -2
@@ -154,11 +154,11 @@ void __init ks8695_timer_init(void)setup_irq (KS8695_IRQ_TIMER1 , &ks8695_timer_irq); } -void ks8695_restart (char mode,const char *cmd) +void ks8695_restart (enum reboot_mode reboot_mode,const char *cmd) {unsigned int reg; -if (mode =='s' ) +if (reboot_mode ==REBOOT_WARM )soft_restart (0 );/* disable timer0 */
arch/arm/mach-lpc32xx/common.c +3 -3
@@ -207,11 +207,11 @@ void __init lpc32xx_map_io(void)iotable_init (lpc32xx_io_desc,ARRAY_SIZE (lpc32xx_io_desc)); } -void lpc23xx_restart (char mode,const char *cmd) +void lpc23xx_restart (enum reboot_mode mode,const char *cmd) {switch (mode) { -case 's' : -case 'h' : +case REBOOT_WARM : +case REBOOT_COLD :lpc32xx_watchdog_reset ();break ;
arch/arm/mach-lpc32xx/common.h +2 -1
@@ -21,6 +21,7 @@#include <mach/board.h> #include <linux/platform_device.h> +#include <linux/reboot.h> /* * Other arch specific structures and functions
@@ -29,7 +30,7 @@ extern void lpc32xx_timer_init(void);extern void __init lpc32xx_init_irq (void );extern void __init lpc32xx_map_io (void );extern void __init lpc32xx_serial_init (void ); -extern void lpc23xx_restart (char ,const char *); +extern void lpc23xx_restart (enum reboot_mode ,const char *);/*
arch/arm/mach-mmp/common.c +1 -1
@@ -47,7 +47,7 @@ void __init mmp_map_io(void) mmp_chip_id =__raw_readl (MMP_CHIPID ); } -void mmp_restart (char mode,const char *cmd) +void mmp_restart (enum reboot_mode mode,const char *cmd) {soft_restart (0 ); }
arch/arm/mach-mmp/common.h +2 -1
@@ -1,10 +1,11 @@ +#include <linux/reboot.h> #define ARRAY_AND_SIZE (x) (x), ARRAY_SIZE(x)extern void timer_init (int irq);extern void __init icu_init_irq (void );extern void __init mmp_map_io (void ); -extern void mmp_restart (char ,const char *); +extern void mmp_restart (enum reboot_mode ,const char *);extern void __init pxa168_clk_init (void );extern void __init pxa910_clk_init (void );extern void __init mmp2_clk_init (void );
arch/arm/mach-mmp/include/mach/pxa168.h +3 -1
@@ -1,9 +1,11 @@#ifndef __ASM_MACH_PXA168_H#define __ASM_MACH_PXA168_H +#include <linux/reboot.h> +extern void pxa168_timer_init (void );extern void __init pxa168_init_irq (void ); -extern void pxa168_restart (char ,const char *); +extern void pxa168_restart (enum reboot_mode ,const char *);extern void pxa168_clear_keypad_wakeup (void );#include <linux/i2c.h>
arch/arm/mach-mmp/pxa168.c +1 -1
@@ -172,7 +172,7 @@ int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata)return platform_device_register (&pxa168_device_usb_host); } -void pxa168_restart (char mode,const char *cmd) +void pxa168_restart (enum reboot_mode mode,const char *cmd) {soft_restart (0xffff0000 ); }
arch/arm/mach-mv78xx0/common.c +1 -1
@@ -407,7 +407,7 @@ void __init mv78xx0_init(void)clk_init (); } -void mv78xx0_restart (char mode,const char *cmd) +void mv78xx0_restart (enum reboot_mode mode,const char *cmd) {/* * Enable soft reset to assert RSTOUTn.
arch/arm/mach-mv78xx0/common.h +3 -1
@@ -11,6 +11,8 @@#ifndef __ARCH_MV78XX0_COMMON_H#define __ARCH_MV78XX0_COMMON_H +#include <linux/reboot.h> +struct mv643xx_eth_platform_data ;struct mv_sata_platform_data ;
@@ -45,7 +47,7 @@ void mv78xx0_uart1_init(void);void mv78xx0_uart2_init (void );void mv78xx0_uart3_init (void );void mv78xx0_i2c_init (void ); -void mv78xx0_restart (char ,const char *); +void mv78xx0_restart (enum reboot_mode ,const char *);extern void mv78xx0_timer_init (void );
arch/arm/mach-mvebu/common.h +3 -1
@@ -15,7 +15,9 @@#ifndef __ARCH_MVEBU_COMMON_H#define __ARCH_MVEBU_COMMON_H -void mvebu_restart (char mode,const char *cmd); +#include <linux/reboot.h> + +void mvebu_restart (enum reboot_mode mode,const char *cmd);void armada_370_xp_init_irq (void );void armada_370_xp_handle_irq (struct pt_regs *regs);
arch/arm/mach-mvebu/system-controller.c +2 -1
@@ -26,6 +26,7 @@#include <linux/init.h> #include <linux/of_address.h> #include <linux/io.h> +#include <linux/reboot.h> static void __iomem *system_controller_base;
@@ -63,7 +64,7 @@ static struct of_device_id of_system_controller_table[] = { { /* end of list */ }, }; -void mvebu_restart (char mode,const char *cmd) +void mvebu_restart (enum reboot_mode mode,const char *cmd) {if (!system_controller_base) {pr_err ("Cannot restart, system-controller not available: check the device tree\n" );
arch/arm/mach-mxs/mach-mxs.c +3 -1
@@ -27,6 +27,8 @@#include <linux/of_platform.h> #include <linux/phy.h> #include <linux/pinctrl/consumer.h> +#include <linux/reboot.h> +#include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/mach/time.h>
@@ -560,7 +562,7 @@ static void __init mxs_machine_init(void)/* * Reset the system. It is called by machine_restart(). */ -static void mxs_restart (char mode,const char *cmd) +static void mxs_restart (enum reboot_mode mode,const char *cmd) {struct device_node *np;void __iomem *reset_addr;
arch/arm/mach-netx/generic.c +2 -1
@@ -24,6 +24,7 @@#include <linux/platform_device.h> #include <linux/io.h> #include <linux/irqchip/arm-vic.h> +#include <linux/reboot.h> #include <mach/hardware.h> #include <asm/mach/map.h> #include <mach/netx-regs.h>
@@ -187,7 +188,7 @@ static int __init netx_init(void)subsys_initcall (netx_init); -void netx_restart (char mode,const char *cmd) +void netx_restart (enum reboot_mode mode,const char *cmd) {writel (NETX_SYSTEM_RES_CR_FIRMW_RES_EN |NETX_SYSTEM_RES_CR_FIRMW_RES ,NETX_SYSTEM_RES_CR );
arch/arm/mach-netx/generic.h +3 -1
@@ -17,8 +17,10 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <linux/reboot.h> +extern void __init netx_map_io (void );extern void __init netx_init_irq (void ); -extern void netx_restart (char ,const char *); +extern void netx_restart (enum reboot_mode ,const char *);extern void netx_timer_init (void );
arch/arm/mach-nomadik/cpu-8815.c +1 -1
@@ -148,7 +148,7 @@ static void __init cpu8815_map_io(void)iotable_init (cpu8815_io_desc,ARRAY_SIZE (cpu8815_io_desc)); } -static void cpu8815_restart (char mode,const char *cmd) +static void cpu8815_restart (enum reboot_mode mode,const char *cmd) {void __iomem *srcbase =ioremap (NOMADIK_SRC_BASE ,SZ_4K );
arch/arm/mach-omap1/board-voiceblue.c +2 -1
@@ -26,6 +26,7 @@#include <linux/serial_reg.h> #include <linux/smc91x.h> #include <linux/export.h> +#include <linux/reboot.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -215,7 +216,7 @@ void voiceblue_wdt_ping(void)gpio_set_value (0 , wdt_gpio_state); } -static void voiceblue_restart (char mode,const char *cmd) +static void voiceblue_restart (enum reboot_mode mode,const char *cmd) {/* * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28
arch/arm/mach-omap1/common.h +2 -1
@@ -28,6 +28,7 @@#include <linux/mtd/mtd.h> #include <linux/i2c-omap.h> +#include <linux/reboot.h> #include <plat/i2c.h>
@@ -70,7 +71,7 @@ static inline int omap_serial_wakeup_init(void)void omap1_init_early (void );void omap1_init_irq (void );void omap1_init_late (void ); -void omap1_restart (char ,const char *); +void omap1_restart (enum reboot_mode ,const char *);extern void __init omap_check_revision (void );
arch/arm/mach-omap1/reset.c +2 -1
@@ -3,6 +3,7 @@*/ #include <linux/kernel.h> #include <linux/io.h> +#include <linux/reboot.h> #include <mach/hardware.h>
@@ -22,7 +23,7 @@#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5 -void omap1_restart (char mode,const char *cmd) +void omap1_restart (enum reboot_mode mode,const char *cmd) {/* * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28
arch/arm/mach-omap2/am33xx-restart.c +2 -1
@@ -6,6 +6,7 @@* published by the Free Software Foundation. */ #include <linux/kernel.h> +#include <linux/reboot.h> #include "common.h" #include "prm-regbits-33xx.h"
@@ -19,7 +20,7 @@* Resets the SoC. For @cmd, see the 'reboot' syscall in * kernel/sys.c. No return value. */ -void am33xx_restart (char mode,const char *cmd) +void am33xx_restart (enum reboot_mode mode,const char *cmd) {/* TODO: Handle mode and cmd if necessary */
arch/arm/mach-omap2/common.h +9 -8
@@ -31,6 +31,7 @@#include <linux/i2c.h> #include <linux/i2c/twl.h> #include <linux/i2c-omap.h> +#include <linux/reboot.h> #include <asm/proc-fns.h>
@@ -118,33 +119,33 @@ static inline void omap_soc_device_init(void)#endif #if defined(CONFIG_SOC_OMAP2420 ) || defined(CONFIG_SOC_OMAP2430 ) -void omap2xxx_restart (char mode,const char *cmd); +void omap2xxx_restart (enum reboot_mode mode,const char *cmd);#else -static inline void omap2xxx_restart (char mode,const char *cmd) +static inline void omap2xxx_restart (enum reboot_mode mode,const char *cmd) { }#endif #ifdef CONFIG_SOC_AM33XX -void am33xx_restart (char mode,const char *cmd); +void am33xx_restart (enum reboot_mode mode,const char *cmd);#else -static inline void am33xx_restart (char mode,const char *cmd) +static inline void am33xx_restart (enum reboot_mode mode,const char *cmd) { }#endif #ifdef CONFIG_ARCH_OMAP3 -void omap3xxx_restart (char mode,const char *cmd); +void omap3xxx_restart (enum reboot_mode mode,const char *cmd);#else -static inline void omap3xxx_restart (char mode,const char *cmd) +static inline void omap3xxx_restart (enum reboot_mode mode,const char *cmd) { }#endif #if defined(CONFIG_ARCH_OMAP4 ) || defined(CONFIG_SOC_OMAP5 ) -void omap44xx_restart (char mode,const char *cmd); +void omap44xx_restart (enum reboot_mode mode,const char *cmd);#else -static inline void omap44xx_restart (char mode,const char *cmd) +static inline void omap44xx_restart (enum reboot_mode mode,const char *cmd) { }#endif
arch/arm/mach-omap2/omap2-restart.c +1 -1
@@ -31,7 +31,7 @@ static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck;* Set the DPLL to bypass so that reboot completes successfully. No * return value. */ -void omap2xxx_restart (char mode,const char *cmd) +void omap2xxx_restart (enum reboot_mode mode,const char *cmd) {u32 rate;
arch/arm/mach-omap2/omap3-restart.c +2 -1
@@ -12,6 +12,7 @@*/ #include <linux/kernel.h> #include <linux/init.h> +#include <linux/reboot.h> #include "iomap.h" #include "common.h"
@@ -28,7 +29,7 @@* Resets the SoC. For @cmd, see the 'reboot' syscall in * kernel/sys.c. No return value. */ -void omap3xxx_restart (char mode,const char *cmd) +void omap3xxx_restart (enum reboot_mode mode,const char *cmd) {omap3_ctrl_write_boot_mode ((cmd ? (u8)*cmd :0 ));omap3xxx_prm_dpll3_reset ();/* never returns */
arch/arm/mach-omap2/omap4-common.c +2 -1
@@ -23,6 +23,7 @@#include <linux/export.h> #include <linux/irqchip/arm-gic.h> #include <linux/of_address.h> +#include <linux/reboot.h> #include <asm/hardware/cache-l2x0.h> #include <asm/mach/map.h>
@@ -348,7 +349,7 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)* Resets the SoC. For @cmd, see the 'reboot' syscall in * kernel/sys.c. No return value. */ -void omap44xx_restart (char mode,const char *cmd) +void omap44xx_restart (enum reboot_mode mode,const char *cmd) {/* XXX Should save 'cmd' into scratchpad for use after reboot */ omap4_prminst_global_warm_sw_reset ();/* never returns */
arch/arm/mach-orion5x/common.c +1 -1
@@ -311,7 +311,7 @@ void __init orion5x_init(void)orion5x_wdt_init (); } -void orion5x_restart (char mode,const char *cmd) +void orion5x_restart (enum reboot_mode mode,const char *cmd) {/* * Enable and issue soft reset
arch/arm/mach-orion5x/common.h +3 -1
@@ -1,6 +1,8 @@#ifndef __ARCH_ORION5X_COMMON_H#define __ARCH_ORION5X_COMMON_H +#include <linux/reboot.h> +struct dsa_platform_data ;struct mv643xx_eth_platform_data ;struct mv_sata_platform_data ;
@@ -40,7 +42,7 @@ void orion5x_spi_init(void);void orion5x_uart0_init (void );void orion5x_uart1_init (void );void orion5x_xor_init (void ); -void orion5x_restart (char ,const char *); +void orion5x_restart (enum reboot_mode ,const char *);/* * PCIe/PCI functions.
arch/arm/mach-orion5x/ls-chl-setup.c +1 -1
@@ -139,7 +139,7 @@ static struct mv_sata_platform_data lschl_sata_data = {static void lschl_power_off (void ) { -orion5x_restart ('h' ,NULL ); +orion5x_restart (REBOOT_COLD ,NULL ); }/*****************************************************************************
arch/arm/mach-orion5x/ls_hgl-setup.c +1 -1
@@ -185,7 +185,7 @@ static struct mv_sata_platform_data ls_hgl_sata_data = {static void ls_hgl_power_off (void ) { -orion5x_restart ('h' ,NULL ); +orion5x_restart (REBOOT_COLD ,NULL ); }
arch/arm/mach-orion5x/lsmini-setup.c +1 -1
@@ -185,7 +185,7 @@ static struct mv_sata_platform_data lsmini_sata_data = {static void lsmini_power_off (void ) { -orion5x_restart ('h' ,NULL ); +orion5x_restart (REBOOT_COLD ,NULL ); }
arch/arm/mach-picoxcell/common.c +2 -1
@@ -15,6 +15,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/of_platform.h> +#include <linux/reboot.h> #include <linux/dw_apb_timer.h> #include <asm/mach/arch.h>
@@ -70,7 +71,7 @@ static const char *picoxcell_dt_match[] = { NULL }; -static void picoxcell_wdt_restart (char mode,const char *cmd) +static void picoxcell_wdt_restart (enum reboot_mode mode,const char *cmd) {/* * Configure the watchdog to reset with the shortest possible timeout
arch/arm/mach-prima2/common.h +3 -1
@@ -10,6 +10,8 @@#define __MACH_PRIMA2_COMMON_H__#include <linux/init.h> +#include <linux/reboot.h> +#include <asm/mach/time.h> #include <asm/exception.h>
@@ -22,7 +24,7 @@ extern void sirfsoc_cpu_die(unsigned int cpu);extern void __init sirfsoc_of_irq_init (void );extern void __init sirfsoc_of_clk_init (void ); -extern void sirfsoc_restart (char ,const char *); +extern void sirfsoc_restart (enum reboot_mode ,const char *); extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs);#ifndef CONFIG_DEBUG_LL
arch/arm/mach-prima2/rstc.c +2 -1
@@ -13,6 +13,7 @@#include <linux/device.h> #include <linux/of.h> #include <linux/of_address.h> +#include <linux/reboot.h> void __iomem *sirfsoc_rstc_base;static DEFINE_MUTEX (rstc_lock);
@@ -82,7 +83,7 @@ int sirfsoc_reset_device(struct device *dev)#define SIRFSOC_SYS_RST_BIT BIT(31) -void sirfsoc_restart (char mode,const char *cmd) +void sirfsoc_restart (enum reboot_mode mode,const char *cmd) {writel (SIRFSOC_SYS_RST_BIT , sirfsoc_rstc_base); }
arch/arm/mach-pxa/corgi.c +3 -3
@@ -663,16 +663,16 @@ static void corgi_poweroff(void)/* Green LED off tells the bootloader to halt */ gpio_set_value (CORGI_GPIO_LED_GREEN ,0 ); -pxa_restart ('h' ,NULL ); +pxa_restart (REBOOT_COLD ,NULL ); } -static void corgi_restart (char mode,const char *cmd) +static void corgi_restart (enum reboot_mode mode,const char *cmd) {if (!machine_is_corgi ())/* Green LED on tells the bootloader to reboot */ gpio_set_value (CORGI_GPIO_LED_GREEN ,1 ); -pxa_restart ('h' , cmd); +pxa_restart (REBOOT_COLD , cmd); }static void __init corgi_init (void )
arch/arm/mach-pxa/generic.h +3 -1
@@ -9,6 +9,8 @@* published by the Free Software Foundation. */ +#include <linux/reboot.h> +struct irq_data ;extern void pxa_timer_init (void );
@@ -56,4 +58,4 @@ void __init pxa_set_btuart_info(void *info);void __init pxa_set_stuart_info (void *info);void __init pxa_set_hwuart_info (void *info); -void pxa_restart (char ,const char *); +void pxa_restart (enum reboot_mode ,const char *);
arch/arm/mach-pxa/mioa701.c +4 -3
@@ -37,6 +37,7 @@#include <linux/wm97xx.h> #include <linux/mtd/physmap.h> #include <linux/usb/gpio_vbus.h> +#include <linux/reboot.h> #include <linux/regulator/max1586.h> #include <linux/slab.h> #include <linux/i2c/pxa-i2c.h>
@@ -691,13 +692,13 @@ static void mioa701_machine_exit(void);static void mioa701_poweroff (void ) {mioa701_machine_exit (); -pxa_restart ('s' ,NULL ); +pxa_restart (REBOOT_WARM ,NULL ); } -static void mioa701_restart (char c,const char *cmd) +static void mioa701_restart (enum reboot_mode c,const char *cmd) {mioa701_machine_exit (); -pxa_restart ('s' , cmd); +pxa_restart (REBOOT_WARM , cmd); }static struct gpio global_gpios[] = {
arch/arm/mach-pxa/poodle.c +1 -1
@@ -422,7 +422,7 @@ static struct i2c_board_info __initdata poodle_i2c_devices[] = {static void poodle_poweroff (void ) { -pxa_restart ('h' ,NULL ); +pxa_restart (REBOOT_COLD ,NULL ); }static void __init poodle_init (void )
arch/arm/mach-pxa/reset.c +4 -4
@@ -83,7 +83,7 @@ static void do_hw_reset(void)writel_relaxed (readl_relaxed (OSCR ) +368640 ,OSMR3 ); } -void pxa_restart (char mode,const char *cmd) +void pxa_restart (enum reboot_mode mode,const char *cmd) {local_irq_disable ();local_fiq_disable ();
@@ -91,14 +91,14 @@ void pxa_restart(char mode, const char *cmd)clear_reset_status (RESET_STATUS_ALL );switch (mode) { -case 's' : +case REBOOT_WARM :/* Jump into ROM at address 0 */ soft_restart (0 );break ; -case 'g' : +case REBOOT_GPIO :do_gpio_reset ();break ; -case 'h' : +case REBOOT_COLD :default :do_hw_reset ();break ;
arch/arm/mach-pxa/spitz.c +3 -2
@@ -31,6 +31,7 @@#include <linux/regulator/machine.h> #include <linux/io.h> #include <linux/module.h> +#include <linux/reboot.h> #include <asm/setup.h> #include <asm/mach-types.h>
@@ -924,10 +925,10 @@ static inline void spitz_i2c_init(void) {}******************************************************************************/ static void spitz_poweroff (void ) { -pxa_restart ('g' ,NULL ); +pxa_restart (REBOOT_GPIO ,NULL ); } -static void spitz_restart (char mode,const char *cmd) +static void spitz_restart (enum reboot_mode mode,const char *cmd) {uint32_t msc0 =__raw_readl (MSC0 );/* Bootloader magic for a reboot */
arch/arm/mach-pxa/tosa.c +3 -2
@@ -36,6 +36,7 @@#include <linux/input/matrix_keypad.h> #include <linux/i2c/pxa-i2c.h> #include <linux/usb/gpio_vbus.h> +#include <linux/reboot.h> #include <asm/setup.h> #include <asm/mach-types.h>
@@ -911,10 +912,10 @@ static struct platform_device *devices[] __initdata = {static void tosa_poweroff (void ) { -pxa_restart ('g' ,NULL ); +pxa_restart (REBOOT_GPIO ,NULL ); } -static void tosa_restart (char mode,const char *cmd) +static void tosa_restart (enum reboot_mode mode,const char *cmd) {uint32_t msc0 =__raw_readl (MSC0 );
arch/arm/mach-realview/realview_eb.c +2 -1
@@ -29,6 +29,7 @@#include <linux/io.h> #include <linux/irqchip/arm-gic.h> #include <linux/platform_data/clk-realview.h> +#include <linux/reboot.h> #include <mach/hardware.h> #include <asm/irq.h>
@@ -418,7 +419,7 @@ static void __init realview_eb_timer_init(void)realview_eb_twd_init (); } -static void realview_eb_restart (char mode,const char *cmd) +static void realview_eb_restart (enum reboot_mode mode,const char *cmd) {void __iomem *reset_ctrl =__io_address (REALVIEW_SYS_RESETCTL );void __iomem *lock_ctrl =__io_address (REALVIEW_SYS_LOCK );
arch/arm/mach-realview/realview_pb1176.c +2 -1
@@ -31,6 +31,7 @@#include <linux/io.h> #include <linux/irqchip/arm-gic.h> #include <linux/platform_data/clk-realview.h> +#include <linux/reboot.h> #include <mach/hardware.h> #include <asm/irq.h>
@@ -329,7 +330,7 @@ static void __init realview_pb1176_timer_init(void)realview_timer_init (IRQ_DC1176_TIMER0 ); } -static void realview_pb1176_restart (char mode,const char *cmd) +static void realview_pb1176_restart (enum reboot_mode mode,const char *cmd) {void __iomem *reset_ctrl =__io_address (REALVIEW_SYS_RESETCTL );void __iomem *lock_ctrl =__io_address (REALVIEW_SYS_LOCK );
arch/arm/mach-realview/realview_pb11mp.c +2 -1
@@ -29,6 +29,7 @@#include <linux/io.h> #include <linux/irqchip/arm-gic.h> #include <linux/platform_data/clk-realview.h> +#include <linux/reboot.h> #include <mach/hardware.h> #include <asm/irq.h>
@@ -316,7 +317,7 @@ static void __init realview_pb11mp_timer_init(void)realview_pb11mp_twd_init (); } -static void realview_pb11mp_restart (char mode,const char *cmd) +static void realview_pb11mp_restart (enum reboot_mode mode,const char *cmd) {void __iomem *reset_ctrl =__io_address (REALVIEW_SYS_RESETCTL );void __iomem *lock_ctrl =__io_address (REALVIEW_SYS_LOCK );
arch/arm/mach-realview/realview_pba8.c +2 -1
@@ -29,6 +29,7 @@#include <linux/io.h> #include <linux/irqchip/arm-gic.h> #include <linux/platform_data/clk-realview.h> +#include <linux/reboot.h> #include <asm/irq.h> #include <asm/mach-types.h>
@@ -264,7 +265,7 @@ static void __init realview_pba8_timer_init(void)realview_timer_init (IRQ_PBA8_TIMER0_1 ); } -static void realview_pba8_restart (char mode,const char *cmd) +static void realview_pba8_restart (enum reboot_mode mode,const char *cmd) {void __iomem *reset_ctrl =__io_address (REALVIEW_SYS_RESETCTL );void __iomem *lock_ctrl =__io_address (REALVIEW_SYS_LOCK );
arch/arm/mach-realview/realview_pbx.c +2 -1
@@ -28,6 +28,7 @@#include <linux/io.h> #include <linux/irqchip/arm-gic.h> #include <linux/platform_data/clk-realview.h> +#include <linux/reboot.h> #include <asm/irq.h> #include <asm/mach-types.h>
@@ -344,7 +345,7 @@ static void realview_pbx_fixup(struct tag *tags, char **from,#endif } -static void realview_pbx_restart (char mode,const char *cmd) +static void realview_pbx_restart (enum reboot_mode mode,const char *cmd) {void __iomem *reset_ctrl =__io_address (REALVIEW_SYS_RESETCTL );void __iomem *lock_ctrl =__io_address (REALVIEW_SYS_LOCK );
arch/arm/mach-rpc/riscpc.c +2 -1
@@ -20,6 +20,7 @@#include <linux/ata_platform.h> #include <linux/io.h> #include <linux/i2c.h> +#include <linux/reboot.h> #include <asm/elf.h> #include <asm/mach-types.h>
@@ -201,7 +202,7 @@ static int __init rpc_init(void)arch_initcall (rpc_init); -static void rpc_restart (char mode,const char *cmd) +static void rpc_restart (enum reboot_mode mode,const char *cmd) {iomd_writeb (0 ,IOMD_ROMCR0 );
arch/arm/mach-s3c24xx/common.h +7 -5
@@ -12,6 +12,8 @@#ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H#define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__ +#include <linux/reboot.h> +struct s3c2410_uartcfg ;#ifdef CONFIG_CPU_S3C2410
@@ -20,7 +22,7 @@ extern int s3c2410a_init(void);extern void s3c2410_map_io (void );extern void s3c2410_init_uarts (struct s3c2410_uartcfg *cfg,int no);extern void s3c2410_init_clocks (int xtal); -extern void s3c2410_restart (char mode,const char *cmd); +extern void s3c2410_restart (enum reboot_mode mode,const char *cmd);extern void s3c2410_init_irq (void );#else #define s3c2410_init_clocks NULL
@@ -36,7 +38,7 @@ extern void s3c2412_map_io(void);extern void s3c2412_init_uarts (struct s3c2410_uartcfg *cfg,int no);extern void s3c2412_init_clocks (int xtal);extern int s3c2412_baseclk_add (void ); -extern void s3c2412_restart (char mode,const char *cmd); +extern void s3c2412_restart (enum reboot_mode mode,const char *cmd);extern void s3c2412_init_irq (void );#else #define s3c2412_init_clocks NULL
@@ -51,7 +53,7 @@ extern void s3c2416_map_io(void);extern void s3c2416_init_uarts (struct s3c2410_uartcfg *cfg,int no);extern void s3c2416_init_clocks (int xtal);extern int s3c2416_baseclk_add (void ); -extern void s3c2416_restart (char mode,const char *cmd); +extern void s3c2416_restart (enum reboot_mode mode,const char *cmd);extern void s3c2416_init_irq (void );extern struct syscore_ops s3c2416_irq_syscore_ops;
@@ -66,7 +68,7 @@ extern struct syscore_ops s3c2416_irq_syscore_ops;extern void s3c244x_map_io (void );extern void s3c244x_init_uarts (struct s3c2410_uartcfg *cfg,int no);extern void s3c244x_init_clocks (int xtal); -extern void s3c244x_restart (char mode,const char *cmd); +extern void s3c244x_restart (enum reboot_mode mode,const char *cmd);#else #define s3c244x_init_clocks NULL#define s3c244x_init_uarts NULL
@@ -96,7 +98,7 @@ extern void s3c2443_map_io(void);extern void s3c2443_init_uarts (struct s3c2410_uartcfg *cfg,int no);extern void s3c2443_init_clocks (int xtal);extern int s3c2443_baseclk_add (void ); -extern void s3c2443_restart (char mode,const char *cmd); +extern void s3c2443_restart (enum reboot_mode mode,const char *cmd);extern void s3c2443_init_irq (void );#else #define s3c2443_init_clocks NULL
arch/arm/mach-s3c24xx/s3c2410.c +3 -2
@@ -22,6 +22,7 @@#include <linux/syscore_ops.h> #include <linux/serial_core.h> #include <linux/platform_device.h> +#include <linux/reboot.h> #include <linux/io.h> #include <asm/mach/arch.h>
@@ -195,9 +196,9 @@ int __init s3c2410a_init(void)return s3c2410_init (); } -void s3c2410_restart (char mode,const char *cmd) +void s3c2410_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) { +if (mode ==REBOOT_WARM ) {soft_restart (0 ); }
arch/arm/mach-s3c24xx/s3c2412.c +3 -2
@@ -22,6 +22,7 @@#include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> +#include <linux/reboot.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
@@ -129,9 +130,9 @@ static void s3c2412_idle(void)cpu_do_idle (); } -void s3c2412_restart (char mode,const char *cmd) +void s3c2412_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) +if (mode ==REBOOT_WARM )soft_restart (0 );/* errata "Watch-dog/Software Reset Problem" specifies that
arch/arm/mach-s3c24xx/s3c2416.c +3 -2
@@ -35,6 +35,7 @@#include <linux/syscore_ops.h> #include <linux/clk.h> #include <linux/io.h> +#include <linux/reboot.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
@@ -79,9 +80,9 @@ static struct device s3c2416_dev = { .bus = &s3c2416_subsys, }; -void s3c2416_restart (char mode,const char *cmd) +void s3c2416_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) +if (mode ==REBOOT_WARM )soft_restart (0 );__raw_writel (S3C2443_SWRST_RESET ,S3C2443_SWRST );
arch/arm/mach-s3c24xx/s3c2443.c +3 -2
@@ -22,6 +22,7 @@#include <linux/device.h> #include <linux/clk.h> #include <linux/io.h> +#include <linux/reboot.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
@@ -59,9 +60,9 @@ static struct device s3c2443_dev = { .bus = &s3c2443_subsys, }; -void s3c2443_restart (char mode,const char *cmd) +void s3c2443_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) +if (mode ==REBOOT_WARM )soft_restart (0 );__raw_writel (S3C2443_SWRST_RESET ,S3C2443_SWRST );
arch/arm/mach-s3c24xx/s3c244x.c +3 -2
@@ -18,6 +18,7 @@#include <linux/init.h> #include <linux/serial_core.h> #include <linux/platform_device.h> +#include <linux/reboot.h> #include <linux/device.h> #include <linux/syscore_ops.h> #include <linux/clk.h>
@@ -197,9 +198,9 @@ struct syscore_ops s3c244x_pm_syscore_ops = { .resume = s3c244x_resume, }; -void s3c244x_restart (char mode,const char *cmd) +void s3c244x_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) +if (mode ==REBOOT_WARM )soft_restart (0 );arch_wdt_reset ();
arch/arm/mach-s3c64xx/common.c +3 -2
@@ -26,6 +26,7 @@#include <linux/irq.h> #include <linux/gpio.h> #include <linux/irqchip/arm-vic.h> +#include <linux/reboot.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
@@ -375,9 +376,9 @@ static int __init s3c64xx_init_irq_eint(void) }arch_initcall (s3c64xx_init_irq_eint); -void s3c64xx_restart (char mode,const char *cmd) +void s3c64xx_restart (enum reboot_mode mode,const char *cmd) { -if (mode !='s' ) +if (mode !=REBOOT_WARM )arch_wdt_reset ();/* if all else fails, or mode was for soft, jump to 0 */
arch/arm/mach-s3c64xx/common.h +3 -1
@@ -17,13 +17,15 @@#ifndef __ARCH_ARM_MACH_S3C64XX_COMMON_H#define __ARCH_ARM_MACH_S3C64XX_COMMON_H +#include <linux/reboot.h> +void s3c64xx_init_irq (u32 vic0,u32 vic1);void s3c64xx_init_io (struct map_desc *mach_desc,int size);void s3c64xx_register_clocks (unsigned long xtal,unsigned armclk_limit);void s3c64xx_setup_clocks (void ); -void s3c64xx_restart (char mode,const char *cmd); +void s3c64xx_restart (enum reboot_mode mode,const char *cmd);void s3c64xx_init_late (void );#ifdef CONFIG_CPU_S3C6400
arch/arm/mach-s5p64x0/common.c +3 -2
@@ -24,6 +24,7 @@#include <linux/dma-mapping.h> #include <linux/gpio.h> #include <linux/irq.h> +#include <linux/reboot.h> #include <asm/irq.h> #include <asm/proc-fns.h>
@@ -437,9 +438,9 @@ static int __init s5p64x0_init_irq_eint(void) }arch_initcall (s5p64x0_init_irq_eint); -void s5p64x0_restart (char mode,const char *cmd) +void s5p64x0_restart (enum reboot_mode mode,const char *cmd) { -if (mode !='s' ) +if (mode !=REBOOT_WARM )arch_wdt_reset ();soft_restart (0 );
arch/arm/mach-s5p64x0/common.h +3 -1
@@ -12,6 +12,8 @@#ifndef __ARCH_ARM_MACH_S5P64X0_COMMON_H#define __ARCH_ARM_MACH_S5P64X0_COMMON_H +#include <linux/reboot.h> +void s5p6440_init_irq (void );void s5p6450_init_irq (void );void s5p64x0_init_io (struct map_desc *mach_desc,int size);
@@ -22,7 +24,7 @@ void s5p6440_setup_clocks(void);void s5p6450_register_clocks (void );void s5p6450_setup_clocks (void ); -void s5p64x0_restart (char mode,const char *cmd); +void s5p64x0_restart (enum reboot_mode mode,const char *cmd);#ifdef CONFIG_CPU_S5P6440
arch/arm/mach-s5pc100/common.c +3 -2
@@ -24,6 +24,7 @@#include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/sched.h> +#include <linux/reboot.h> #include <asm/irq.h> #include <asm/proc-fns.h>
@@ -216,9 +217,9 @@ void __init s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no)s3c24xx_init_uartdevs ("s3c6400-uart" , s5p_uart_resources, cfg, no); } -void s5pc100_restart (char mode,const char *cmd) +void s5pc100_restart (enum reboot_mode mode,const char *cmd) { -if (mode !='s' ) +if (mode !=REBOOT_WARM )arch_wdt_reset ();soft_restart (0 );
arch/arm/mach-s5pc100/common.h +3 -1
@@ -12,13 +12,15 @@#ifndef __ARCH_ARM_MACH_S5PC100_COMMON_H#define __ARCH_ARM_MACH_S5PC100_COMMON_H +#include <linux/reboot.h> +void s5pc100_init_io (struct map_desc *mach_desc,int size);void s5pc100_init_irq (void );void s5pc100_register_clocks (void );void s5pc100_setup_clocks (void ); -void s5pc100_restart (char mode,const char *cmd); +void s5pc100_restart (enum reboot_mode mode,const char *cmd);extern int s5pc100_init (void );extern void s5pc100_map_io (void );
arch/arm/mach-s5pv210/common.c +1 -1
@@ -143,7 +143,7 @@ static struct map_desc s5pv210_iodesc[] __initdata = { } }; -void s5pv210_restart (char mode,const char *cmd) +void s5pv210_restart (enum reboot_mode mode,const char *cmd) {__raw_writel (0x1 ,S5P_SWRESET ); }
arch/arm/mach-s5pv210/common.h +3 -1
@@ -12,13 +12,15 @@#ifndef __ARCH_ARM_MACH_S5PV210_COMMON_H#define __ARCH_ARM_MACH_S5PV210_COMMON_H +#include <linux/reboot.h> +void s5pv210_init_io (struct map_desc *mach_desc,int size);void s5pv210_init_irq (void );void s5pv210_register_clocks (void );void s5pv210_setup_clocks (void ); -void s5pv210_restart (char mode,const char *cmd); +void s5pv210_restart (enum reboot_mode mode,const char *cmd);extern int s5pv210_init (void );extern void s5pv210_map_io (void );
arch/arm/mach-sa1100/generic.c +3 -2
@@ -19,6 +19,7 @@#include <linux/cpufreq.h> #include <linux/ioport.h> #include <linux/platform_device.h> +#include <linux/reboot.h> #include <video/sa1100fb.h>
@@ -131,9 +132,9 @@ static void sa1100_power_off(void)PMCR =PMCR_SF ; } -void sa11x0_restart (char mode,const char *cmd) +void sa11x0_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) { +if (mode ==REBOOT_WARM ) {/* Jump into ROM at address 0 */ soft_restart (0 ); }else {
arch/arm/mach-sa1100/generic.h +2 -1
@@ -3,12 +3,13 @@* * Author: Nicolas Pitre */ +#include <linux/reboot.h> extern void sa1100_timer_init (void );extern void __init sa1100_map_io (void );extern void __init sa1100_init_irq (void );extern void __init sa1100_init_gpio (void ); -extern void sa11x0_restart (char ,const char *); +extern void sa11x0_restart (enum reboot_mode ,const char *);extern void sa11x0_init_late (void );#define SET_BANK (__nr,__start,__size) \
arch/arm/mach-shark/core.c +2 -1
@@ -11,6 +11,7 @@#include <linux/serial_8250.h> #include <linux/io.h> #include <linux/cpu.h> +#include <linux/reboot.h> #include <asm/setup.h> #include <asm/mach-types.h>
@@ -24,7 +25,7 @@#define ROMCARD_SIZE 0x08000000#define ROMCARD_START 0x10000000 -static void shark_restart (char mode,const char *cmd) +static void shark_restart (enum reboot_mode mode,const char *cmd) {short temp;/* Reset the Machine via pc[3] of the sequoia chipset */
arch/arm/mach-shmobile/board-armadillo800eva.c +2 -1
@@ -42,6 +42,7 @@#include <linux/mmc/sh_mmcif.h> #include <linux/mmc/sh_mobile_sdhi.h> #include <linux/i2c-gpio.h> +#include <linux/reboot.h> #include <mach/common.h> #include <mach/irqs.h> #include <mach/r8a7740.h>
@@ -1277,7 +1278,7 @@ static void __init eva_add_early_devices(void) }#define RESCNT2 IOMEM(0xe6188020) -static void eva_restart (char mode,const char *cmd) +static void eva_restart (enum reboot_mode mode,const char *cmd) {/* Do soft power on reset */ writel ((1 <<31 ),RESCNT2 );
arch/arm/mach-shmobile/board-kzm9g.c +2 -1
@@ -33,6 +33,7 @@#include <linux/pinctrl/machine.h> #include <linux/pinctrl/pinconf-generic.h> #include <linux/platform_device.h> +#include <linux/reboot.h> #include <linux/regulator/fixed.h> #include <linux/regulator/machine.h> #include <linux/smsc911x.h>
@@ -806,7 +807,7 @@ static void __init kzm_init(void)sh73a0_pm_init (); } -static void kzm9g_restart (char mode,const char *cmd) +static void kzm9g_restart (enum reboot_mode mode,const char *cmd) {#define RESCNT2 IOMEM(0xe6188020)/* Do soft power on reset */
arch/arm/mach-socfpga/socfpga.c +2 -1
@@ -20,6 +20,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/of_platform.h> +#include <linux/reboot.h> #include <asm/hardware/cache-l2x0.h> #include <asm/mach/arch.h>
@@ -90,7 +91,7 @@ static void __init socfpga_init_irq(void)socfpga_sysmgr_init (); } -static void socfpga_cyclone5_restart (char mode,const char *cmd) +static void socfpga_cyclone5_restart (enum reboot_mode mode,const char *cmd) {u32 temp;
arch/arm/mach-spear/generic.h +3 -1
@@ -16,6 +16,8 @@#include <linux/dmaengine.h> #include <linux/amba/pl08x.h> #include <linux/init.h> +#include <linux/reboot.h> +#include <asm/mach/time.h> extern void spear13xx_timer_init (void );
@@ -37,7 +39,7 @@ void __init spear6xx_clk_init(void __iomem *misc_base);void __init spear13xx_map_io (void );void __init spear13xx_l2x0_init (void ); -void spear_restart (char ,const char *); +void spear_restart (enum reboot_mode ,const char *);void spear13xx_secondary_startup (void );void __cpuinit spear13xx_cpu_die (unsigned int cpu);
arch/arm/mach-spear/restart.c +3 -2
@@ -12,14 +12,15 @@*/ #include <linux/io.h> #include <linux/amba/sp810.h> +#include <linux/reboot.h> #include <asm/system_misc.h> #include <mach/spear.h> #include "generic.h" #define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204) -void spear_restart (char mode,const char *cmd) +void spear_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) { +if (mode ==REBOOT_WARM ) {/* software reset, Jump into ROM at address 0 */ soft_restart (0 ); }else {
arch/arm/mach-sunxi/sunxi.c +2 -1
@@ -19,6 +19,7 @@#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/io.h> +#include <linux/reboot.h> #include <linux/clk/sunxi.h>
@@ -36,7 +37,7 @@static void __iomem *wdt_base; -static void sun4i_restart (char mode,const char *cmd) +static void sun4i_restart (enum reboot_mode mode,const char *cmd) {if (!wdt_base)return ;
arch/arm/mach-tegra/board.h +2 -1
@@ -23,8 +23,9 @@#define __MACH_TEGRA_BOARD_H#include <linux/types.h> +#include <linux/reboot.h> -void tegra_assert_system_reset (char mode,const char *cmd); +void tegra_assert_system_reset (enum reboot_mode mode,const char *cmd);void __init tegra_init_early (void );void __init tegra_map_common_io (void );
arch/arm/mach-tegra/common.c +2 -1
@@ -24,6 +24,7 @@#include <linux/delay.h> #include <linux/irqchip.h> #include <linux/clk/tegra.h> +#include <linux/reboot.h> #include <asm/hardware/cache-l2x0.h>
@@ -67,7 +68,7 @@ void __init tegra_dt_init_irq(void) }#endif -void tegra_assert_system_reset (char mode,const char *cmd) +void tegra_assert_system_reset (enum reboot_mode mode,const char *cmd) {void __iomem *reset =IO_ADDRESS (TEGRA_PMC_BASE +0 );u32 reg;
arch/arm/mach-u300/core.c +3 -3
@@ -671,11 +671,11 @@ static void __init u300_init_machine(void)/* Forward declare this function from the watchdog */ void coh901327_watchdog_reset (void ); -static void u300_restart (char mode,const char *cmd) +static void u300_restart (enum reboot_mode mode,const char *cmd) {switch (mode) { -case 's' : -case 'h' : +case REBOOT_WARM : +case REBOOT_COLD :#ifdef CONFIG_COH901327_WATCHDOG coh901327_watchdog_reset ();#endif
arch/arm/mach-versatile/core.c +2 -1
@@ -38,6 +38,7 @@#include <linux/clkdev.h> #include <linux/mtd/physmap.h> #include <linux/bitops.h> +#include <linux/reboot.h> #include <asm/irq.h> #include <asm/hardware/arm_timer.h>
@@ -733,7 +734,7 @@ static void versatile_leds_event(led_event_t ledevt) }#endif /* CONFIG_LEDS */ -void versatile_restart (char mode,const char *cmd) +void versatile_restart (enum reboot_mode mode,const char *cmd) {void __iomem *sys =__io_address (VERSATILE_SYS_BASE );u32 val;
arch/arm/mach-versatile/core.h +2 -1
@@ -24,13 +24,14 @@#include <linux/amba/bus.h> #include <linux/of_platform.h> +#include <linux/reboot.h> extern void __init versatile_init (void );extern void __init versatile_init_early (void );extern void __init versatile_init_irq (void );extern void __init versatile_map_io (void );extern void versatile_timer_init (void ); -extern void versatile_restart (char ,const char *); +extern void versatile_restart (enum reboot_mode ,const char *);extern unsigned int mmc_status (struct device *dev);#ifdef CONFIG_OF extern struct of_dev_auxdata versatile_auxdata_lookup[];
arch/arm/mach-vt8500/vt8500.c +2 -1
@@ -22,6 +22,7 @@#include <linux/io.h> #include <linux/irqchip.h> #include <linux/pm.h> +#include <linux/reboot.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -47,7 +48,7 @@static void __iomem *pmc_base; -void vt8500_restart (char mode,const char *cmd) +void vt8500_restart (enum reboot_mode mode,const char *cmd) {if (pmc_base)writel (1 , pmc_base +VT8500_PMSR_REG );
arch/arm/mach-w90x900/cpu.c +2 -2
@@ -230,9 +230,9 @@ void __init nuc900_init_clocks(void)#define WTE (1 << 7)#define WTRE (1 << 1) -void nuc9xx_restart (char mode,const char *cmd) +void nuc9xx_restart (enum reboot_mode mode,const char *cmd) { -if (mode =='s' ) { +if (mode ==REBOOT_WARM ) {/* Jump into ROM@address 0 */ soft_restart (0 ); }else {
arch/arm/mach-w90x900/nuc9xx.h +4 -1
@@ -14,10 +14,13 @@* published by the Free Software Foundation. * */ + +#include <linux/reboot.h> +struct map_desc ;/* core initialisation functions */ extern void nuc900_init_irq (void );extern void nuc900_timer_init (void ); -extern void nuc9xx_restart (char ,const char *); +extern void nuc9xx_restart (enum reboot_mode ,const char *);
arch/arm/plat-iop/gpio.c +1 -0
@@ -17,6 +17,7 @@#include <linux/gpio.h> #include <linux/export.h> #include <asm/hardware/iop3xx.h> +#include <mach/gpio.h> void gpio_line_config (int line,int direction) {
arch/arm/plat-iop/restart.c +1 -1
@@ -11,7 +11,7 @@#include <asm/system_misc.h> #include <mach/hardware.h> -void iop3xx_restart (char mode,const char *cmd) +void iop3xx_restart (enum reboot_mode mode,const char *cmd) { *IOP3XX_PCSR =0x30 ;
drivers/power/reset/restart-poweroff.c +2 -1
@@ -15,11 +15,12 @@#include <linux/platform_device.h> #include <linux/of_platform.h> #include <linux/module.h> +#include <linux/reboot.h> #include <asm/system_misc.h> static void restart_poweroff_do_poweroff (void ) { -arm_pm_restart ('h' ,NULL ); +arm_pm_restart (REBOOT_COLD ,NULL ); }static int restart_poweroff_probe (struct platform_device *pdev)
drivers/power/reset/vexpress-poweroff.c +1 -1
@@ -48,7 +48,7 @@ static void vexpress_power_off(void)static struct device *vexpress_restart_device; -static void vexpress_restart (char str,const char *cmd) +static void vexpress_restart (enum reboot_mode reboot_mode,const char *cmd) {vexpress_reset_do (vexpress_restart_device,"restart" ); }
include/linux/reboot.h +1 -0
@@ -13,6 +13,7 @@enum reboot_mode {REBOOT_COLD =0 ,REBOOT_WARM , +REBOOT_GPIO , };extern int register_reboot_notifier (struct notifier_block *);
include/linux/vexpress.h +1 -0
@@ -15,6 +15,7 @@#define _LINUX_VEXPRESS_H#include <linux/device.h> +#include <linux/reboot.h> #define VEXPRESS_SITE_MB 0#define VEXPRESS_SITE_DB1 1
Signature · 1 line
1.8.2.1
PATCH 11/11 Move arch/x86 reboot= handling to generic kernel.
In reply to Robin HoltMerge together the unicore32, arm, and x86 reboot= command line parameter handling.
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
--- Documentation/kernel-parameters.txt | 18 ++++- arch/arm/kernel/process.c | 10 --- arch/unicore32/kernel/process.c | 10 --- arch/x86/include/asm/emergency-restart.h | 12 ---- arch/x86/kernel/apic/x2apic_uv_x.c | 2 +- arch/x86/kernel/reboot.c | 111 +------------------------------ include/linux/reboot.h | 17 +++++ kernel/reboot.c | 90 ++++++++++++++++++++++++- 8 files changed, 125 insertions(+), 145 deletions(-)
Documentation/kernel-parameters.txt +15 -3
@@ -2677,9 +2677,21 @@ bytes respectively. Such letter suffixes can also be entirely omitted. Run specified binary instead of /init from the ramdisk, used for early userspace startup. See initrd. - reboot= [BUGS=X86-32,BUGS=ARM,BUGS=IA-64] Rebooting mode - Format: <reboot_mode>[,<reboot_mode2>[,...]] - See arch/*/kernel/reboot.c or arch/*/kernel/process.c + reboot= [KNL] + Format (x86 or x86_64): + [w[arm] | c[old]] \ + [,] s[mp]#### \ + [,b[ios] | a[cpi] | k[bd] | t[riple] | e[fi] | p[ci]] \ + [,f[orce] + Format (all other archs): + [s[oft] | h[ard]] \ + [,b[ios] | a[cpi] | k[bd] | t[riple] | e[fi] | p[ci]] \ + [,f[orce]] + Where reboot_mode is one of warm (soft) or cold, + reboot_type is one of bios, acpi, kbd, triple, efi, or pci, + reboot_force is either force or not specified, + reboot_cpu is s[mp]#### with #### being the processor + (in decimal) to be used for rebooting. relax_domain_level= [KNL, SMP] Set scheduler's default relax_domain_level.
arch/arm/kernel/process.c +0 -10
@@ -175,16 +175,6 @@ void arch_cpu_idle(void)default_idle (); } -enum reboot_mode reboot_mode; - -static int __init reboot_setup (char *str) -{ -if ('s' == str[0 ]) - reboot_mode =REBOOT_WARM ; -return 1 ; -} -__setup ("reboot=" , reboot_setup); -void machine_shutdown (void ) {#ifdef CONFIG_SMP
arch/unicore32/kernel/process.c +0 -10
@@ -51,16 +51,6 @@ void arch_cpu_idle(void)local_irq_enable (); } -static enum reboot_mode reboot_mode; - -int __init reboot_setup (char *str) -{ -if ('s' == str[0 ]) - reboot_mode =REBOOT_WARM ; -return 1 ; -} -__setup ("reboot=" , reboot_setup); -void machine_halt (void ) {gpio_set_value (GPO_SOFT_OFF ,0 );
arch/x86/include/asm/emergency-restart.h +0 -12
@@ -1,18 +1,6 @@#ifndef _ASM_X86_EMERGENCY_RESTART_H#define _ASM_X86_EMERGENCY_RESTART_H -enum reboot_type { -BOOT_TRIPLE ='t' , -BOOT_KBD ='k' , -BOOT_BIOS ='b' , -BOOT_ACPI ='a' , -BOOT_EFI ='e' , -BOOT_CF9 ='p' , -BOOT_CF9_COND ='q' , -}; - -extern enum reboot_type reboot_type; -extern void machine_emergency_restart (void );#endif /* _ASM_X86_EMERGENCY_RESTART_H */
arch/x86/kernel/apic/x2apic_uv_x.c +1 -1
@@ -25,6 +25,7 @@#include <linux/kdebug.h> #include <linux/delay.h> #include <linux/crash_dump.h> +#include <linux/reboot.h> #include <asm/uv/uv_mmrs.h> #include <asm/uv/uv_hub.h>
@@ -36,7 +37,6 @@#include <asm/ipi.h> #include <asm/smp.h> #include <asm/x86_init.h> -#include <asm/emergency-restart.h> #include <asm/nmi.h> /* BMC sets a bit this MMR non-zero before sending an NMI */
arch/x86/kernel/reboot.c +3 -108
130 lines not on this page · raw message
include/linux/reboot.h +17 -0
@@ -15,6 +15,23 @@ enum reboot_mode {REBOOT_WARM , REBOOT_GPIO, }; +extern enum reboot_mode reboot_mode; + +enum reboot_type { +BOOT_TRIPLE ='t' , +BOOT_KBD ='k' , +BOOT_BIOS ='b' , +BOOT_ACPI ='a' , +BOOT_EFI ='e' , +BOOT_CF9 ='p' , +BOOT_CF9_COND ='q' , +}; +extern enum reboot_type reboot_type; + +extern int reboot_default; +extern int reboot_cpu; +extern int reboot_force; +extern int register_reboot_notifier (struct notifier_block *);extern int unregister_reboot_notifier (struct notifier_block *);
kernel/reboot.c +89 -1
105 lines not on this page · raw message
Signature · 1 line
1.8.2.1
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Quoted 2 lines · Robin Holt
Merge together the unicore32, arm, and x86 reboot= command line parameter handling.
The series still has this CONFIG_X86 dependency that I inquired about previously:
Quoted 55 lines
kernel/reboot.c +55
-0+static int __init reboot_setup (char *str) +{ +for (;;) { +/* +* Having anything passed on the command line via +* reboot= will cause us to disable DMI checking +* below. +*/ + reboot_default =0 ; + +switch (*str) { +#if defined(CONFIG_X86 ) || defined(CONFIG_X86_64 ) +case 'w' : + reboot_mode =REBOOT_WARM ; +break ; + +case 'c' : + reboot_mode =REBOOT_COLD ; +break ; + +#ifdef CONFIG_SMP +case 's' : +if (isdigit (*(str+1 ))) { + reboot_cpu = (int ) (*(str+1 ) -'0' ); +if (isdigit (*(str+2 ))) + reboot_cpu = reboot_cpu*10 + (int )(*(str+2 ) -'0' ); + } +/* +* We will leave sorting out the final value +* when we are ready to reboot, since we might not +* have detected BSP APIC ID or smp_num_cpu +*/ +break ; +#endif /* CONFIG_SMP */ + +#else +case 's' : + reboot_mode =REBOOT_WARM ; +case 'h' : + reboot_mode =REBOOT_COLD ; +case 'g' : + reboot_mode =REBOOT_GPIO ; +#endif + +case 'b' : +case 'a' : +case 'k' : +case 't' : +case 'e' : +case 'p' : + reboot_type = *str; +break ; + +case 'f' : + reboot_force =1 ;
kernel/reboot.c int orderly_poweroff(bool force) · line 431
Quoted 10 lines
kernel/reboot.c +10
-0+break ; + } + + str =strchr (str,',' ); +if (str) + str++; +else +break ; + } +return 1 ;
To explain my concern more verbosely, if we cannot make it 'obviously generic' then there's no point in moving it to kernel/reboot.c ...
And yes, I realize that there's an option clash between architectures - see below for potential solutions to that.
To generalize it, firstly here's a summary of the existing reboot option mappings:
x86-only: w, c, s
non-x86: s, h, g
generic: b, a, k, t, e, p, f
it appears that 'w', 'c', 'h', and 'g' could be made generic straight away.
Which leaves 's' as the only truly problematic option:
- it means REBOOT_WARM on some non-x86 platform(s?)
- while it means the SMP-cpu on x86.
Stupid question: which non-x86 platform(s) use 's'?
I think we should either change that platform to have 'w' as the warm reboot (and hope that no-one actually relies on the old 's' option: it's a truly rare option) - or change the x86 mapping from 's' to 'S' and generalize and unify it thusly.
Another cleanliness problem is the duality of reboot_mode and reboot_type. We should pick one and use it everywhere consistently.
[ Once these problems are solved and there's no objections from others to
this approach, I'd be willing to apply, test and push this series to Linus. ]
Thanks,
Ingo
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Quoted 11 lines · Ingo Molnar
To generalize it, firstly here's a summary of the existing reboot option mappings:
x86-only: w, c, s
non-x86: s, h, g
generic: b, a, k, t, e, p, fit appears that 'w', 'c', 'h', and 'g' could be made generic straight away.
Quoted 6 lines
Which leaves 's' as the only truly problematic option:
- it means
REBOOT_WARMon some non-x86 platform(s?)
- while it means the SMP-cpu on x86.Stupid question: which non-x86 platform(s) use 's'?
Let's try to get the meaning back. On ARM, these are taken from the first letter of the 'reboot=' command line argument, which was initially either "hard" or "soft". This refers to whether we hit some bit of hardware which physically asserts some reset line in the system, or merely vector the CPU via the reset vector (for some systems, this is the only possibility.)
Then PXA happened, and there was a need for some platforms there to do a hardware restart via toggling a GPIO output, which would then ultimately assert the system reset line. So we then added the "gpio" mode as well. reboot via toggling a GPIO output. So we then ended up with "gpio" as well.
So, on ARM, the modes are: hard, soft, gpio, which get translated to a single letter by the simple parsing code:
static char reboot_mode = 'h';
int __init reboot_setup(char *str)
{
reboot_mode = str[0];
return 1;
}__setup("reboot=", reboot_setup);
Now, arguably, "hard" and "soft" have an entirely different meaning to "warm" and "cold" in the normal parlence. A "warm" reboot involves the system doing less tasks at restart than a "cold" reboot. This is not necessarily the case between 'hard' and 'soft'.
So, while I don't entirely agree with mapping "hard" to "cold" and "soft" to "warm", I guess for the sake of generalisation it's okay. However, thinking about the future, if ARM becomes more server-like, we might also want "cold" and "warm" reboot identifiers too.
I think the solution to this would be to have the new generic code parse the entire argument, not just the first letter - certainly for the 's' case. If it's the x86 version, it'll be "s<number>". If it's the ARM version, it should be "soft".
H. Peter Anvin
reviewerRe: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Quoted 37 lines · Russell King - ARM Linux
Let's try to get the meaning back. On ARM, these are taken from the first letter of the 'reboot=' command line argument, which was initially either "hard" or "soft". This refers to whether we hit some bit of hardware which physically asserts some reset line in the system, or merely vector the CPU via the reset vector (for some systems, this is the only possibility.)
Then PXA happened, and there was a need for some platforms there to do a hardware restart via toggling a GPIO output, which would then ultimately assert the system reset line. So we then added the "gpio" mode as well. reboot via toggling a GPIO output. So we then ended up with "gpio" as well.
So, on ARM, the modes are: hard, soft, gpio, which get translated to a single letter by the simple parsing code:
static char
reboot_mode= 'h';int
__initreboot_setup(char *str){ reboot_mode = str[0]; return 1; }
__setup("reboot=", reboot_setup);Now, arguably, "hard" and "soft" have an entirely different meaning to "warm" and "cold" in the normal parlence. A "warm" reboot involves the system doing less tasks at restart than a "cold" reboot. This is not necessarily the case between 'hard' and 'soft'.
So, while I don't entirely agree with mapping "hard" to "cold" and "soft" to "warm", I guess for the sake of generalisation it's okay. However, thinking about the future, if ARM becomes more server-like, we might also want "cold" and "warm" reboot identifiers too.
Quoted 5 lines
I think the solution to this would be to have the new generic code parse the entire argument, not just the first letter - certainly for the 's' case. If it's the x86 version, it'll be "s<number>". If it's the ARM version, it should be "soft".
The s<number> thing is pretty awful, admittedly (it was supposed to be smp<number>, but the parser, rather than *allowing* only the first letter, seems to *require* that it is only the first letter.)
The problem I see is that we don't know what we'll break if we change it, but Ingo seems to think it doesn't matter so much.
For the boolean letter argument, we could simply have the parser set a bitmask of the letters seen; the x86 "s" argument is clearly an outlier.
We could handle it in a generic exception by looking for s<digit> or smp<digit>, which will not match ARM's "soft" argument. I suspect we can worry about other argument-carrying options in a generic fashion when the need arises; I would personally prefer the "subtag:argument" format used by libata &c for that, and the presence of a ':' would be indicative.
-hpa
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Quoted 54 lines · H. Peter Anvin
Quoted 37 lines · Russell King - ARM Linux
Let's try to get the meaning back. On ARM, these are taken from the first letter of the 'reboot=' command line argument, which was initially either "hard" or "soft". This refers to whether we hit some bit of hardware which physically asserts some reset line in the system, or merely vector the CPU via the reset vector (for some systems, this is the only possibility.)
Then PXA happened, and there was a need for some platforms there to do a hardware restart via toggling a GPIO output, which would then ultimately assert the system reset line. So we then added the "gpio" mode as well. reboot via toggling a GPIO output. So we then ended up with "gpio" as well.
So, on ARM, the modes are: hard, soft, gpio, which get translated to a single letter by the simple parsing code:
static char
reboot_mode= 'h';int
__initreboot_setup(char *str){ reboot_mode = str[0]; return 1; }
__setup("reboot=", reboot_setup);Now, arguably, "hard" and "soft" have an entirely different meaning to "warm" and "cold" in the normal parlence. A "warm" reboot involves the system doing less tasks at restart than a "cold" reboot. This is not necessarily the case between 'hard' and 'soft'.
So, while I don't entirely agree with mapping "hard" to "cold" and "soft" to "warm", I guess for the sake of generalisation it's okay. However, thinking about the future, if ARM becomes more server-like, we might also want "cold" and "warm" reboot identifiers too.
Quoted 5 lines
I think the solution to this would be to have the new generic code parse the entire argument, not just the first letter - certainly for the 's' case. If it's the x86 version, it'll be "s<number>". If it's the ARM version, it should be "soft".
The s<number> thing is pretty awful, admittedly (it was supposed to be smp<number>, but the parser, rather than *allowing* only the first letter, seems to *require* that it is only the first letter.)
The problem I see is that we don't know what we'll break if we change it, but Ingo seems to think it doesn't matter so much.
For the boolean letter argument, we could simply have the parser set a bitmask of the letters seen; the x86 "s" argument is clearly an outlier.
Quoted 6 lines
We could handle it in a generic exception by looking for s<digit> or smp<digit>, which will not match ARM's "soft" argument. I suspect we can worry about other argument-carrying options in a generic fashion when the need arises; I would personally prefer the "subtag:argument" format used by libata &c for that, and the presence of a ':' would be indicative.
Is there really a reason for having this conglomeration of disparate options all merged together? Why can't we go with having a separate param(reboot_cpu, int, 0644); so it can be controlled via sysfs as well? If we are breaking the reboot=s## syntax, why not become a little more standardized with the reboot_cpu?
Robin
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Is the what everyone is expecting?
Robin
---
Quoted 1 line
From
ebed0c3119bc35248bdfdc4d9966cf339d8621b7Mon Sep 17 00:00:00 2001
From: Robin Holt <[email protected]>
Date: Wed, 24 Apr 2013 06:18:53 -0500
Subject: [PATCH -v9 11/11] Move arch/x86 reboot= handling to generic kernel.
Merge together the unicore32, arm, and x86 reboot= command line parameter handling.
To: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Russell King <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Russ Anderson <[email protected]>
Cc: Robin Holt <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: the arch/x86 maintainers <[email protected]>
Cc: Arm Mailing List <[email protected]>
---
Changes since -v8
- Add missing break statements.
- Change parsing so #ifdef's are no longer needed.
- Switch to using simple_strtoul to make parsing cleaner.
--- Documentation/kernel-parameters.txt | 14 +++- arch/arm/kernel/process.c | 10 --- arch/unicore32/kernel/process.c | 10 --- arch/x86/include/asm/emergency-restart.h | 12 ---- arch/x86/kernel/apic/x2apic_uv_x.c | 2 +- arch/x86/kernel/reboot.c | 111 +------------------------------ include/linux/reboot.h | 17 +++++ kernel/reboot.c | 80 +++++++++++++++++++++- 8 files changed, 111 insertions(+), 145 deletions(-)
Documentation/kernel-parameters.txt +11 -3
@@ -2677,9 +2677,17 @@ bytes respectively. Such letter suffixes can also be entirely omitted. Run specified binary instead of /init from the ramdisk, used for early userspace startup. See initrd. - reboot= [BUGS=X86-32,BUGS=ARM,BUGS=IA-64] Rebooting mode - Format: <reboot_mode>[,<reboot_mode2>[,...]] - See arch/*/kernel/reboot.c or arch/*/kernel/process.c + reboot= [KNL] + Format (x86 or x86_64): + [w[arm] | c[old] | h[ard] | s[oft] | g[pio]] \ + [[,]s[mp]#### \ + [[,]b[ios] | a[cpi] | k[bd] | t[riple] | e[fi] | p[ci]] \ + [[,]f[orce] + Where reboot_mode is one of warm (soft) or cold (hard) or gpio, + reboot_type is one of bios, acpi, kbd, triple, efi, or pci, + reboot_force is either force or not specified, + reboot_cpu is s[mp]#### with #### being the processor + to be used for rebooting. relax_domain_level= [KNL, SMP] Set scheduler's default relax_domain_level.
arch/arm/kernel/process.c +0 -10
@@ -175,16 +175,6 @@ void arch_cpu_idle(void)default_idle (); } -enum reboot_mode reboot_mode; - -static int __init reboot_setup (char *str) -{ -if ('s' == str[0 ]) - reboot_mode =REBOOT_WARM ; -return 1 ; -} -__setup ("reboot=" , reboot_setup); -void machine_shutdown (void ) {#ifdef CONFIG_SMP
arch/unicore32/kernel/process.c +0 -10
@@ -51,16 +51,6 @@ void arch_cpu_idle(void)local_irq_enable (); } -static enum reboot_mode reboot_mode; - -int __init reboot_setup (char *str) -{ -if ('s' == str[0 ]) - reboot_mode =REBOOT_WARM ; -return 1 ; -} -__setup ("reboot=" , reboot_setup); -void machine_halt (void ) {gpio_set_value (GPO_SOFT_OFF ,0 );
arch/x86/include/asm/emergency-restart.h +0 -12
@@ -1,18 +1,6 @@#ifndef _ASM_X86_EMERGENCY_RESTART_H#define _ASM_X86_EMERGENCY_RESTART_H -enum reboot_type { -BOOT_TRIPLE ='t' , -BOOT_KBD ='k' , -BOOT_BIOS ='b' , -BOOT_ACPI ='a' , -BOOT_EFI ='e' , -BOOT_CF9 ='p' , -BOOT_CF9_COND ='q' , -}; - -extern enum reboot_type reboot_type; -extern void machine_emergency_restart (void );#endif /* _ASM_X86_EMERGENCY_RESTART_H */
arch/x86/kernel/apic/x2apic_uv_x.c +1 -1
@@ -25,6 +25,7 @@#include <linux/kdebug.h> #include <linux/delay.h> #include <linux/crash_dump.h> +#include <linux/reboot.h> #include <asm/uv/uv_mmrs.h> #include <asm/uv/uv_hub.h>
@@ -36,7 +37,6 @@#include <asm/ipi.h> #include <asm/smp.h> #include <asm/x86_init.h> -#include <asm/emergency-restart.h> #include <asm/nmi.h> /* BMC sets a bit this MMR non-zero before sending an NMI */
arch/x86/kernel/reboot.c +3 -108
130 lines not on this page · raw message
include/linux/reboot.h +17 -0
@@ -15,6 +15,23 @@ enum reboot_mode {REBOOT_WARM , REBOOT_GPIO, }; +extern enum reboot_mode reboot_mode; + +enum reboot_type { +BOOT_TRIPLE ='t' , +BOOT_KBD ='k' , +BOOT_BIOS ='b' , +BOOT_ACPI ='a' , +BOOT_EFI ='e' , +BOOT_CF9 ='p' , +BOOT_CF9_COND ='q' , +}; +extern enum reboot_type reboot_type; + +extern int reboot_default; +extern int reboot_cpu; +extern int reboot_force; +extern int register_reboot_notifier (struct notifier_block *);extern int unregister_reboot_notifier (struct notifier_block *);
kernel/reboot.c +79 -1
95 lines not on this page · raw message
Signature · 1 line
1.8.2.1
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
include/linux/reboot.h enum reboot_mode { · line 19
Quoted 10 lines · Robin Holt
include/linux/reboot.h +5
-0@@ -15,6 +15,23 @@ enum reboot_mode { +extern enum reboot_type reboot_type; + +extern int reboot_default; +extern int reboot_cpu; +extern int reboot_force;
Okay, these are globals...
kernel/reboot.c EXPORT_SYMBOL(unregister_reboot_notifier); · line 91
Quoted 10 lines
kernel/reboot.c +1
-1@@ -87,7 +88,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier);static void migrate_to_reboot_cpu (void ) {/* The boot cpu is always logical cpu 0 */ -int reboot_cpu =0 ; +int reboot_cpu = reboot_cpu;
Hmm, are you sure about that?
kernel/reboot.c int orderly_poweroff(bool force) · line 352
Quoted 10 lines
kernel/reboot.c +6
-0@@ -343,3 +344,80 @@ int orderly_poweroff(bool force)return 0 ; }EXPORT_SYMBOL_GPL (orderly_poweroff); + +int reboot_default; +enum reboot_mode reboot_mode =REBOOT_COLD ; +int reboot_cpu; +enum reboot_type reboot_type =BOOT_ACPI ; +int reboot_force;
As you seem to want to reference these above, wouldn't it make sense to move them higher in the file?
kernel/reboot.c int orderly_poweroff(bool force) · line 385
Quoted 4 lines
kernel/reboot.c +4
-0+case 'c' : +case 'h' : + reboot_mode =REBOOT_COLD ; +break ;
I'm still not entirely convinced by making "hard" and "cold" mean the same thing, likewise "soft" and "warm". As I previously explained but everyone seems to have ignored, solely focusing on the 's' problem instead.
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Quoted 14 lines · Russell King - ARM Linux
include/linux/reboot.h enum reboot_mode { · line 19
Quoted 10 lines · Robin Holt
include/linux/reboot.h +5
-0@@ -15,6 +15,23 @@ enum reboot_mode { +extern enum reboot_type reboot_type; + +extern int reboot_default; +extern int reboot_cpu; +extern int reboot_force;Okay, these are globals...
Quoted 12 lines
kernel/reboot.c EXPORT_SYMBOL(unregister_reboot_notifier); · line 91
Quoted 10 lines
kernel/reboot.c +1
-1@@ -87,7 +88,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier);static void migrate_to_reboot_cpu (void ) {/* The boot cpu is always logical cpu 0 */ -int reboot_cpu =0 ; +int reboot_cpu = reboot_cpu;Hmm, are you sure about that?
Again, I am an idiot. I will fix this. Thank you.
Quoted 14 lines
kernel/reboot.c int orderly_poweroff(bool force) · line 352
Quoted 10 lines
kernel/reboot.c +6
-0@@ -343,3 +344,80 @@ int orderly_poweroff(bool force)return 0 ; }EXPORT_SYMBOL_GPL (orderly_poweroff); + +int reboot_default; +enum reboot_mode reboot_mode =REBOOT_COLD ; +int reboot_cpu; +enum reboot_type reboot_type =BOOT_ACPI ; +int reboot_force;As you seem to want to reference these above, wouldn't it make sense to move them higher in the file?
Quoted 9 lines
kernel/reboot.c int orderly_poweroff(bool force) · line 385
Quoted 4 lines
kernel/reboot.c +4
-0+case 'c' : +case 'h' : + reboot_mode =REBOOT_COLD ; +break ;I'm still not entirely convinced by making "hard" and "cold" mean the same thing, likewise "soft" and "warm". As I previously explained but everyone seems to have ignored, solely focusing on the 's' problem instead.
OK. I took your earlier comments to mean you would tolerate this patch as is. I will make the -v9 introduce REBOOT_HARD, REBOOT_SOFT and make their meaning consistent with what is there now.
Thanks,
Robin
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
In reply to Robin Holtkernel/reboot.c int orderly_poweroff(bool force) · line 408
Quoted 6 lines · Robin Holt
kernel/reboot.c +6
-0+case 's' : + reboot_mode =REBOOT_WARM ; +case 'h' : + reboot_mode =REBOOT_COLD ; +case 'g' : + reboot_mode =REBOOT_GPIO ;
Further to Ingo's comments, also note that the above is broken. Any of s,h,g will result in REBOOT_GPIO being set which is clearly wrong.
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Quoted 10 lines · Russell King - ARM Linux
kernel/reboot.c int orderly_poweroff(bool force) · line 408
Quoted 6 lines · Robin Holt
kernel/reboot.c +6
-0+case 's' : + reboot_mode =REBOOT_WARM ; +case 'h' : + reboot_mode =REBOOT_COLD ; +case 'g' : + reboot_mode =REBOOT_GPIO ;Further to Ingo's comments, also note that the above is broken. Any of s,h,g will result in
REBOOT_GPIObeing set which is clearly wrong.
I couldn't be more of an idiot. I will fix it in -v9.
Robin
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
In reply to Robin HoltQuoted 22 lines · On Tue, 7 May 2013 09:39:55 -0500 Robin Holt <[email protected]> wrote:
Merge together the unicore32, arm, and x86 reboot= command line parameter handling.
...
kernel/reboot.c +17
-0+static int __init reboot_setup (char *str) +{ +for (;;) { +/* +* Having anything passed on the command line via +* reboot= will cause us to disable DMI checking +* below. +*/ + reboot_default =0 ; + +switch (*str) { +#if defined(CONFIG_X86 ) || defined(CONFIG_X86_64 ) +case 'w' : + reboot_mode =REBOOT_WARM ; +break ; + +case 'c' :
kernel/reboot.c int orderly_poweroff(bool force) · line 393
Quoted 10 lines
kernel/reboot.c +10
-0+ reboot_mode =REBOOT_COLD ; +break ; + +#ifdef CONFIG_SMP +case 's' : +if (isdigit (*(str+1 ))) { + reboot_cpu = (int ) (*(str+1 ) -'0' ); +if (isdigit (*(str+2 ))) + reboot_cpu = reboot_cpu*10 + (int )(*(str+2 ) -'0' ); + }
Boy, that's some weird stuff.
What's wrong with doing
if (isdigit(str[1])) {
reboot_cpu = str[1] - '0';
if (isdigit(str[2]))
reboot_cpu = reboot_cpu * 10 +
str[2] - '0';
}?
But it's still nonsense - we should eliminate its you-have-less-than-101-CPUs restriction by using, you know, atoi().
Re: [PATCH -v8 11/11] Move arch/x86 reboot= handling to generic kernel.
Quoted 46 lines · Andrew Morton
Quoted 22 lines · On Tue, 7 May 2013 09:39:55 -0500 Robin Holt <[email protected]> wrote:
Merge together the unicore32, arm, and x86 reboot= command line parameter handling.
...
kernel/reboot.c +17
-0+static int __init reboot_setup (char *str) +{ +for (;;) { +/* +* Having anything passed on the command line via +* reboot= will cause us to disable DMI checking +* below. +*/ + reboot_default =0 ; + +switch (*str) { +#if defined(CONFIG_X86 ) || defined(CONFIG_X86_64 ) +case 'w' : + reboot_mode =REBOOT_WARM ; +break ; + +case 'c' :kernel/reboot.c int orderly_poweroff(bool force) · line 393
Quoted 10 lines
kernel/reboot.c +10
-0+ reboot_mode =REBOOT_COLD ; +break ; + +#ifdef CONFIG_SMP +case 's' : +if (isdigit (*(str+1 ))) { + reboot_cpu = (int ) (*(str+1 ) -'0' ); +if (isdigit (*(str+2 ))) + reboot_cpu = reboot_cpu*10 + (int )(*(str+2 ) -'0' ); + }Boy, that's some weird stuff.
What's wrong with doing
if (isdigit(str[1])) { reboot_cpu = str[1] - '0'; if (isdigit(str[2])) reboot_cpu = reboot_cpu * 10 + str[2] - '0'; }
Quoted 4 lines
?
But it's still nonsense - we should eliminate its you-have-less-than-101-CPUs restriction by using, you know,
atoi().
I had an earlier version which I must have dropped which handled the larger parsing, but I do like your suggestion of using atoi. I will submit a -v9 in a few hours.
Robin