From patchwork Tue Feb 21 04:46:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Yu-B13201 X-Patchwork-Id: 142243 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2644AB6FA2 for ; Tue, 21 Feb 2012 15:51:16 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752629Ab2BUEvO (ORCPT ); Mon, 20 Feb 2012 23:51:14 -0500 Received: from am1ehsobe001.messaging.microsoft.com ([213.199.154.204]:35393 "EHLO AM1EHSOBE003.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752584Ab2BUEvN (ORCPT ); Mon, 20 Feb 2012 23:51:13 -0500 Received: from mail93-am1-R.bigfish.com (10.3.201.253) by AM1EHSOBE003.bigfish.com (10.3.204.23) with Microsoft SMTP Server id 14.1.225.23; Tue, 21 Feb 2012 04:51:07 +0000 Received: from mail93-am1 (localhost [127.0.0.1]) by mail93-am1-R.bigfish.com (Postfix) with ESMTP id A95E4220325; Tue, 21 Feb 2012 04:51:07 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail93-am1 (localhost.localdomain [127.0.0.1]) by mail93-am1 (MessageSwitch) id 1329799866259806_5114; Tue, 21 Feb 2012 04:51:06 +0000 (UTC) Received: from AM1EHSMHS002.bigfish.com (unknown [10.3.201.250]) by mail93-am1.bigfish.com (Postfix) with ESMTP id 1CDE620047; Tue, 21 Feb 2012 04:51:06 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS002.bigfish.com (10.3.207.102) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 21 Feb 2012 04:51:05 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.355.3; Mon, 20 Feb 2012 22:51:07 -0600 Received: from localhost (rock.ap.freescale.net [10.193.20.106]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id q1L4p5GM004297; Mon, 20 Feb 2012 22:51:06 -0600 (CST) From: Liu Yu To: , , CC: , , Liu Yu Subject: [PATCH v5 2/4] KVM: PPC: epapr: Add idle hcall support for host Date: Tue, 21 Feb 2012 12:46:11 +0800 Message-ID: <1329799573-8820-2-git-send-email-yu.liu@freescale.com> X-Mailer: git-send-email 1.6.4 In-Reply-To: <1329799573-8820-1-git-send-email-yu.liu@freescale.com> References: <1329799573-8820-1-git-send-email-yu.liu@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org And add a new flag definition in kvm_ppc_pvinfo to indicate whether host support EV_IDLE hcall. Signed-off-by: Liu Yu --- v5: 1. remove the ifdef 2. add epapr_hcalls.h into headers install list arch/powerpc/include/asm/Kbuild | 1 + arch/powerpc/include/asm/kvm_para.h | 14 ++++++++++++-- arch/powerpc/kvm/powerpc.c | 6 ++++++ include/linux/kvm.h | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild index 7e313f1..13d6b7b 100644 --- a/arch/powerpc/include/asm/Kbuild +++ b/arch/powerpc/include/asm/Kbuild @@ -34,5 +34,6 @@ header-y += termios.h header-y += types.h header-y += ucontext.h header-y += unistd.h +header-y += epapr_hcalls.h generic-y += rwsem.h diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h index 7b754e7..81a34c9 100644 --- a/arch/powerpc/include/asm/kvm_para.h +++ b/arch/powerpc/include/asm/kvm_para.h @@ -75,9 +75,19 @@ struct kvm_vcpu_arch_shared { }; #define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */ -#define HC_VENDOR_KVM (42 << 16) + +#include + +/* ePAPR Hypercall Vendor ID */ +#define HC_VENDOR_EPAPR (EV_EPAPR_VENDOR_ID << 16) +#define HC_VENDOR_KVM (EV_KVM_VENDOR_ID << 16) + +/* ePAPR Hypercall Token */ +#define HC_EV_IDLE EV_IDLE + +/* ePAPR Hypercall Return Codes */ #define HC_EV_SUCCESS 0 -#define HC_EV_UNIMPLEMENTED 12 +#define HC_EV_UNIMPLEMENTED EV_UNIMPLEMENTED #define KVM_FEATURE_MAGIC_PAGE 1 diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 0e21d15..7098840 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) /* Second return value is in r4 */ break; + case HC_VENDOR_EPAPR | HC_EV_IDLE: + r = HC_EV_SUCCESS; + kvm_vcpu_block(vcpu); + break; default: r = HC_EV_UNIMPLEMENTED; break; @@ -746,6 +750,8 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo) pvinfo->hcall[2] = inst_sc; pvinfo->hcall[3] = inst_nop; + pvinfo->flags = KVM_PPC_PVINFO_FLAGS_EV_IDLE; + return 0; } diff --git a/include/linux/kvm.h b/include/linux/kvm.h index acbe429..6b2c70e 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -449,6 +449,8 @@ struct kvm_ppc_pvinfo { __u8 pad[108]; }; +#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) + #define KVMIO 0xAE /* machine type bits, to be used as argument to KVM_CREATE_VM */