From patchwork Fri Apr 15 02:42:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 8844481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D5EA09F3A0 for ; Fri, 15 Apr 2016 02:46:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1792220377 for ; Fri, 15 Apr 2016 02:46:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 398B620373 for ; Fri, 15 Apr 2016 02:46:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aqtkm-0007BX-RW; Fri, 15 Apr 2016 02:45:04 +0000 Received: from bh-25.webhostbox.net ([208.91.199.152]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aqtji-0006RG-3f for linux-arm-kernel@lists.infradead.org; Fri, 15 Apr 2016 02:44:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=References:In-Reply-To:Message-Id:Date:Subject: Cc:To:From; bh=SoOJTLk3N0q9IHn9uiCgZo/xJ5XoYFgUZfJNmNsJ2pM=; b=YlAj4fGhIot6Hu cGMLxceKukTvpgmMD7cdGu7Stu0S1CQUaqmj4iaMs87xDFZkcfWf/Xu6N5mgaczZjQc9jubYr5QMB 624EyBXQrvSloPdebnJ+6H3ERU5E3Vm88JbhIm7yE4oOzqZuKZ0gQywllTzaKA/CqdyM/c6hie1xa wmOUIyasT3aRP3nXSRGjnkm8wnUDDjkwxGsydIErxHPrzyBCJBcZ+faCSjXwVITOymUdPa0cjwmKw w5E4pCaUNKCZYN7uXsPHaCRlYxdJZCQ4+Soucjc/m5QPTbSJTwWgBQkxX3uRV0I7vcMPXhG4GpmwB iy/M1eKwtuVdY3AXIvBQ==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:32926 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1aqtiN-001AcY-W2; Fri, 15 Apr 2016 02:42:36 +0000 From: Guenter Roeck To: Russell King , Catalin Marinas Subject: [PATCH v2 2/6] ARM: xen: Register with kernel restart handler Date: Thu, 14 Apr 2016 19:42:33 -0700 Message-Id: <1460688157-6551-3-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460688157-6551-1-git-send-email-linux@roeck-us.net> References: <1460688157-6551-1-git-send-email-linux@roeck-us.net> 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 - lists.infradead.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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160414_194358_320196_3E1FEB53 X-CRM114-Status: GOOD ( 11.19 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wolfram Sang , linux-kernel@vger.kernel.org, Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, xen-devel@lists.xenproject.org, Guenter Roeck MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Wolfram Sang Reviewed-by: Stefano Stabellini Signed-off-by: Guenter Roeck --- v2: Rebased to v4.6-rc3, added Reviewed/by/Acked-by tags 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);