Hi Avi, This patch cover's the kernel ABI change as we discussed in the earlier email.
Patch Description: Change the ioctl KVM_GET_SUPPORTED_CPUID, such that it will return the no of entries in the list when requested no of entries (nent) is 0. Also add another KVM_CHECK_EXTENSION, KVM_CAP_CPUID_SIZER to determine if the running kernel supports the above changed ABI. Signed-Off-By: Nitin A Kamble <[EMAIL PROTECTED]> Please Apply. Thanks & Regards, Nitin
commit 70e4e65bc591eb9cf25c1cbc0d16b2cbdb089a6f Author: Nitin A Kamble <[EMAIL PROTECTED]> Date: Wed Nov 5 16:17:46 2008 -0800 Change the ioctl KVM_GET_SUPPORTED_CPUID, such that it will return the no of entries in the list when request no of entries (nent) is 0. Also add another KVM_CHECK_EXTENSION, KVM_CAP_CPUID_SIZER to determine if the running kernel supports the above changed ABI. Signed-Off-By: Nitin A Kamble <[EMAIL PROTECTED]> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 09e6c56..e50db11 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -86,7 +86,7 @@ #define KVM_NUM_MMU_PAGES (1 << KVM_MMU_HASH_SHIFT) #define KVM_MIN_FREE_MMU_PAGES 5 #define KVM_REFILL_PAGES 25 -#define KVM_MAX_CPUID_ENTRIES 40 +#define KVM_MAX_CPUID_ENTRIES 100 #define KVM_NR_FIXED_MTRR_REGION 88 #define KVM_NR_VAR_MTRR 8 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bf7461b..52e6207 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -969,6 +969,7 @@ int kvm_dev_ioctl_check_extension(long ext) case KVM_CAP_NOP_IO_DELAY: case KVM_CAP_MP_STATE: case KVM_CAP_SYNC_MMU: + case KVM_CAP_CPUID_SIZER: r = 1; break; case KVM_CAP_COALESCED_MMIO: @@ -1303,10 +1304,14 @@ static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid, { struct kvm_cpuid_entry2 *cpuid_entries; int limit, nent = 0, r = -E2BIG; + int sizer = 0; u32 func; - if (cpuid->nent < 1) - goto out; + if (cpuid->nent == 0) { + sizer = 1; + cpuid->nent = KVM_MAX_CPUID_ENTRIES; + } + r = -ENOMEM; cpuid_entries = vmalloc(sizeof(struct kvm_cpuid_entry2) * cpuid->nent); if (!cpuid_entries) @@ -1327,9 +1332,11 @@ static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid, do_cpuid_ent(&cpuid_entries[nent], func, 0, &nent, cpuid->nent); r = -EFAULT; - if (copy_to_user(entries, cpuid_entries, + if (!sizer) { + if (copy_to_user(entries, cpuid_entries, nent * sizeof(struct kvm_cpuid_entry2))) - goto out_free; + goto out_free; + } cpuid->nent = nent; r = 0; diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 44fd7fa..d4cb8b1 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -392,6 +392,9 @@ struct kvm_trace_rec { #endif #define KVM_CAP_IOMMU 18 #define KVM_CAP_NMI 19 +#define KVM_CAP_CPUID_SIZER 20 /* return of 1 means the KVM_GET_SUPPORTED_CPUID */ + /* ioctl will return the size of list when input */ + /* list size (nent) is 0 */ /* * ioctls for VM fds
signature.asc
Description: This is a digitally signed message part