public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Stuart Yoder <stuart.yoder@freescale.com>
To: <agraf@suse.de>, <kvm-ppc@vger.kernel.org>, <kvm@vger.kernel.org>
Subject: [PATCH v12 4/8] KVM: PPC: Add support for ePAPR idle hcall in host kernel
Date: Tue, 3 Jul 2012 10:48:52 -0500	[thread overview]
Message-ID: <1341330536-10080-5-git-send-email-stuart.yoder@freescale.com> (raw)
In-Reply-To: <1341330536-10080-1-git-send-email-stuart.yoder@freescale.com>

From: Liu Yu-B13201 <Yu.Liu@freescale.com>

And add a new flag definition in kvm_ppc_pvinfo to indicate
whether the host supports the EV_IDLE hcall.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
[stuart.yoder@freescale.com: cleanup,fixes for conditions allowing idle]
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
---
v12: use EV_HCALL_TOKEN macro

 Documentation/virtual/kvm/api.txt |    7 +++++--
 arch/powerpc/include/asm/Kbuild   |    1 +
 arch/powerpc/kvm/powerpc.c        |   10 ++++++++--
 include/linux/kvm.h               |    2 ++
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 310fe50..920c3c4 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1190,12 +1190,15 @@ struct kvm_ppc_pvinfo {
 This ioctl fetches PV specific information that need to be passed to the guest
 using the device tree or other means from vm context.
 
-For now the only implemented piece of information distributed here is an array
-of 4 instructions that make up a hypercall.
+The hcall array defines 4 instructions that make up a hypercall.
 
 If any additional field gets added to this structure later on, a bit for that
 additional piece of information will be set in the flags bitmap.
 
+The flags bitmap is defined as:
+
+   /* the host supports the ePAPR idle hcall
+   #define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)
 
 4.48 KVM_ASSIGN_PCI_DEVICE
 
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/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 30cf01c..1a4db32 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -38,8 +38,7 @@
 
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
 {
-	return !(v->arch.shared->msr & MSR_WE) ||
-	       !!(v->arch.pending_exceptions) ||
+	return !!(v->arch.pending_exceptions) ||
 	       v->requests;
 }
 
@@ -86,6 +85,11 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
 
 		/* Second return value is in r4 */
 		break;
+	case EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, EV_IDLE):
+		r = EV_SUCCESS;
+		kvm_vcpu_block(vcpu);
+		clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
+		break;
 	default:
 		r = EV_UNIMPLEMENTED;
 		break;
@@ -767,6 +771,8 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
 	pvinfo->hcall[3] = inst_nop;
 #endif
 
+	pvinfo->flags = KVM_PPC_PVINFO_FLAGS_EV_IDLE;
+
 	return 0;
 }
 
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 2ce09aa..c03e59e 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -473,6 +473,8 @@ struct kvm_ppc_smmu_info {
 	struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
 };
 
+#define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)
+
 #define KVMIO 0xAE
 
 /* machine type bits, to be used as argument to KVM_CREATE_VM */
-- 
1.7.3.4



  parent reply	other threads:[~2012-07-03 15:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03 15:48 [PATCH v12 0/8] KVM: PPC: Add ePAPR idle hcall support Stuart Yoder
2012-07-03 15:48 ` [PATCH v12 1/8] PPC: epapr: create define for return code value of success Stuart Yoder
2012-07-03 15:48 ` [PATCH v12 2/8] KVM: PPC: use definitions in epapr header for hcalls Stuart Yoder
2012-07-03 15:48 ` [PATCH v12 3/8] KVM: PPC: add pvinfo for hcall opcodes on e500mc/e5500 Stuart Yoder
2012-07-03 15:48 ` Stuart Yoder [this message]
2012-07-03 19:33   ` [PATCH v12 4/8] KVM: PPC: Add support for ePAPR idle hcall in host kernel Alexander Graf
2012-07-03 19:40     ` Yoder Stuart-B08248
2012-07-03 15:48 ` [PATCH v12 5/8] KVM: PPC: ev_idle hcall support for e500 guests Stuart Yoder
2012-07-03 15:48 ` [PATCH v12 6/8] PPC: select EPAPR_PARAVIRT for all users of epapr hcalls Stuart Yoder
2012-07-03 15:48 ` [PATCH v12 7/8] powerpc/fsl-soc: use CONFIG_EPAPR_PARAVIRT for hcalls Stuart Yoder
2012-07-03 15:48 ` [PATCH v12 8/8] PPC: Don't use hardcoded opcode for ePAPR hcall invocation Stuart Yoder
2012-07-03 19:41 ` [PATCH v12 0/8] KVM: PPC: Add ePAPR idle hcall support Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341330536-10080-5-git-send-email-stuart.yoder@freescale.com \
    --to=stuart.yoder@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox