diff options
author | Liu Yu-B13201 <Yu.Liu@freescale.com> | 2012-07-03 01:48:52 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2012-10-05 17:38:37 -0400 |
commit | 9202e07636f0c4858ba6c30773a3f160b2b5659a (patch) | |
tree | 8dc71ab432097c3cfbad47157d66788e02d1f219 | |
parent | 784bafac79e7646e56f40998a6dde0e1ed5595f8 (diff) |
KVM: PPC: Add support for ePAPR idle hcall in host kernel
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>
[agraf: fix typo]
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | Documentation/virtual/kvm/api.txt | 7 | ||||
-rw-r--r-- | arch/powerpc/include/asm/Kbuild | 1 | ||||
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 10 | ||||
-rw-r--r-- | 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 f6ec3a92e621..170afb1fbc2e 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
@@ -1194,12 +1194,15 @@ struct kvm_ppc_pvinfo { | |||
1194 | This ioctl fetches PV specific information that need to be passed to the guest | 1194 | This ioctl fetches PV specific information that need to be passed to the guest |
1195 | using the device tree or other means from vm context. | 1195 | using the device tree or other means from vm context. |
1196 | 1196 | ||
1197 | For now the only implemented piece of information distributed here is an array | 1197 | The hcall array defines 4 instructions that make up a hypercall. |
1198 | of 4 instructions that make up a hypercall. | ||
1199 | 1198 | ||
1200 | If any additional field gets added to this structure later on, a bit for that | 1199 | If any additional field gets added to this structure later on, a bit for that |
1201 | additional piece of information will be set in the flags bitmap. | 1200 | additional piece of information will be set in the flags bitmap. |
1202 | 1201 | ||
1202 | The flags bitmap is defined as: | ||
1203 | |||
1204 | /* the host supports the ePAPR idle hcall | ||
1205 | #define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) | ||
1203 | 1206 | ||
1204 | 4.48 KVM_ASSIGN_PCI_DEVICE | 1207 | 4.48 KVM_ASSIGN_PCI_DEVICE |
1205 | 1208 | ||
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild index 7e313f1ed183..13d6b7bf3b69 100644 --- a/arch/powerpc/include/asm/Kbuild +++ b/arch/powerpc/include/asm/Kbuild | |||
@@ -34,5 +34,6 @@ header-y += termios.h | |||
34 | header-y += types.h | 34 | header-y += types.h |
35 | header-y += ucontext.h | 35 | header-y += ucontext.h |
36 | header-y += unistd.h | 36 | header-y += unistd.h |
37 | header-y += epapr_hcalls.h | ||
37 | 38 | ||
38 | generic-y += rwsem.h | 39 | generic-y += rwsem.h |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index a478e662b2bc..dbf56e173c25 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -38,8 +38,7 @@ | |||
38 | 38 | ||
39 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) | 39 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) |
40 | { | 40 | { |
41 | return !(v->arch.shared->msr & MSR_WE) || | 41 | return !!(v->arch.pending_exceptions) || |
42 | !!(v->arch.pending_exceptions) || | ||
43 | v->requests; | 42 | v->requests; |
44 | } | 43 | } |
45 | 44 | ||
@@ -86,6 +85,11 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) | |||
86 | 85 | ||
87 | /* Second return value is in r4 */ | 86 | /* Second return value is in r4 */ |
88 | break; | 87 | break; |
88 | case EV_HCALL_TOKEN(EV_IDLE): | ||
89 | r = EV_SUCCESS; | ||
90 | kvm_vcpu_block(vcpu); | ||
91 | clear_bit(KVM_REQ_UNHALT, &vcpu->requests); | ||
92 | break; | ||
89 | default: | 93 | default: |
90 | r = EV_UNIMPLEMENTED; | 94 | r = EV_UNIMPLEMENTED; |
91 | break; | 95 | break; |
@@ -779,6 +783,8 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo) | |||
779 | pvinfo->hcall[3] = inst_nop; | 783 | pvinfo->hcall[3] = inst_nop; |
780 | #endif | 784 | #endif |
781 | 785 | ||
786 | pvinfo->flags = KVM_PPC_PVINFO_FLAGS_EV_IDLE; | ||
787 | |||
782 | return 0; | 788 | return 0; |
783 | } | 789 | } |
784 | 790 | ||
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 0a6d6ba44c85..4cb3761bebae 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -477,6 +477,8 @@ struct kvm_ppc_smmu_info { | |||
477 | struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; | 477 | struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; |
478 | }; | 478 | }; |
479 | 479 | ||
480 | #define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) | ||
481 | |||
480 | #define KVMIO 0xAE | 482 | #define KVMIO 0xAE |
481 | 483 | ||
482 | /* machine type bits, to be used as argument to KVM_CREATE_VM */ | 484 | /* machine type bits, to be used as argument to KVM_CREATE_VM */ |