aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
authorIzik Eidus <izike@qumranet.com>2007-10-24 18:29:55 -0400
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:52:56 -0500
commitcbc9402297b9a233981f74587786364cda21c771 (patch)
tree35ba97693ffc506bb08f6bafa9e61a260bc8189f /drivers/kvm/kvm_main.c
parente0d62c7f48605119a7f9fa632e77561c89928963 (diff)
KVM: Add ioctl to tss address from userspace,
Currently kvm has a wart in that it requires three extra pages for use as a tss when emulating real mode on Intel. This patch moves the allocation internally, only requiring userspace to tell us where in the physical address space we can place the tss. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index a044856bd02..50fd040b9ea 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2661,6 +2661,16 @@ static int create_vcpu_fd(struct kvm_vcpu *vcpu)
2661 return fd; 2661 return fd;
2662} 2662}
2663 2663
2664static int kvm_vm_ioctl_set_tss_addr(struct kvm *kvm, unsigned long addr)
2665{
2666 int ret;
2667
2668 if (addr > (unsigned int)(-3 * PAGE_SIZE))
2669 return -1;
2670 ret = kvm_x86_ops->set_tss_addr(kvm, addr);
2671 return ret;
2672}
2673
2664/* 2674/*
2665 * Creates some virtual cpus. Good luck creating more than one. 2675 * Creates some virtual cpus. Good luck creating more than one.
2666 */ 2676 */
@@ -2957,6 +2967,11 @@ static long kvm_vm_ioctl(struct file *filp,
2957 int r = -EINVAL; 2967 int r = -EINVAL;
2958 2968
2959 switch (ioctl) { 2969 switch (ioctl) {
2970 case KVM_SET_TSS_ADDR:
2971 r = kvm_vm_ioctl_set_tss_addr(kvm, arg);
2972 if (r < 0)
2973 goto out;
2974 break;
2960 case KVM_CREATE_VCPU: 2975 case KVM_CREATE_VCPU:
2961 r = kvm_vm_ioctl_create_vcpu(kvm, arg); 2976 r = kvm_vm_ioctl_create_vcpu(kvm, arg);
2962 if (r < 0) 2977 if (r < 0)
@@ -3183,6 +3198,7 @@ static long kvm_dev_ioctl(struct file *filp,
3183 case KVM_CAP_HLT: 3198 case KVM_CAP_HLT:
3184 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: 3199 case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
3185 case KVM_CAP_USER_MEMORY: 3200 case KVM_CAP_USER_MEMORY:
3201 case KVM_CAP_SET_TSS_ADDR:
3186 r = 1; 3202 r = 1;
3187 break; 3203 break;
3188 default: 3204 default: