Commit 018d00d2 authored by Zhang Xiantao's avatar Zhang Xiantao Committed by Avi Kivity

KVM: Portability: move KVM_CHECK_EXTENSION

Make KVM_CHECK_EXTENSION code into a function, all archs can define its
capability independently.
Signed-off-by: default avatarZhang Xiantao <xiantao.zhang@intel.com>
Acked-by: default avatarCarsten Otte <cotte@de.ibm.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent a7e6c88a
...@@ -628,6 +628,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -628,6 +628,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg); unsigned int ioctl, unsigned long arg);
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
int kvm_dev_ioctl_check_extension(long ext);
int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
struct struct
kvm_userspace_memory_region *mem, kvm_userspace_memory_region *mem,
......
...@@ -1198,23 +1198,9 @@ static long kvm_dev_ioctl(struct file *filp, ...@@ -1198,23 +1198,9 @@ static long kvm_dev_ioctl(struct file *filp,
goto out; goto out;
r = kvm_dev_ioctl_create_vm(); r = kvm_dev_ioctl_create_vm();
break; break;
case KVM_CHECK_EXTENSION: { case KVM_CHECK_EXTENSION:
int ext = (long)argp; r = kvm_dev_ioctl_check_extension((long)argp);
switch (ext) {
case KVM_CAP_IRQCHIP:
case KVM_CAP_HLT:
case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
case KVM_CAP_USER_MEMORY:
case KVM_CAP_SET_TSS_ADDR:
r = 1;
break;
default:
r = 0;
break;
}
break; break;
}
case KVM_GET_VCPU_MMAP_SIZE: case KVM_GET_VCPU_MMAP_SIZE:
r = -EINVAL; r = -EINVAL;
if (arg) if (arg)
......
...@@ -599,6 +599,26 @@ void decache_vcpus_on_cpu(int cpu) ...@@ -599,6 +599,26 @@ void decache_vcpus_on_cpu(int cpu)
spin_unlock(&kvm_lock); spin_unlock(&kvm_lock);
} }
int kvm_dev_ioctl_check_extension(long ext)
{
int r;
switch (ext) {
case KVM_CAP_IRQCHIP:
case KVM_CAP_HLT:
case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
case KVM_CAP_USER_MEMORY:
case KVM_CAP_SET_TSS_ADDR:
r = 1;
break;
default:
r = 0;
break;
}
return r;
}
long kvm_arch_dev_ioctl(struct file *filp, long kvm_arch_dev_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg) unsigned int ioctl, unsigned long arg)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment