From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758692AbcDHSUN (ORCPT ); Fri, 8 Apr 2016 14:20:13 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:35157 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758205AbcDHSUK (ORCPT ); Fri, 8 Apr 2016 14:20:10 -0400 Date: Fri, 8 Apr 2016 11:20:11 -0700 From: Guenter Roeck To: Konrad Rzeszutek Wilk Cc: Russell King , Catalin Marinas , Stefano Stabellini , Wolfram Sang , linux-kernel@vger.kernel.org, Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, xen-devel@lists.xenproject.org Subject: Re: [Xen-devel] [PATCH 2/6] ARM: xen: Register with kernel restart handler Message-ID: <20160408182011.GA7083@roeck-us.net> References: <1460120039-2497-1-git-send-email-linux@roeck-us.net> <1460120039-2497-3-git-send-email-linux@roeck-us.net> <20160408152257.GJ15411@char.us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160408152257.GJ15411@char.us.oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 08, 2016 at 11:22:57AM -0400, Konrad Rzeszutek Wilk wrote: > On Fri, Apr 08, 2016 at 05:53:55AM -0700, Guenter Roeck wrote: > > Register with kernel restart handler instead of setting arm_pm_restart > > directly. > > > > Select a high priority of 192 to ensure that default restart handlers > > Is there some macro for that magic value? > No, only guidelines in kernel/reboot.c. Guenter > > are replaced if Xen is running. > > > > Signed-off-by: Guenter Roeck > > --- > > 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 75cd7345c654..76a1d12fd27e 100644 > > --- a/arch/arm/xen/enlighten.c > > +++ b/arch/arm/xen/enlighten.c > > @@ -27,6 +27,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -193,14 +194,22 @@ after_register_vcpu_info: > > put_cpu(); > > } > > > > -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 }; > > @@ -370,7 +379,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.5.0 > > > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xen.org > > http://lists.xen.org/xen-devel From mboxrd@z Thu Jan 1 00:00:00 1970 From: linux@roeck-us.net (Guenter Roeck) Date: Fri, 8 Apr 2016 11:20:11 -0700 Subject: [Xen-devel] [PATCH 2/6] ARM: xen: Register with kernel restart handler In-Reply-To: <20160408152257.GJ15411@char.us.oracle.com> References: <1460120039-2497-1-git-send-email-linux@roeck-us.net> <1460120039-2497-3-git-send-email-linux@roeck-us.net> <20160408152257.GJ15411@char.us.oracle.com> Message-ID: <20160408182011.GA7083@roeck-us.net> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Apr 08, 2016 at 11:22:57AM -0400, Konrad Rzeszutek Wilk wrote: > On Fri, Apr 08, 2016 at 05:53:55AM -0700, Guenter Roeck wrote: > > Register with kernel restart handler instead of setting arm_pm_restart > > directly. > > > > Select a high priority of 192 to ensure that default restart handlers > > Is there some macro for that magic value? > No, only guidelines in kernel/reboot.c. Guenter > > are replaced if Xen is running. > > > > Signed-off-by: Guenter Roeck > > --- > > 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 75cd7345c654..76a1d12fd27e 100644 > > --- a/arch/arm/xen/enlighten.c > > +++ b/arch/arm/xen/enlighten.c > > @@ -27,6 +27,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -193,14 +194,22 @@ after_register_vcpu_info: > > put_cpu(); > > } > > > > -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 }; > > @@ -370,7 +379,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.5.0 > > > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel at lists.xen.org > > http://lists.xen.org/xen-devel