aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2014-07-14 12:55:19 -0400
committerAlexander Graf <agraf@suse.de>2014-07-28 09:23:18 -0400
commit7a58777a33128b28379851b94070934b17ed9176 (patch)
tree86cfd9fe76650f3a940ead2ede3b2ac66c1f5c23
parent92b591a4c46b103ebd3fc0d03a084e1efd331253 (diff)
KVM: PPC: Book3S: Provide different CAPs based on HV or PR mode
With Book3S KVM we can create both PR and HV VMs in parallel on the same machine. That gives us new challenges on the CAPs we return - both have different capabilities. When we get asked about CAPs on the kvm fd, there's nothing we can do. We can try to be smart and assume we're running HV if HV is available, PR otherwise. However with the newly added VM CHECK_EXTENSION we can now ask for capabilities directly on a VM which knows whether it's PR or HV. With this patch I can successfully expose KVM PVINFO data to user space in the PR case, fixing magic page mapping for PAPR guests. Signed-off-by: Alexander Graf <agraf@suse.de> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/powerpc/kvm/powerpc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index d870bacc2f75..eaa57da7711b 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -394,11 +394,17 @@ void kvm_arch_sync_events(struct kvm *kvm)
394int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) 394int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
395{ 395{
396 int r; 396 int r;
397 /* FIXME!! 397 /* Assume we're using HV mode when the HV module is loaded */
398 * Should some of this be vm ioctl ? is it possible now ?
399 */
400 int hv_enabled = kvmppc_hv_ops ? 1 : 0; 398 int hv_enabled = kvmppc_hv_ops ? 1 : 0;
401 399
400 if (kvm) {
401 /*
402 * Hooray - we know which VM type we're running on. Depend on
403 * that rather than the guess above.
404 */
405 hv_enabled = is_kvmppc_hv_enabled(kvm);
406 }
407
402 switch (ext) { 408 switch (ext) {
403#ifdef CONFIG_BOOKE 409#ifdef CONFIG_BOOKE
404 case KVM_CAP_PPC_BOOKE_SREGS: 410 case KVM_CAP_PPC_BOOKE_SREGS: