From patchwork Mon Jul 15 11:11:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 2827414 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B369DC0AB2 for ; Mon, 15 Jul 2013 11:18:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85BCE2015C for ; Mon, 15 Jul 2013 11:18:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BBCF20155 for ; Mon, 15 Jul 2013 11:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755631Ab3GOLSq (ORCPT ); Mon, 15 Jul 2013 07:18:46 -0400 Received: from va3ehsobe004.messaging.microsoft.com ([216.32.180.14]:57077 "EHLO va3outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755422Ab3GOLSp (ORCPT ); Mon, 15 Jul 2013 07:18:45 -0400 Received: from mail47-va3-R.bigfish.com (10.7.14.244) by VA3EHSOBE013.bigfish.com (10.7.40.63) with Microsoft SMTP Server id 14.1.225.22; Mon, 15 Jul 2013 11:18:44 +0000 Received: from mail47-va3 (localhost [127.0.0.1]) by mail47-va3-R.bigfish.com (Postfix) with ESMTP id ACB6E2C01D3; Mon, 15 Jul 2013 11:18:44 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 6 X-BigFish: VS6(z37d5kzzz1f42h1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6h1082kzz8275bhz2dh2a8h668h839he5bhf0ah107ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dfeh1dffh1e1dh1e23h1155h) Received: from mail47-va3 (localhost.localdomain [127.0.0.1]) by mail47-va3 (MessageSwitch) id 1373887121988097_8598; Mon, 15 Jul 2013 11:18:41 +0000 (UTC) Received: from VA3EHSMHS032.bigfish.com (unknown [10.7.14.232]) by mail47-va3.bigfish.com (Postfix) with ESMTP id EA355A0066; Mon, 15 Jul 2013 11:18:41 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS032.bigfish.com (10.7.99.42) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 15 Jul 2013 11:18:42 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.3.136.1; Mon, 15 Jul 2013 11:20:57 +0000 Received: from freescale.com ([10.232.15.72]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with SMTP id r6FBIa2h020739; Mon, 15 Jul 2013 04:18:37 -0700 Received: by freescale.com (sSMTP sendmail emulation); Mon, 15 Jul 2013 16:41:48 +0530 From: Bharat Bhushan To: , , , , CC: Bharat Bhushan , Bharat Bhushan Subject: [PATCH 5/5] powerpc: using reset hcall when kvm,has-reset Date: Mon, 15 Jul 2013 16:41:19 +0530 Message-ID: <1373886679-19581-6-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1373886679-19581-1-git-send-email-Bharat.Bhushan@freescale.com> References: <1373886679-19581-1-git-send-email-Bharat.Bhushan@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Detect the availability of the reset hcalls by looking at kvm,has-reset property on the /hypervisor node in the device tree passed to the VM and patches the reset mechanism to use reset hcall. This patch uses the reser hcall when kvm,has-reset is there in Signed-off-by: Bharat Bhushan --- arch/powerpc/kernel/epapr_paravirt.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c index d44a571..651d701 100644 --- a/arch/powerpc/kernel/epapr_paravirt.c +++ b/arch/powerpc/kernel/epapr_paravirt.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64) extern void epapr_ev_idle(void); @@ -30,6 +32,14 @@ extern u32 epapr_ev_idle_start[]; bool epapr_paravirt_enabled; +void epapr_hypercall_reset(char *cmd) +{ + long ret; + ret = kvm_hypercall0(KVM_HC_VM_RESET); + printk("error: system reset returned with error %ld\n", ret); + BUG(); +} + static int __init epapr_paravirt_init(void) { struct device_node *hyper_node; @@ -58,6 +68,8 @@ static int __init epapr_paravirt_init(void) if (of_get_property(hyper_node, "has-idle", NULL)) ppc_md.power_save = epapr_ev_idle; #endif + if (of_get_property(hyper_node, "kvm,has-reset", NULL)) + ppc_md.restart = epapr_hypercall_reset; epapr_paravirt_enabled = true;