kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Support for cpuid functions with subleaves
@ 2009-01-13 10:47 Amit Shah
  2009-01-13 10:47 ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
  0 siblings, 1 reply; 10+ messages in thread
From: Amit Shah @ 2009-01-13 10:47 UTC (permalink / raw)
  To: avi; +Cc: kvm


These patches add support for handling sub-leaf values of some cpuid functions.

The kernel patch updates a userspace-visible for a typo. That value is not
yet used in the userspace so this should be harmless.

With these patches, a VM with the core2duo cpu type boots successfully.

Amit.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] KVM: x86: Fix typos and whitespace errors
  2009-01-13 10:47 Support for cpuid functions with subleaves Amit Shah
@ 2009-01-13 10:47 ` Amit Shah
  2009-01-13 10:47   ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Amit Shah
  2009-01-13 10:53   ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
  0 siblings, 2 replies; 10+ messages in thread
From: Amit Shah @ 2009-01-13 10:47 UTC (permalink / raw)
  To: avi; +Cc: kvm, Amit Shah

Some typos, comments, whitespace errors corrected in the cpuid code

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 arch/x86/include/asm/kvm.h |    6 ++--
 arch/x86/kvm/x86.c         |   45 +++++++++++++++++++++----------------------
 2 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h
index a031102..58e28ab 100644
--- a/arch/x86/include/asm/kvm.h
+++ b/arch/x86/include/asm/kvm.h
@@ -177,9 +177,9 @@ struct kvm_cpuid_entry2 {
 	__u32 padding[3];
 };
 
-#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX 1
-#define KVM_CPUID_FLAG_STATEFUL_FUNC    2
-#define KVM_CPUID_FLAG_STATE_READ_NEXT  4
+#define KVM_CPUID_FLAG_SIGNIFICANT_INDEX 1
+#define KVM_CPUID_FLAG_STATEFUL_FUNC     2
+#define KVM_CPUID_FLAG_STATE_READ_NEXT   4
 
 /* for KVM_SET_CPUID2 */
 struct kvm_cpuid2 {
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4b17253..06b44fb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1065,7 +1065,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
 		if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
 			goto out;
 		r = kvm_dev_ioctl_get_supported_cpuid(&cpuid,
-			cpuid_arg->entries);
+						      cpuid_arg->entries);
 		if (r)
 			goto out;
 
@@ -1163,8 +1163,8 @@ out:
 }
 
 static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
-				    struct kvm_cpuid2 *cpuid,
-				    struct kvm_cpuid_entry2 __user *entries)
+				     struct kvm_cpuid2 *cpuid,
+				     struct kvm_cpuid_entry2 __user *entries)
 {
 	int r;
 
@@ -1183,8 +1183,8 @@ out:
 }
 
 static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
-				    struct kvm_cpuid2 *cpuid,
-				    struct kvm_cpuid_entry2 __user *entries)
+				     struct kvm_cpuid2 *cpuid,
+				     struct kvm_cpuid_entry2 __user *entries)
 {
 	int r;
 
@@ -1193,7 +1193,7 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
 		goto out;
 	r = -EFAULT;
 	if (copy_to_user(entries, &vcpu->arch.cpuid_entries,
-			   vcpu->arch.cpuid_nent * sizeof(struct kvm_cpuid_entry2)))
+			 vcpu->arch.cpuid_nent * sizeof(struct kvm_cpuid_entry2)))
 		goto out;
 	return 0;
 
@@ -1203,12 +1203,12 @@ out:
 }
 
 static void do_cpuid_1_ent(struct kvm_cpuid_entry2 *entry, u32 function,
-			  u32 index)
+			   u32 index)
 {
 	entry->function = function;
 	entry->index = index;
 	cpuid_count(entry->function, entry->index,
-		&entry->eax, &entry->ebx, &entry->ecx, &entry->edx);
+		    &entry->eax, &entry->ebx, &entry->ecx, &entry->edx);
 	entry->flags = 0;
 }
 
@@ -1247,7 +1247,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 		bit(X86_FEATURE_LAHF_LM) | bit(X86_FEATURE_CMP_LEGACY) |
 		bit(X86_FEATURE_SVM);
 
-	/* all func 2 cpuid_count() should be called on the same cpu */
+	/* all calls to cpuid_count() should be made on the same cpu */
 	get_cpu();
 	do_cpuid_1_ent(entry, function, index);
 	++*nent;
@@ -1280,7 +1280,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 	case 4: {
 		int i, cache_type;
 
-		entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
+		entry->flags |= KVM_CPUID_FLAG_SIGNIFICANT_INDEX;
 		/* read more entries until cache_type is zero */
 		for (i = 1; *nent < maxnent; ++i) {
 			cache_type = entry[i - 1].eax & 0x1f;
@@ -1288,7 +1288,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 				break;
 			do_cpuid_1_ent(&entry[i], function, i);
 			entry[i].flags |=
-			       KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
+			       KVM_CPUID_FLAG_SIGNIFICANT_INDEX;
 			++*nent;
 		}
 		break;
@@ -1296,7 +1296,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 	case 0xb: {
 		int i, level_type;
 
-		entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
+		entry->flags |= KVM_CPUID_FLAG_SIGNIFICANT_INDEX;
 		/* read more entries until level_type is zero */
 		for (i = 1; *nent < maxnent; ++i) {
 			level_type = entry[i - 1].ecx & 0xff00;
@@ -1304,7 +1304,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 				break;
 			do_cpuid_1_ent(&entry[i], function, i);
 			entry[i].flags |=
-			       KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
+			       KVM_CPUID_FLAG_SIGNIFICANT_INDEX;
 			++*nent;
 		}
 		break;
@@ -1321,7 +1321,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 }
 
 static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
-				    struct kvm_cpuid_entry2 __user *entries)
+				     struct kvm_cpuid_entry2 __user *entries)
 {
 	struct kvm_cpuid_entry2 *cpuid_entries;
 	int limit, nent = 0, r = -E2BIG;
@@ -1338,7 +1338,7 @@ static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
 	limit = cpuid_entries[0].eax;
 	for (func = 1; func <= limit && nent < cpuid->nent; ++func)
 		do_cpuid_ent(&cpuid_entries[nent], func, 0,
-				&nent, cpuid->nent);
+			     &nent, cpuid->nent);
 	r = -E2BIG;
 	if (nent >= cpuid->nent)
 		goto out_free;
@@ -1347,10 +1347,10 @@ static int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid,
 	limit = cpuid_entries[nent - 1].eax;
 	for (func = 0x80000001; func <= limit && nent < cpuid->nent; ++func)
 		do_cpuid_ent(&cpuid_entries[nent], func, 0,
-			       &nent, cpuid->nent);
+			     &nent, cpuid->nent);
 	r = -EFAULT;
 	if (copy_to_user(entries, cpuid_entries,
-			nent * sizeof(struct kvm_cpuid_entry2)))
+			 nent * sizeof(struct kvm_cpuid_entry2)))
 		goto out_free;
 	cpuid->nent = nent;
 	r = 0;
@@ -1494,7 +1494,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 		if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
 			goto out;
 		r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid,
-				cpuid_arg->entries);
+					      cpuid_arg->entries);
 		if (r)
 			goto out;
 		break;
@@ -1507,7 +1507,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 		if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
 			goto out;
 		r = kvm_vcpu_ioctl_get_cpuid2(vcpu, &cpuid,
-				cpuid_arg->entries);
+					      cpuid_arg->entries);
 		if (r)
 			goto out;
 		r = -EFAULT;
@@ -2855,14 +2855,14 @@ static int move_to_next_stateful_cpuid_entry(struct kvm_vcpu *vcpu, int i)
 /* find an entry with matching function, matching index (if needed), and that
  * should be read next (if it's stateful) */
 static int is_matching_cpuid_entry(struct kvm_cpuid_entry2 *e,
-	u32 function, u32 index)
+				   u32 function, u32 index)
 {
 	if (e->function != function)
 		return 0;
-	if ((e->flags & KVM_CPUID_FLAG_SIGNIFCANT_INDEX) && e->index != index)
+	if ((e->flags & KVM_CPUID_FLAG_SIGNIFICANT_INDEX) && e->index != index)
 		return 0;
 	if ((e->flags & KVM_CPUID_FLAG_STATEFUL_FUNC) &&
-		!(e->flags & KVM_CPUID_FLAG_STATE_READ_NEXT))
+	    !(e->flags & KVM_CPUID_FLAG_STATE_READ_NEXT))
 		return 0;
 	return 1;
 }
@@ -2890,7 +2890,6 @@ struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
 			if (!best || e->function > best->function)
 				best = e;
 	}
-
 	return best;
 }
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface
  2009-01-13 10:47 ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
@ 2009-01-13 10:47   ` Amit Shah
  2009-01-13 10:47     ` [PATCH 2/2] KVM: userspace: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
  2009-01-14 14:52     ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Avi Kivity
  2009-01-13 10:53   ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
  1 sibling, 2 replies; 10+ messages in thread
From: Amit Shah @ 2009-01-13 10:47 UTC (permalink / raw)
  To: avi; +Cc: kvm, Amit Shah

kvm_set_cpuid2() builds on top of kvm_set_cpuid() and correctly populates
cpuid functions that have sub-leaves.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 libkvm/libkvm-x86.c |   18 ++++++++++++++++++
 libkvm/libkvm.h     |   16 ++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
index a8cca15..93a9c4e 100644
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -475,6 +475,24 @@ int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
 	return r;
 }
 
+int kvm_setup_cpuid2(kvm_context_t kvm, int vcpu, int nent,
+		     struct kvm_cpuid_entry2 *entries)
+{
+	struct kvm_cpuid2 *cpuid;
+	int r;
+
+	cpuid = malloc(sizeof(*cpuid) + nent * sizeof(*entries));
+	if (!cpuid)
+		return -ENOMEM;
+
+	cpuid->nent = nent;
+	memcpy(cpuid->entries, entries, nent * sizeof(*entries));
+	r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_CPUID2, cpuid);
+
+	free(cpuid);
+	return r;
+}
+
 int kvm_set_shadow_pages(kvm_context_t kvm, unsigned int nrshadow_pages)
 {
 #ifdef KVM_CAP_MMU_SHADOW_CACHE_CONTROL
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index ee1ba68..5728b1c 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -373,6 +373,22 @@ int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
 		    struct kvm_cpuid_entry *entries);
 
 /*!
+ * \brief Setup a vcpu's cpuid instruction emulation
+ *
+ * Set up a table of cpuid function to cpuid outputs.
+ * This call replaces the older kvm_setup_cpuid interface by adding a few
+ * parameters to support cpuid functions that have sub-leaf values.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should be initialized
+ * \param nent number of entries to be installed
+ * \param entries cpuid function entries table
+ * \return 0 on success, or -errno on error
+ */
+int kvm_setup_cpuid2(kvm_context_t kvm, int vcpu, int nent,
+		     struct kvm_cpuid_entry2 *entries);
+
+/*!
  * \brief Setting the number of shadow pages to be allocated to the vm
  *
  * \param kvm pointer to kvm_context
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] KVM: userspace: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd.
  2009-01-13 10:47   ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Amit Shah
@ 2009-01-13 10:47     ` Amit Shah
  2009-01-14 14:57       ` Avi Kivity
  2009-01-14 14:52     ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Avi Kivity
  1 sibling, 1 reply; 10+ messages in thread
From: Amit Shah @ 2009-01-13 10:47 UTC (permalink / raw)
  To: avi; +Cc: kvm, Amit Shah

CPUID functions 4, 0xb and 0xd have sub-leaf values which depend on the
input value of ECX. Fetch these cpuid values and pass them on to the kernel.

We also switch to the kvm_set_cpuid2() ioctl for this; kvm_set_cpuid() can't
handle the extra parameters we need to support sub-leaves.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 qemu/qemu-kvm-x86.c |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 4fad2af..d9736b4 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -462,10 +462,11 @@ void kvm_arch_save_regs(CPUState *env)
     }
 }
 
-static void do_cpuid_ent(struct kvm_cpuid_entry *e, uint32_t function,
-			 CPUState *env)
+static void do_cpuid_ent(struct kvm_cpuid_entry2 *e, uint32_t function,
+                         uint32_t count, CPUState *env)
 {
     env->regs[R_EAX] = function;
+    env->regs[R_ECX] = count;
     qemu_kvm_cpuid_on_env(env);
     e->function = function;
     e->eax = env->regs[R_EAX];
@@ -507,14 +508,14 @@ static int get_para_features(kvm_context_t kvm_context)
 
 int kvm_arch_qemu_init_env(CPUState *cenv)
 {
-    struct kvm_cpuid_entry cpuid_ent[100];
+    struct kvm_cpuid_entry2 cpuid_ent[100];
 #ifdef KVM_CPUID_SIGNATURE
-    struct kvm_cpuid_entry *pv_ent;
+    struct kvm_cpuid_entry2 *pv_ent;
     uint32_t signature[3];
 #endif
     int cpuid_nent = 0;
     CPUState copy;
-    uint32_t i, limit;
+    uint32_t i, j, limit;
 
     copy = *cenv;
 
@@ -539,17 +540,35 @@ int kvm_arch_qemu_init_env(CPUState *cenv)
     qemu_kvm_cpuid_on_env(&copy);
     limit = copy.regs[R_EAX];
 
-    for (i = 0; i <= limit; ++i)
-	do_cpuid_ent(&cpuid_ent[cpuid_nent++], i, &copy);
+    for (i = 0; i <= limit; ++i) {
+        if (i == 4 || i == 0xb || i == 0xd) {
+            for (j = 0; ; ++j) {
+                do_cpuid_ent(&cpuid_ent[cpuid_nent], i, j, &copy);
+
+                cpuid_ent[cpuid_nent].flags = KVM_CPUID_FLAG_SIGNIFICANT_INDEX;
+                cpuid_ent[cpuid_nent].index = j;
+
+                cpuid_nent++;
+
+                if (i == 4 && copy.regs[R_EAX] == 0)
+                    break;
+                if (i == 0xb && !(copy.regs[R_ECX] & 0xff00))
+                    break;
+                if (i == 0xd && copy.regs[R_EAX] == 0)
+                    break;
+            }
+        } else
+            do_cpuid_ent(&cpuid_ent[cpuid_nent++], i, 0, &copy);
+    }
 
     copy.regs[R_EAX] = 0x80000000;
     qemu_kvm_cpuid_on_env(&copy);
     limit = copy.regs[R_EAX];
 
     for (i = 0x80000000; i <= limit; ++i)
-	do_cpuid_ent(&cpuid_ent[cpuid_nent++], i, &copy);
+	do_cpuid_ent(&cpuid_ent[cpuid_nent++], i, 0, &copy);
 
-    kvm_setup_cpuid(kvm_context, cenv->cpu_index, cpuid_nent, cpuid_ent);
+    kvm_setup_cpuid2(kvm_context, cenv->cpu_index, cpuid_nent, cpuid_ent);
     return 0;
 }
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] KVM: x86: Fix typos and whitespace errors
  2009-01-13 10:47 ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
  2009-01-13 10:47   ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Amit Shah
@ 2009-01-13 10:53   ` Amit Shah
  2009-01-14 14:55     ` Avi Kivity
  1 sibling, 1 reply; 10+ messages in thread
From: Amit Shah @ 2009-01-13 10:53 UTC (permalink / raw)
  To: avi; +Cc: kvm

On Tue, Jan 13, 2009 at 10:47:52AM +0000, Amit Shah wrote:
> Some typos, comments, whitespace errors corrected in the cpuid code
> 
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
>  arch/x86/include/asm/kvm.h |    6 ++--
>  arch/x86/kvm/x86.c         |   45 +++++++++++++++++++++----------------------
>  2 files changed, 25 insertions(+), 26 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h
> index a031102..58e28ab 100644
> --- a/arch/x86/include/asm/kvm.h
> +++ b/arch/x86/include/asm/kvm.h
> @@ -177,9 +177,9 @@ struct kvm_cpuid_entry2 {
>  	__u32 padding[3];
>  };
>  
> -#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX 1
> -#define KVM_CPUID_FLAG_STATEFUL_FUNC    2
> -#define KVM_CPUID_FLAG_STATE_READ_NEXT  4
> +#define KVM_CPUID_FLAG_SIGNIFICANT_INDEX 1

Avi, this is assuming we can push this fix to the stable kernel series.
Can that be done or should we live with the typo? (Or adding a
#define KVM_CPUID_FLAG_SIGNIFICANT_INDEX KVM_CPUID_FLAG_SIGNIFCANT_INDEX
?)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface
  2009-01-13 10:47   ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Amit Shah
  2009-01-13 10:47     ` [PATCH 2/2] KVM: userspace: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
@ 2009-01-14 14:52     ` Avi Kivity
  1 sibling, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2009-01-14 14:52 UTC (permalink / raw)
  To: Amit Shah; +Cc: kvm

Amit Shah wrote:
> kvm_set_cpuid2() builds on top of kvm_set_cpuid() and correctly populates
> cpuid functions that have sub-leaves.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
>  libkvm/libkvm-x86.c |   18 ++++++++++++++++++
>  libkvm/libkvm.h     |   16 ++++++++++++++++
>  2 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
> index a8cca15..93a9c4e 100644
> --- a/libkvm/libkvm-x86.c
> +++ b/libkvm/libkvm-x86.c
> @@ -475,6 +475,24 @@ int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
>  	return r;
>  }
>  
> +int kvm_setup_cpuid2(kvm_context_t kvm, int vcpu, int nent,
> +		     struct kvm_cpuid_entry2 *entries)
> +{
> +	struct kvm_cpuid2 *cpuid;
> +	int r;
> +
> +	cpuid = malloc(sizeof(*cpuid) + nent * sizeof(*entries));
> +	if (!cpuid)
> +		return -ENOMEM;
> +
> +	cpuid->nent = nent;
> +	memcpy(cpuid->entries, entries, nent * sizeof(*entries));
> +	r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_CPUID2, cpuid);
> +
> +	free(cpuid);
> +	return r;
> +}
>   

Should return -errno, not -EPERM, if the ioctl fails.


-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] KVM: x86: Fix typos and whitespace errors
  2009-01-13 10:53   ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
@ 2009-01-14 14:55     ` Avi Kivity
  0 siblings, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2009-01-14 14:55 UTC (permalink / raw)
  To: Amit Shah; +Cc: kvm

Amit Shah wrote:
>> -#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX 1
>> -#define KVM_CPUID_FLAG_STATEFUL_FUNC    2
>> -#define KVM_CPUID_FLAG_STATE_READ_NEXT  4
>> +#define KVM_CPUID_FLAG_SIGNIFICANT_INDEX 1
>>     
>
> Avi, this is assuming we can push this fix to the stable kernel series.
> Can that be done or should we live with the typo? (Or adding a
> #define KVM_CPUID_FLAG_SIGNIFICANT_INDEX KVM_CPUID_FLAG_SIGNIFCANT_INDEX
> ?)
>   

I think we can live with the typo.  We have enough compatibility headaches.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] KVM: userspace: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd.
  2009-01-13 10:47     ` [PATCH 2/2] KVM: userspace: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
@ 2009-01-14 14:57       ` Avi Kivity
  0 siblings, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2009-01-14 14:57 UTC (permalink / raw)
  To: Amit Shah; +Cc: kvm

Amit Shah wrote:
> CPUID functions 4, 0xb and 0xd have sub-leaf values which depend on the
> input value of ECX. Fetch these cpuid values and pass them on to the kernel.
>
> We also switch to the kvm_set_cpuid2() ioctl for this; kvm_set_cpuid() can't
> handle the extra parameters we need to support sub-leaves.
>   

Looks fine, just need the first patch fixed.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Support for cpuid functions with subleaves
  2009-01-14 16:51 Support for cpuid functions with subleaves Amit Shah
@ 2009-01-15  9:39 ` Avi Kivity
  0 siblings, 0 replies; 10+ messages in thread
From: Avi Kivity @ 2009-01-15  9:39 UTC (permalink / raw)
  To: Amit Shah; +Cc: kvm

Amit Shah wrote:
> Hello,
>
> v3 of the patch uses the KVM_SET_CPUID2 interface to not cause any userspace
> and kernel incompatibilities.
>
> With these patches applied, I can run a VM with a newer CPU type (core2duo).
>
> Fixes bug #2413430
>
> Please apply
>   

Applied both, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Support for cpuid functions with subleaves
@ 2009-01-14 16:51 Amit Shah
  2009-01-15  9:39 ` Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Amit Shah @ 2009-01-14 16:51 UTC (permalink / raw)
  To: avi; +Cc: kvm


Hello,

v3 of the patch uses the KVM_SET_CPUID2 interface to not cause any userspace
and kernel incompatibilities.

With these patches applied, I can run a VM with a newer CPU type (core2duo).

Fixes bug #2413430

Please apply
Amit

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-15  9:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-13 10:47 Support for cpuid functions with subleaves Amit Shah
2009-01-13 10:47 ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
2009-01-13 10:47   ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Amit Shah
2009-01-13 10:47     ` [PATCH 2/2] KVM: userspace: Fetch sub-leaf cpuid values for functions 4, 0xb, 0xd Amit Shah
2009-01-14 14:57       ` Avi Kivity
2009-01-14 14:52     ` [PATCH 1/2] kvm: libkvm: Add a wrapper for an ioctl for the KVM_SET_CPUID2 interface Avi Kivity
2009-01-13 10:53   ` [PATCH] KVM: x86: Fix typos and whitespace errors Amit Shah
2009-01-14 14:55     ` Avi Kivity
2009-01-14 16:51 Support for cpuid functions with subleaves Amit Shah
2009-01-15  9:39 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).