From 018d00d2fef27fc65f2917bec8f72b93615c18e1 Mon Sep 17 00:00:00 2001 From: Zhang Xiantao Date: Thu, 15 Nov 2007 23:07:47 +0800 Subject: KVM: Portability: move KVM_CHECK_EXTENSION Make KVM_CHECK_EXTENSION code into a function, all archs can define its capability independently. Signed-off-by: Zhang Xiantao Acked-by: Carsten Otte Signed-off-by: Avi Kivity --- drivers/kvm/x86.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/kvm/x86.c') diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c index bbfa810bf8b..609792637fb 100644 --- a/drivers/kvm/x86.c +++ b/drivers/kvm/x86.c @@ -599,6 +599,26 @@ void decache_vcpus_on_cpu(int cpu) 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, unsigned int ioctl, unsigned long arg) { -- cgit v1.2.3