From patchwork Wed Apr 24 19:28:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 2485931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id ED93DDF25A for ; Wed, 24 Apr 2013 19:44:42 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UV5cL-0000zh-BU; Wed, 24 Apr 2013 19:44:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UV5cI-0001ws-Ji; Wed, 24 Apr 2013 19:44:34 +0000 Received: from smtp02.citrix.com ([66.165.176.63]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UV5cD-0001vH-RY for linux-arm-kernel@lists.infradead.org; Wed, 24 Apr 2013 19:44:30 +0000 X-IronPort-AV: E=Sophos;i="4.87,545,1363132800"; d="scan'208";a="20369884" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/AES128-SHA; 24 Apr 2013 19:44:27 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.2.342.3; Wed, 24 Apr 2013 15:44:26 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1UV5Mk-0008BJ-B0; Wed, 24 Apr 2013 20:28:30 +0100 From: Stefano Stabellini To: Subject: [PATCH v4 7/7] mach-virt: support Xen hypercalls for shutdown and reboot Date: Wed, 24 Apr 2013 20:28:15 +0100 Message-ID: <1366831695-13214-7-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130424_154430_090816_F6602CCD X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [66.165.176.63 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Ian.Campbell@citrix.com, arnd@arndb.de, konrad.wilk@oracle.com, Marc Zyngier , Stefano Stabellini , will.deacon@arm.com, linux-kernel@vger.kernel.org, rob.herring@calxeda.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Signed-off-by: Stefano Stabellini CC: Marc Zyngier CC: will.deacon@arm.com CC: arnd@arndb.de CC: rob.herring@calxeda.com --- arch/arm/mach-virt/virt.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-virt/virt.c b/arch/arm/mach-virt/virt.c index 528c05e..ba14321 100644 --- a/arch/arm/mach-virt/virt.c +++ b/arch/arm/mach-virt/virt.c @@ -23,13 +23,44 @@ #include #include +#include +#include + #include #include #include +#include + +static void virt_restart(char str, const char *cmd) +{ +#ifdef CONFIG_XEN + if (xen_domain()) { + struct sched_shutdown r = { .reason = SHUTDOWN_reboot }; + int rc; + rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); + if (rc) + BUG(); + } +#endif +} + +static void virt_power_off(void) +{ +#ifdef CONFIG_XEN + if (xen_domain()) { + struct sched_shutdown r = { .reason = SHUTDOWN_poweroff }; + int rc; + rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); + if (rc) + BUG(); + } +#endif +} static void __init virt_init(void) { of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + pm_power_off = virt_power_off; } static void __init virt_timer_init(void) @@ -52,4 +83,5 @@ DT_MACHINE_START(VIRT, "Dummy Virtual Machine") .init_machine = virt_init, .smp = smp_ops(virt_smp_ops), .dt_compat = virt_dt_match, + .restart = virt_restart, MACHINE_END