aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-03-24 16:48:29 -0400
committerAvi Kivity <avi@redhat.com>2010-05-17 05:17:09 -0400
commit71fbfd5f38f73515f1516a68fbe04dba198b70f0 (patch)
tree653626126cef565890652f83f4eba7f376642709 /arch/powerpc/kvm
parentca7f4203b9b66e12d0d9968ff7dfe781f3a9695a (diff)
KVM: Add support for enabling capabilities per-vcpu
Some times we don't want all capabilities to be available to all our vcpus. One example for that is the OSI interface, implemented in the next patch. In order to have a generic mechanism in how to enable capabilities individually, this patch introduces a new ioctl that can be used for this purpose. That way features we don't want in all guests or userspace configurations can just not be enabled and we're good. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r--arch/powerpc/kvm/powerpc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 0bb6a7e826d..646bfd256e5 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -150,6 +150,7 @@ int kvm_dev_ioctl_check_extension(long ext)
150 case KVM_CAP_PPC_SEGSTATE: 150 case KVM_CAP_PPC_SEGSTATE:
151 case KVM_CAP_PPC_PAIRED_SINGLES: 151 case KVM_CAP_PPC_PAIRED_SINGLES:
152 case KVM_CAP_PPC_UNSET_IRQ: 152 case KVM_CAP_PPC_UNSET_IRQ:
153 case KVM_CAP_ENABLE_CAP:
153 r = 1; 154 r = 1;
154 break; 155 break;
155 case KVM_CAP_COALESCED_MMIO: 156 case KVM_CAP_COALESCED_MMIO:
@@ -465,6 +466,23 @@ int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
465 return 0; 466 return 0;
466} 467}
467 468
469static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
470 struct kvm_enable_cap *cap)
471{
472 int r;
473
474 if (cap->flags)
475 return -EINVAL;
476
477 switch (cap->cap) {
478 default:
479 r = -EINVAL;
480 break;
481 }
482
483 return r;
484}
485
468int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, 486int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
469 struct kvm_mp_state *mp_state) 487 struct kvm_mp_state *mp_state)
470{ 488{
@@ -493,6 +511,15 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
493 r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); 511 r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
494 break; 512 break;
495 } 513 }
514 case KVM_ENABLE_CAP:
515 {
516 struct kvm_enable_cap cap;
517 r = -EFAULT;
518 if (copy_from_user(&cap, argp, sizeof(cap)))
519 goto out;
520 r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap);
521 break;
522 }
496 default: 523 default:
497 r = -EINVAL; 524 r = -EINVAL;
498 } 525 }