aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
authorCarsten Otte <cotte@de.ibm.com>2012-01-04 04:25:20 -0500
committerAvi Kivity <avi@redhat.com>2012-03-05 07:52:18 -0500
commite08b96371625aaa84cb03f51acc4c8e0be27403a (patch)
treed0b140e8558c6145e1a3183809c7797be443bd68 /virt/kvm/kvm_main.c
parenta138fe7535c0ec778465c7b54b1aaaf4cfd885b7 (diff)
KVM: s390: add parameter for KVM_CREATE_VM
This patch introduces a new config option for user controlled kernel virtual machines. It introduces a parameter to KVM_CREATE_VM that allows to set bits that alter the capabilities of the newly created virtual machine. The parameter is passed to kvm_arch_init_vm for all architectures. The only valid modifier bit for now is KVM_VM_S390_UCONTROL. This requires CAP_SYS_ADMIN privileges and creates a user controlled virtual machine on s390 architectures. Signed-off-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a91f980077d8..32e3b048a6cf 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -449,7 +449,7 @@ static void kvm_init_memslots_id(struct kvm *kvm)
449 slots->id_to_index[i] = slots->memslots[i].id = i; 449 slots->id_to_index[i] = slots->memslots[i].id = i;
450} 450}
451 451
452static struct kvm *kvm_create_vm(void) 452static struct kvm *kvm_create_vm(unsigned long type)
453{ 453{
454 int r, i; 454 int r, i;
455 struct kvm *kvm = kvm_arch_alloc_vm(); 455 struct kvm *kvm = kvm_arch_alloc_vm();
@@ -457,7 +457,7 @@ static struct kvm *kvm_create_vm(void)
457 if (!kvm) 457 if (!kvm)
458 return ERR_PTR(-ENOMEM); 458 return ERR_PTR(-ENOMEM);
459 459
460 r = kvm_arch_init_vm(kvm); 460 r = kvm_arch_init_vm(kvm, type);
461 if (r) 461 if (r)
462 goto out_err_nodisable; 462 goto out_err_nodisable;
463 463
@@ -2198,12 +2198,12 @@ static struct file_operations kvm_vm_fops = {
2198 .llseek = noop_llseek, 2198 .llseek = noop_llseek,
2199}; 2199};
2200 2200
2201static int kvm_dev_ioctl_create_vm(void) 2201static int kvm_dev_ioctl_create_vm(unsigned long type)
2202{ 2202{
2203 int r; 2203 int r;
2204 struct kvm *kvm; 2204 struct kvm *kvm;
2205 2205
2206 kvm = kvm_create_vm(); 2206 kvm = kvm_create_vm(type);
2207 if (IS_ERR(kvm)) 2207 if (IS_ERR(kvm))
2208 return PTR_ERR(kvm); 2208 return PTR_ERR(kvm);
2209#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET 2209#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
@@ -2254,10 +2254,7 @@ static long kvm_dev_ioctl(struct file *filp,
2254 r = KVM_API_VERSION; 2254 r = KVM_API_VERSION;
2255 break; 2255 break;
2256 case KVM_CREATE_VM: 2256 case KVM_CREATE_VM:
2257 r = -EINVAL; 2257 r = kvm_dev_ioctl_create_vm(arg);
2258 if (arg)
2259 goto out;
2260 r = kvm_dev_ioctl_create_vm();
2261 break; 2258 break;
2262 case KVM_CHECK_EXTENSION: 2259 case KVM_CHECK_EXTENSION:
2263 r = kvm_dev_ioctl_check_extension_generic(arg); 2260 r = kvm_dev_ioctl_check_extension_generic(arg);