Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=018d00d2fef27fc65f2917bec8f72b93615c18e1
Commit:     018d00d2fef27fc65f2917bec8f72b93615c18e1
Parent:     a7e6c88a78b7c3d67491bf90b2b95e66437dbdb6
Author:     Zhang Xiantao <[EMAIL PROTECTED]>
AuthorDate: Thu Nov 15 23:07:47 2007 +0800
Committer:  Avi Kivity <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 17:53:03 2008 +0200

    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 <[EMAIL PROTECTED]>
    Acked-by: Carsten Otte <[EMAIL PROTECTED]>
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
---
 drivers/kvm/kvm.h      |    3 +++
 drivers/kvm/kvm_main.c |   18 ++----------------
 drivers/kvm/x86.c      |   20 ++++++++++++++++++++
 3 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 96d9c7d..a7be073 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -628,6 +628,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
                         unsigned int ioctl, unsigned long arg);
 void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
 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,
                                   struct
                                   kvm_userspace_memory_region *mem,
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index e0f20d0..c782f27 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1198,23 +1198,9 @@ static long kvm_dev_ioctl(struct file *filp,
                        goto out;
                r = kvm_dev_ioctl_create_vm();
                break;
-       case KVM_CHECK_EXTENSION: {
-               int ext = (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;
-               }
+       case KVM_CHECK_EXTENSION:
+               r = kvm_dev_ioctl_check_extension((long)argp);
                break;
-       }
        case KVM_GET_VCPU_MMAP_SIZE:
                r = -EINVAL;
                if (arg)
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index bbfa810..6097926 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)
 {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to