Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1569603 > unrolled thread
| Started by | Thierry Reding <thierry.reding@gmail.com> |
|---|---|
| First post | 2017-01-30 12:10 +0100 |
| Last post | 2017-01-30 12:10 +0100 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/6] ARM, arm64: Remove arm_pm_restart() Thierry Reding <thierry.reding@gmail.com> - 2017-01-30 12:10 +0100
[PATCH 2/6] ARM: xen: Register with kernel restart handler Thierry Reding <thierry.reding@gmail.com> - 2017-01-30 12:10 +0100
[PATCH 4/6] ARM: Register with kernel restart handler Thierry Reding <thierry.reding@gmail.com> - 2017-01-30 12:10 +0100
| From | Thierry Reding <thierry.reding@gmail.com> |
|---|---|
| Date | 2017-01-30 12:10 +0100 |
| Subject | [PATCH 0/6] ARM, arm64: Remove arm_pm_restart() |
| Message-ID | <t5i0q-3gH-7@gated-at.bofh.it> |
From: Thierry Reding <treding@nvidia.com> Hi everyone, This small series is preparatory work for a series that I'm working on which attempts to establish a formal framework for system restart and power off. Guenter has done a lot of good work in this area, but it never got merged. I think this set is a valuable addition to the kernel because it converts all odd providers to the established mechanism for restart. Since this is stretched across both 32-bit and 64-bit ARM, as well as PSCI, and given the SoC/board level of functionality, I think it might make sense to take this through the ARM SoC tree in order to simplify the interdependencies. But it should also be possible to take patches 1-4 via their respective trees this cycle and patches 5-6 through the ARM and arm64 trees for the next cycle, if that's preferred. Thanks, Thierry Guenter Roeck (6): ARM: prima2: Register with kernel restart handler ARM: xen: Register with kernel restart handler drivers: firmware: psci: Register with kernel restart handler ARM: Register with kernel restart handler ARM64: Remove arm_pm_restart() ARM: Remove arm_pm_restart() arch/arm/include/asm/system_misc.h | 1 - arch/arm/kernel/reboot.c | 6 +----- arch/arm/kernel/setup.c | 20 ++++++++++++++++++-- arch/arm/mach-prima2/rstc.c | 11 +++++++++-- arch/arm/xen/enlighten.c | 13 +++++++++++-- arch/arm64/include/asm/system_misc.h | 2 -- arch/arm64/kernel/process.c | 7 +------ drivers/firmware/psci.c | 11 +++++++++-- 8 files changed, 49 insertions(+), 22 deletions(-) -- 2.11.0
[toc] | [next] | [standalone]
| From | Thierry Reding <thierry.reding@gmail.com> |
|---|---|
| Date | 2017-01-30 12:10 +0100 |
| Subject | [PATCH 2/6] ARM: xen: Register with kernel restart handler |
| Message-ID | <t5i0s-3gH-55@gated-at.bofh.it> |
| In reply to | #1569603 |
From: Guenter Roeck <linux@roeck-us.net>
Register with kernel restart handler instead of setting arm_pm_restart
directly.
Select a high priority of 192 to ensure that default restart handlers
are replaced if Xen is running.
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
arch/arm/xen/enlighten.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 11d9f2898b16..85d678e1d826 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -29,6 +29,7 @@
#include <linux/cpu.h>
#include <linux/console.h>
#include <linux/pvclock_gtod.h>
+#include <linux/reboot.h>
#include <linux/time64.h>
#include <linux/timekeeping.h>
#include <linux/timekeeper_internal.h>
@@ -191,14 +192,22 @@ static int xen_dying_cpu(unsigned int cpu)
return 0;
}
-static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
+static int xen_restart(struct notifier_block *nb, unsigned long action,
+ void *data)
{
struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
int rc;
rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
BUG_ON(rc);
+
+ return NOTIFY_DONE;
}
+static struct notifier_block xen_restart_nb = {
+ .notifier_call = xen_restart,
+ .priority = 192,
+};
+
static void xen_power_off(void)
{
struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
@@ -423,7 +432,7 @@ static int __init xen_pm_init(void)
return -ENODEV;
pm_power_off = xen_power_off;
- arm_pm_restart = xen_restart;
+ register_restart_handler(&xen_restart_nb);
if (!xen_initial_domain()) {
struct timespec64 ts;
xen_read_wallclock(&ts);
--
2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Thierry Reding <thierry.reding@gmail.com> |
|---|---|
| Date | 2017-01-30 12:10 +0100 |
| Subject | [PATCH 4/6] ARM: Register with kernel restart handler |
| Message-ID | <t5i0s-3gH-57@gated-at.bofh.it> |
| In reply to | #1569603 |
From: Guenter Roeck <linux@roeck-us.net>
By making use of the kernel restart handler, board specific restart
handlers can be prioritized amongst available mechanisms for a particular
board or system.
Select the default priority of 128 to indicate that the restart callback
in the machine description is the default restart mechanism.
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
arch/arm/kernel/setup.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index f4e54503afa9..cc4f9564f4e3 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1058,6 +1058,20 @@ void __init hyp_mode_check(void)
#endif
}
+static void (*__arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
+
+static int arm_restart(struct notifier_block *nb, unsigned long action,
+ void *data)
+{
+ __arm_pm_restart(action, data);
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block arm_restart_nb = {
+ .notifier_call = arm_restart,
+ .priority = 128,
+};
+
void __init setup_arch(char **cmdline_p)
{
const struct machine_desc *mdesc;
@@ -1107,8 +1121,10 @@ void __init setup_arch(char **cmdline_p)
paging_init(mdesc);
request_standard_resources(mdesc);
- if (mdesc->restart)
- arm_pm_restart = mdesc->restart;
+ if (mdesc->restart) {
+ __arm_pm_restart = mdesc->restart;
+ register_restart_handler(&arm_restart_nb);
+ }
unflatten_device_tree();
--
2.11.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web