All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 00/16] Allow changing of Hypervisor CPUIDs.
@ 2012-09-24 14:32 ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization CPUIDs.

This is primarily done so that the guest will think it is running
under vmware when hypervisor-vendor=vmware is specified as a
property of a cpu.


This depends on:

http://lists.gnu.org/archive/html/qemu-devel/2012-09/msg01400.html

As far as I know it is #4. It depends on (1) and (2) and (3).

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

Changes from v5 to v6:
  Split out 01/17: target-i386: Allow tsc-frequency to be larger then 2.147G
    It has been accepted as a trivial patch:
    http://lists.gnu.org/archive/html/qemu-devel/2012-09/msg03959.html
Blue Swirl:
  Fix 2 checkpatch.pl "WARNING: line over 80 characters".

Changes from v4 to v5:
  Undo kvm_clock2 change.
  Add cpuid_hv_level_set; cpuid_hv_level == 0 is now valid.
  Add cpuid_hv_vendor_set; the null string is now valid.
  Handle kvm and cpuid_hv_level == 0.
  hypervisor-vendor=kvm,hypervisor-level=0 and hypervisor-level=0,hypervisor-vendor=kvm
    now do the same thing.

Changes from v3 to v4:
  Added CPUID_HV_LEVEL_HYPERV, CPUID_HV_LEVEL_KVM.
  Added CPUID_HV_VENDOR_HYPERV.
  Added hyperv as known hypservisor-vendor.
  Allow hypervisor-level to be 0.

Changes from v2 to v3:
  Clean post to qemu-devel.

Changes from v1 to v2:

1) Added 1/4 from http://lists.gnu.org/archive/html/qemu-devel/2012-08/msg05153.html

   Because Fred is changing jobs and so will not be pushing to get
   this in. It needed to be rebased, And I needed it to complete the
   testing of this change.

2) Added 2/4 because of the re-work I needed a way to clear all KVM bits,

3) The rework of v1.  Make it fit into the object model re-work of cpu.c for x86.

4) Added 3/4 -- The split out of the code that is not needed for accel=kvm.

Changes from v2 to v3:

Marcelo Tosatti:
  Its one big patch, better split in logically correlated patches
  (with better changelog). This would help reviewers.

So split 3 and 4 into 3 to 17.  More info in change log.
No code change.

Don Slutz (16):
  target-i386: Add missing kvm bits.
  target-i386: Add Hypervisor level.
  target-i386: Add cpu object access routines for Hypervisor level.
  target-i386: Add x86_set_hyperv.
  target-i386: Use Hypervisor level in -machine pc,accel=kvm.
  target-i386: Use Hypervisor level in -machine pc,accel=tcg.
  target-i386: Add Hypervisor vendor.
  target-i386: Add cpu object access routines for Hypervisor vendor.
  target-i386: Use Hypervisor vendor in -machine pc,accel=kvm.
  target-i386: Use Hypervisor vendor in -machine pc,accel=tcg.
  target-i386: Add some known names to Hypervisor vendor.
  target-i386: Add optional Hypervisor leaf extra.
  target-i386: Add cpu object access routines for Hypervisor leaf
    extra.
  target-i386: Add setting of Hypervisor leaf extra for known vmare4.
  target-i386: Use Hypervisor leaf extra in -machine pc,accel=kvm.
  target-i386: Use Hypervisor leaf extra in -machine pc,accel=tcg.

 target-i386/cpu.c |  285 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 target-i386/cpu.h |   34 +++++++
 target-i386/kvm.c |   33 +++++-
 3 files changed, 342 insertions(+), 10 deletions(-)


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

* [Qemu-devel] [PATCH v6 00/16] Allow changing of Hypervisor CPUIDs.
@ 2012-09-24 14:32 ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization CPUIDs.

This is primarily done so that the guest will think it is running
under vmware when hypervisor-vendor=vmware is specified as a
property of a cpu.


This depends on:

http://lists.gnu.org/archive/html/qemu-devel/2012-09/msg01400.html

As far as I know it is #4. It depends on (1) and (2) and (3).

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

Changes from v5 to v6:
  Split out 01/17: target-i386: Allow tsc-frequency to be larger then 2.147G
    It has been accepted as a trivial patch:
    http://lists.gnu.org/archive/html/qemu-devel/2012-09/msg03959.html
Blue Swirl:
  Fix 2 checkpatch.pl "WARNING: line over 80 characters".

Changes from v4 to v5:
  Undo kvm_clock2 change.
  Add cpuid_hv_level_set; cpuid_hv_level == 0 is now valid.
  Add cpuid_hv_vendor_set; the null string is now valid.
  Handle kvm and cpuid_hv_level == 0.
  hypervisor-vendor=kvm,hypervisor-level=0 and hypervisor-level=0,hypervisor-vendor=kvm
    now do the same thing.

Changes from v3 to v4:
  Added CPUID_HV_LEVEL_HYPERV, CPUID_HV_LEVEL_KVM.
  Added CPUID_HV_VENDOR_HYPERV.
  Added hyperv as known hypservisor-vendor.
  Allow hypervisor-level to be 0.

Changes from v2 to v3:
  Clean post to qemu-devel.

Changes from v1 to v2:

1) Added 1/4 from http://lists.gnu.org/archive/html/qemu-devel/2012-08/msg05153.html

   Because Fred is changing jobs and so will not be pushing to get
   this in. It needed to be rebased, And I needed it to complete the
   testing of this change.

2) Added 2/4 because of the re-work I needed a way to clear all KVM bits,

3) The rework of v1.  Make it fit into the object model re-work of cpu.c for x86.

4) Added 3/4 -- The split out of the code that is not needed for accel=kvm.

Changes from v2 to v3:

Marcelo Tosatti:
  Its one big patch, better split in logically correlated patches
  (with better changelog). This would help reviewers.

So split 3 and 4 into 3 to 17.  More info in change log.
No code change.

Don Slutz (16):
  target-i386: Add missing kvm bits.
  target-i386: Add Hypervisor level.
  target-i386: Add cpu object access routines for Hypervisor level.
  target-i386: Add x86_set_hyperv.
  target-i386: Use Hypervisor level in -machine pc,accel=kvm.
  target-i386: Use Hypervisor level in -machine pc,accel=tcg.
  target-i386: Add Hypervisor vendor.
  target-i386: Add cpu object access routines for Hypervisor vendor.
  target-i386: Use Hypervisor vendor in -machine pc,accel=kvm.
  target-i386: Use Hypervisor vendor in -machine pc,accel=tcg.
  target-i386: Add some known names to Hypervisor vendor.
  target-i386: Add optional Hypervisor leaf extra.
  target-i386: Add cpu object access routines for Hypervisor leaf
    extra.
  target-i386: Add setting of Hypervisor leaf extra for known vmare4.
  target-i386: Use Hypervisor leaf extra in -machine pc,accel=kvm.
  target-i386: Use Hypervisor leaf extra in -machine pc,accel=tcg.

 target-i386/cpu.c |  285 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 target-i386/cpu.h |   34 +++++++
 target-i386/kvm.c |   33 +++++-
 3 files changed, 342 insertions(+), 10 deletions(-)

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

* [PATCH v6 01/16] target-i386: Add missing kvm bits.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 0313cf5..25ca986 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -87,10 +87,14 @@ static const char *ext3_feature_name[] = {
 };
 
 static const char *kvm_feature_name[] = {
-    "kvmclock", "kvm_nopiodelay", "kvm_mmu", "kvmclock", "kvm_asyncpf", NULL, "kvm_pv_eoi", NULL,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    "kvmclock", "kvm_nopiodelay", "kvm_mmu", "kvmclock",
+    "kvm_asyncpf", "kvm_steal_time", "kvm_pv_eoi", NULL,
+    NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL,
+    "kvm_clock_stable", NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL,
 };
 
 static const char *svm_feature_name[] = {
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 01/16] target-i386: Add missing kvm bits.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 0313cf5..25ca986 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -87,10 +87,14 @@ static const char *ext3_feature_name[] = {
 };
 
 static const char *kvm_feature_name[] = {
-    "kvmclock", "kvm_nopiodelay", "kvm_mmu", "kvmclock", "kvm_asyncpf", NULL, "kvm_pv_eoi", NULL,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    "kvmclock", "kvm_nopiodelay", "kvm_mmu", "kvmclock",
+    "kvm_asyncpf", "kvm_steal_time", "kvm_pv_eoi", NULL,
+    NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL,
+    "kvm_clock_stable", NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL,
 };
 
 static const char *svm_feature_name[] = {
-- 
1.7.1

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

* [PATCH v6 02/16] target-i386: Add Hypervisor level.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization level or maximim cpuid function present in this leaf.
This is just the EAX value for 0x40000000.

QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).

This is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

QEMU has the value HYPERV_CPUID_MIN defined.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 5265c5a..1899f69 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -777,11 +777,14 @@ typedef struct CPUX86State {
     uint32_t cpuid_ext3_features;
     uint32_t cpuid_apic_id;
     bool cpuid_vendor_override;
+    bool cpuid_hv_level_set;
     /* Store the results of Centaur's CPUID instructions */
     uint32_t cpuid_xlevel2;
     uint32_t cpuid_ext4_features;
     /* Flags from CPUID[EAX=7,ECX=0].EBX */
     uint32_t cpuid_7_0_ebx;
+    /* Hypervisor CPUIDs */
+    uint32_t cpuid_hv_level;
 
     /* MTRRs */
     uint64_t mtrr_fixed[11];
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 02/16] target-i386: Add Hypervisor level.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization level or maximim cpuid function present in this leaf.
This is just the EAX value for 0x40000000.

QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).

This is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

QEMU has the value HYPERV_CPUID_MIN defined.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 5265c5a..1899f69 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -777,11 +777,14 @@ typedef struct CPUX86State {
     uint32_t cpuid_ext3_features;
     uint32_t cpuid_apic_id;
     bool cpuid_vendor_override;
+    bool cpuid_hv_level_set;
     /* Store the results of Centaur's CPUID instructions */
     uint32_t cpuid_xlevel2;
     uint32_t cpuid_ext4_features;
     /* Flags from CPUID[EAX=7,ECX=0].EBX */
     uint32_t cpuid_7_0_ebx;
+    /* Hypervisor CPUIDs */
+    uint32_t cpuid_hv_level;
 
     /* MTRRs */
     uint64_t mtrr_fixed[11];
-- 
1.7.1

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

* [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

These are modeled after x86_cpuid_get_xlevel and x86_cpuid_set_xlevel.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 25ca986..451de12 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1166,6 +1166,32 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
     cpu->env.tsc_khz = value / 1000;
 }
 
+static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_level, name, errp);
+}
+
+static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    uint32_t value;
+
+    visit_type_uint32(v, &value, name, errp);
+    if (error_is_set(errp)) {
+        return;
+    }
+
+    if (value != 0 && value < 0x40000000) {
+        value += 0x40000000;
+    }
+    cpu->env.cpuid_hv_level = value;
+    cpu->env.cpuid_hv_level_set = true;
+}
+
 #if !defined(CONFIG_USER_ONLY)
 static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
                                  const char *name, Error **errp)
@@ -2061,6 +2087,9 @@ static void x86_cpu_initfn(Object *obj)
     object_property_add(obj, "enforce", "bool",
                         x86_cpuid_get_enforce,
                         x86_cpuid_set_enforce, NULL, NULL, NULL);
+    object_property_add(obj, "hypervisor-level", "int",
+                        x86_cpuid_get_hv_level,
+                        x86_cpuid_set_hv_level, NULL, NULL, NULL);
 #if !defined(CONFIG_USER_ONLY)
     object_property_add(obj, "hv_spinlocks", "int",
                         x86_get_hv_spinlocks,
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

These are modeled after x86_cpuid_get_xlevel and x86_cpuid_set_xlevel.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 25ca986..451de12 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1166,6 +1166,32 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
     cpu->env.tsc_khz = value / 1000;
 }
 
+static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_level, name, errp);
+}
+
+static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    uint32_t value;
+
+    visit_type_uint32(v, &value, name, errp);
+    if (error_is_set(errp)) {
+        return;
+    }
+
+    if (value != 0 && value < 0x40000000) {
+        value += 0x40000000;
+    }
+    cpu->env.cpuid_hv_level = value;
+    cpu->env.cpuid_hv_level_set = true;
+}
+
 #if !defined(CONFIG_USER_ONLY)
 static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
                                  const char *name, Error **errp)
@@ -2061,6 +2087,9 @@ static void x86_cpu_initfn(Object *obj)
     object_property_add(obj, "enforce", "bool",
                         x86_cpuid_get_enforce,
                         x86_cpuid_set_enforce, NULL, NULL, NULL);
+    object_property_add(obj, "hypervisor-level", "int",
+                        x86_cpuid_get_hv_level,
+                        x86_cpuid_set_hv_level, NULL, NULL, NULL);
 #if !defined(CONFIG_USER_ONLY)
     object_property_add(obj, "hv_spinlocks", "int",
                         x86_get_hv_spinlocks,
-- 
1.7.1

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

* [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |    9 +++++++++
 target-i386/cpu.h |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 451de12..48bdaf9 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
 }
 
 #if !defined(CONFIG_USER_ONLY)
+static void x86_set_hyperv(Object *obj, Error **errp)
+{
+    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
+                            "hypervisor-level", errp);
+}
+
 static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
                                  const char *name, Error **errp)
 {
@@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
         return;
     }
     hyperv_set_spinlock_retries(value);
+    x86_set_hyperv(obj, errp);
 }
 
 static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
@@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
         return;
     }
     hyperv_enable_relaxed_timing(value);
+    x86_set_hyperv(obj, errp);
 }
 
 static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
@@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
         return;
     }
     hyperv_enable_vapic_recommended(value);
+    x86_set_hyperv(obj, errp);
 }
 #endif
 
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 1899f69..3152a4e 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -488,6 +488,8 @@
 
 #define CPUID_VENDOR_VIA   "CentaurHauls"
 
+#define CPUID_HV_LEVEL_HYPERV  0x40000005
+
 #define CPUID_MWAIT_IBE     (1 << 1) /* Interrupts can exit capability */
 #define CPUID_MWAIT_EMX     (1 << 0) /* enumeration supported */
 
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |    9 +++++++++
 target-i386/cpu.h |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 451de12..48bdaf9 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
 }
 
 #if !defined(CONFIG_USER_ONLY)
+static void x86_set_hyperv(Object *obj, Error **errp)
+{
+    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
+                            "hypervisor-level", errp);
+}
+
 static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
                                  const char *name, Error **errp)
 {
@@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
         return;
     }
     hyperv_set_spinlock_retries(value);
+    x86_set_hyperv(obj, errp);
 }
 
 static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
@@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
         return;
     }
     hyperv_enable_relaxed_timing(value);
+    x86_set_hyperv(obj, errp);
 }
 
 static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
@@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
         return;
     }
     hyperv_enable_vapic_recommended(value);
+    x86_set_hyperv(obj, errp);
 }
 #endif
 
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 1899f69..3152a4e 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -488,6 +488,8 @@
 
 #define CPUID_VENDOR_VIA   "CentaurHauls"
 
+#define CPUID_HV_LEVEL_HYPERV  0x40000005
+
 #define CPUID_MWAIT_IBE     (1 << 1) /* Interrupts can exit capability */
 #define CPUID_MWAIT_EMX     (1 << 0) /* enumeration supported */
 
-- 
1.7.1

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

* [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization level.

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/kvm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 895d848..8462c75 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     c = &cpuid_data.entries[cpuid_i++];
     memset(c, 0, sizeof(*c));
     c->function = KVM_CPUID_SIGNATURE;
-    if (!hyperv_enabled()) {
+    if (!env->cpuid_hv_level_set) {
         memcpy(signature, "KVMKVMKVM\0\0\0", 12);
         c->eax = 0;
     } else {
         memcpy(signature, "Microsoft Hv", 12);
-        c->eax = HYPERV_CPUID_MIN;
+        c->eax = env->cpuid_hv_level;
     }
     c->ebx = signature[0];
     c->ecx = signature[1];
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization level.

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/kvm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 895d848..8462c75 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     c = &cpuid_data.entries[cpuid_i++];
     memset(c, 0, sizeof(*c));
     c->function = KVM_CPUID_SIGNATURE;
-    if (!hyperv_enabled()) {
+    if (!env->cpuid_hv_level_set) {
         memcpy(signature, "KVMKVMKVM\0\0\0", 12);
         c->eax = 0;
     } else {
         memcpy(signature, "Microsoft Hv", 12);
-        c->eax = HYPERV_CPUID_MIN;
+        c->eax = env->cpuid_hv_level;
     }
     c->ebx = signature[0];
     c->ecx = signature[1];
-- 
1.7.1

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

* [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc,accel=tcg.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization level.

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

QEMU knows this as KVM_CPUID_SIGNATURE (0x40000000) in kvm on linux.

This does not provide vendor support in tcg yet.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 48bdaf9..920278b 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1651,6 +1651,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
                 index =  env->cpuid_xlevel;
             }
         }
+    } else if (index & 0x40000000) {
+        if (env->cpuid_hv_level_set) {
+            uint32_t real_level = env->cpuid_hv_level;
+
+            /* Handle Hypervisor CPUIDs */
+            if (real_level < 0x40000000) {
+                real_level = 0x40000000;
+            }
+            if (index > real_level) {
+                index = real_level;
+            }
+        } else {
+            if (index > env->cpuid_level)
+                index = env->cpuid_level;
+        }
     } else {
         if (index > env->cpuid_level)
             index = env->cpuid_level;
@@ -1789,6 +1804,18 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
             *edx = 0;
         }
         break;
+    case 0x40000000:
+        *eax = env->cpuid_hv_level;
+        *ebx = 0;
+        *ecx = 0;
+        *edx = 0;
+        break;
+    case 0x40000001:
+        *eax = env->cpuid_kvm_features;
+        *ebx = 0;
+        *ecx = 0;
+        *edx = 0;
+        break;
     case 0x80000000:
         *eax = env->cpuid_xlevel;
         *ebx = env->cpuid_vendor1;
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc, accel=tcg.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization level.

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

QEMU knows this as KVM_CPUID_SIGNATURE (0x40000000) in kvm on linux.

This does not provide vendor support in tcg yet.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 48bdaf9..920278b 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1651,6 +1651,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
                 index =  env->cpuid_xlevel;
             }
         }
+    } else if (index & 0x40000000) {
+        if (env->cpuid_hv_level_set) {
+            uint32_t real_level = env->cpuid_hv_level;
+
+            /* Handle Hypervisor CPUIDs */
+            if (real_level < 0x40000000) {
+                real_level = 0x40000000;
+            }
+            if (index > real_level) {
+                index = real_level;
+            }
+        } else {
+            if (index > env->cpuid_level)
+                index = env->cpuid_level;
+        }
     } else {
         if (index > env->cpuid_level)
             index = env->cpuid_level;
@@ -1789,6 +1804,18 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
             *edx = 0;
         }
         break;
+    case 0x40000000:
+        *eax = env->cpuid_hv_level;
+        *ebx = 0;
+        *ecx = 0;
+        *edx = 0;
+        break;
+    case 0x40000001:
+        *eax = env->cpuid_kvm_features;
+        *ebx = 0;
+        *ecx = 0;
+        *edx = 0;
+        break;
     case 0x80000000:
         *eax = env->cpuid_xlevel;
         *ebx = env->cpuid_vendor1;
-- 
1.7.1

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

* [PATCH v6 07/16] target-i386: Add Hypervisor vendor.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization vendor.
This is EBX, ECX, EDX data for 0x40000000.

QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).

This is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 3152a4e..11730b2 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -780,6 +780,7 @@ typedef struct CPUX86State {
     uint32_t cpuid_apic_id;
     bool cpuid_vendor_override;
     bool cpuid_hv_level_set;
+    bool cpuid_hv_vendor_set;
     /* Store the results of Centaur's CPUID instructions */
     uint32_t cpuid_xlevel2;
     uint32_t cpuid_ext4_features;
@@ -787,6 +788,9 @@ typedef struct CPUX86State {
     uint32_t cpuid_7_0_ebx;
     /* Hypervisor CPUIDs */
     uint32_t cpuid_hv_level;
+    uint32_t cpuid_hv_vendor1;
+    uint32_t cpuid_hv_vendor2;
+    uint32_t cpuid_hv_vendor3;
 
     /* MTRRs */
     uint64_t mtrr_fixed[11];
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 07/16] target-i386: Add Hypervisor vendor.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization vendor.
This is EBX, ECX, EDX data for 0x40000000.

QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).

This is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 3152a4e..11730b2 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -780,6 +780,7 @@ typedef struct CPUX86State {
     uint32_t cpuid_apic_id;
     bool cpuid_vendor_override;
     bool cpuid_hv_level_set;
+    bool cpuid_hv_vendor_set;
     /* Store the results of Centaur's CPUID instructions */
     uint32_t cpuid_xlevel2;
     uint32_t cpuid_ext4_features;
@@ -787,6 +788,9 @@ typedef struct CPUX86State {
     uint32_t cpuid_7_0_ebx;
     /* Hypervisor CPUIDs */
     uint32_t cpuid_hv_level;
+    uint32_t cpuid_hv_vendor1;
+    uint32_t cpuid_hv_vendor2;
+    uint32_t cpuid_hv_vendor3;
 
     /* MTRRs */
     uint64_t mtrr_fixed[11];
-- 
1.7.1

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

* [PATCH v6 08/16] target-i386: Add cpu object access routines for Hypervisor vendor.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

These are modeled after x86_cpuid_set_vendor and x86_cpuid_get_vendor.
Since kvm's vendor is shorter, the test for correct size is removed and zero padding is added.

Set Microsoft's Vendor now that we can.  Value defined in:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
And matches want is in target-i386/kvm.c

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 target-i386/cpu.h |    2 ++
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 920278b..964877f 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1192,11 +1192,54 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
     cpu->env.cpuid_hv_level_set = true;
 }
 
+static char *x86_cpuid_get_hv_vendor(Object *obj, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    CPUX86State *env = &cpu->env;
+    char *value;
+    int i;
+
+    value = (char *)g_malloc(CPUID_VENDOR_SZ + 1);
+    for (i = 0; i < 4; i++) {
+        value[i + 0] = env->cpuid_hv_vendor1 >> (8 * i);
+        value[i + 4] = env->cpuid_hv_vendor2 >> (8 * i);
+        value[i + 8] = env->cpuid_hv_vendor3 >> (8 * i);
+    }
+    value[CPUID_VENDOR_SZ] = '\0';
+
+    return value;
+}
+
+static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
+                                    Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    CPUX86State *env = &cpu->env;
+    int i;
+    char adj_value[CPUID_VENDOR_SZ + 1];
+
+    memset(adj_value, 0, sizeof(adj_value));
+
+    pstrcpy(adj_value, sizeof(adj_value), value);
+
+    env->cpuid_hv_vendor1 = 0;
+    env->cpuid_hv_vendor2 = 0;
+    env->cpuid_hv_vendor3 = 0;
+    for (i = 0; i < 4; i++) {
+        env->cpuid_hv_vendor1 |= ((uint8_t)adj_value[i + 0]) << (8 * i);
+        env->cpuid_hv_vendor2 |= ((uint8_t)adj_value[i + 4]) << (8 * i);
+        env->cpuid_hv_vendor3 |= ((uint8_t)adj_value[i + 8]) << (8 * i);
+    }
+    env->cpuid_hv_vendor_set = true;
+}
+
 #if !defined(CONFIG_USER_ONLY)
 static void x86_set_hyperv(Object *obj, Error **errp)
 {
     object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
                             "hypervisor-level", errp);
+    object_property_set_str(obj, CPUID_HV_VENDOR_HYPERV,
+                            "hypervisor-vendor", errp);
 }
 
 static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
@@ -2126,6 +2169,9 @@ static void x86_cpu_initfn(Object *obj)
     object_property_add(obj, "hypervisor-level", "int",
                         x86_cpuid_get_hv_level,
                         x86_cpuid_set_hv_level, NULL, NULL, NULL);
+    object_property_add_str(obj, "hypervisor-vendor",
+                            x86_cpuid_get_hv_vendor,
+                            x86_cpuid_set_hv_vendor, NULL);
 #if !defined(CONFIG_USER_ONLY)
     object_property_add(obj, "hv_spinlocks", "int",
                         x86_get_hv_spinlocks,
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 11730b2..eb6aa4a 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -488,6 +488,8 @@
 
 #define CPUID_VENDOR_VIA   "CentaurHauls"
 
+#define CPUID_HV_VENDOR_HYPERV "Microsoft Hv"
+
 #define CPUID_HV_LEVEL_HYPERV  0x40000005
 
 #define CPUID_MWAIT_IBE     (1 << 1) /* Interrupts can exit capability */
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 08/16] target-i386: Add cpu object access routines for Hypervisor vendor.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

These are modeled after x86_cpuid_set_vendor and x86_cpuid_get_vendor.
Since kvm's vendor is shorter, the test for correct size is removed and zero padding is added.

Set Microsoft's Vendor now that we can.  Value defined in:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
And matches want is in target-i386/kvm.c

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 target-i386/cpu.h |    2 ++
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 920278b..964877f 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1192,11 +1192,54 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
     cpu->env.cpuid_hv_level_set = true;
 }
 
+static char *x86_cpuid_get_hv_vendor(Object *obj, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    CPUX86State *env = &cpu->env;
+    char *value;
+    int i;
+
+    value = (char *)g_malloc(CPUID_VENDOR_SZ + 1);
+    for (i = 0; i < 4; i++) {
+        value[i + 0] = env->cpuid_hv_vendor1 >> (8 * i);
+        value[i + 4] = env->cpuid_hv_vendor2 >> (8 * i);
+        value[i + 8] = env->cpuid_hv_vendor3 >> (8 * i);
+    }
+    value[CPUID_VENDOR_SZ] = '\0';
+
+    return value;
+}
+
+static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
+                                    Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    CPUX86State *env = &cpu->env;
+    int i;
+    char adj_value[CPUID_VENDOR_SZ + 1];
+
+    memset(adj_value, 0, sizeof(adj_value));
+
+    pstrcpy(adj_value, sizeof(adj_value), value);
+
+    env->cpuid_hv_vendor1 = 0;
+    env->cpuid_hv_vendor2 = 0;
+    env->cpuid_hv_vendor3 = 0;
+    for (i = 0; i < 4; i++) {
+        env->cpuid_hv_vendor1 |= ((uint8_t)adj_value[i + 0]) << (8 * i);
+        env->cpuid_hv_vendor2 |= ((uint8_t)adj_value[i + 4]) << (8 * i);
+        env->cpuid_hv_vendor3 |= ((uint8_t)adj_value[i + 8]) << (8 * i);
+    }
+    env->cpuid_hv_vendor_set = true;
+}
+
 #if !defined(CONFIG_USER_ONLY)
 static void x86_set_hyperv(Object *obj, Error **errp)
 {
     object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
                             "hypervisor-level", errp);
+    object_property_set_str(obj, CPUID_HV_VENDOR_HYPERV,
+                            "hypervisor-vendor", errp);
 }
 
 static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
@@ -2126,6 +2169,9 @@ static void x86_cpu_initfn(Object *obj)
     object_property_add(obj, "hypervisor-level", "int",
                         x86_cpuid_get_hv_level,
                         x86_cpuid_set_hv_level, NULL, NULL, NULL);
+    object_property_add_str(obj, "hypervisor-vendor",
+                            x86_cpuid_get_hv_vendor,
+                            x86_cpuid_set_hv_vendor, NULL);
 #if !defined(CONFIG_USER_ONLY)
     object_property_add(obj, "hv_spinlocks", "int",
                         x86_get_hv_spinlocks,
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 11730b2..eb6aa4a 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -488,6 +488,8 @@
 
 #define CPUID_VENDOR_VIA   "CentaurHauls"
 
+#define CPUID_HV_VENDOR_HYPERV "Microsoft Hv"
+
 #define CPUID_HV_LEVEL_HYPERV  0x40000005
 
 #define CPUID_MWAIT_IBE     (1 << 1) /* Interrupts can exit capability */
-- 
1.7.1

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

* [PATCH v6 09/16] target-i386: Use Hypervisor vendor in -machine pc,accel=kvm.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization vendor.

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/kvm.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 8462c75..f8a5177 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -389,16 +389,18 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     c = &cpuid_data.entries[cpuid_i++];
     memset(c, 0, sizeof(*c));
     c->function = KVM_CPUID_SIGNATURE;
-    if (!env->cpuid_hv_level_set) {
+    if (!env->cpuid_hv_level_set && !env->cpuid_hv_vendor_set) {
         memcpy(signature, "KVMKVMKVM\0\0\0", 12);
         c->eax = 0;
+        c->ebx = signature[0];
+        c->ecx = signature[1];
+        c->edx = signature[2];
     } else {
-        memcpy(signature, "Microsoft Hv", 12);
         c->eax = env->cpuid_hv_level;
+        c->ebx = env->cpuid_hv_vendor1;
+        c->ecx = env->cpuid_hv_vendor2;
+        c->edx = env->cpuid_hv_vendor3;
     }
-    c->ebx = signature[0];
-    c->ecx = signature[1];
-    c->edx = signature[2];
 
     c = &cpuid_data.entries[cpuid_i++];
     memset(c, 0, sizeof(*c));
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 09/16] target-i386: Use Hypervisor vendor in -machine pc, accel=kvm.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization vendor.

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/kvm.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 8462c75..f8a5177 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -389,16 +389,18 @@ int kvm_arch_init_vcpu(CPUX86State *env)
     c = &cpuid_data.entries[cpuid_i++];
     memset(c, 0, sizeof(*c));
     c->function = KVM_CPUID_SIGNATURE;
-    if (!env->cpuid_hv_level_set) {
+    if (!env->cpuid_hv_level_set && !env->cpuid_hv_vendor_set) {
         memcpy(signature, "KVMKVMKVM\0\0\0", 12);
         c->eax = 0;
+        c->ebx = signature[0];
+        c->ecx = signature[1];
+        c->edx = signature[2];
     } else {
-        memcpy(signature, "Microsoft Hv", 12);
         c->eax = env->cpuid_hv_level;
+        c->ebx = env->cpuid_hv_vendor1;
+        c->ecx = env->cpuid_hv_vendor2;
+        c->edx = env->cpuid_hv_vendor3;
     }
-    c->ebx = signature[0];
-    c->ecx = signature[1];
-    c->edx = signature[2];
 
     c = &cpuid_data.entries[cpuid_i++];
     memset(c, 0, sizeof(*c));
-- 
1.7.1

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

* [PATCH v6 10/16] target-i386: Use Hypervisor vendor in -machine pc,accel=tcg.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization vendor.

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
This is where the 0 is the same as 0x40000001 is defined.

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 964877f..a929b64 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1695,7 +1695,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
             }
         }
     } else if (index & 0x40000000) {
-        if (env->cpuid_hv_level_set) {
+        if (env->cpuid_hv_level_set || env->cpuid_hv_vendor_set) {
             uint32_t real_level = env->cpuid_hv_level;
 
             /* Handle Hypervisor CPUIDs */
@@ -1849,9 +1849,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         break;
     case 0x40000000:
         *eax = env->cpuid_hv_level;
-        *ebx = 0;
-        *ecx = 0;
-        *edx = 0;
+        *ebx = env->cpuid_hv_vendor1;
+        *ecx = env->cpuid_hv_vendor2;
+        *edx = env->cpuid_hv_vendor3;
         break;
     case 0x40000001:
         *eax = env->cpuid_kvm_features;
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 10/16] target-i386: Use Hypervisor vendor in -machine pc, accel=tcg.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Also known as Paravirtualization vendor.

This change is based on:

Microsoft Hypervisor CPUID Leaves:
  http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

Linux kernel change starts with:
  http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
Also:
  http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
This is where the 0 is the same as 0x40000001 is defined.

VMware documention on CPUIDs (Mechanisms to determine if software is
running in a VMware virtual machine):
  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 964877f..a929b64 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1695,7 +1695,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
             }
         }
     } else if (index & 0x40000000) {
-        if (env->cpuid_hv_level_set) {
+        if (env->cpuid_hv_level_set || env->cpuid_hv_vendor_set) {
             uint32_t real_level = env->cpuid_hv_level;
 
             /* Handle Hypervisor CPUIDs */
@@ -1849,9 +1849,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         break;
     case 0x40000000:
         *eax = env->cpuid_hv_level;
-        *ebx = 0;
-        *ecx = 0;
-        *edx = 0;
+        *ebx = env->cpuid_hv_vendor1;
+        *ecx = env->cpuid_hv_vendor2;
+        *edx = env->cpuid_hv_vendor3;
         break;
     case 0x40000001:
         *eax = env->cpuid_kvm_features;
-- 
1.7.1

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

* [PATCH v6 11/16] target-i386: Add some known names to Hypervisor vendor.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 target-i386/cpu.h |   19 +++++++++++++++++
 2 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index a929b64..9ab29a7 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1207,6 +1207,24 @@ static char *x86_cpuid_get_hv_vendor(Object *obj, Error **errp)
     }
     value[CPUID_VENDOR_SZ] = '\0';
 
+    /* Convert known names */
+    if (!strcmp(value, CPUID_HV_VENDOR_HYPERV) &&
+               env->cpuid_hv_level == CPUID_HV_LEVEL_HYPERV) {
+        pstrcpy(value, sizeof(value), "hyperv");
+    } else if (!strcmp(value, CPUID_HV_VENDOR_VMWARE)) {
+        if (env->cpuid_hv_level == CPUID_HV_LEVEL_VMWARE_4) {
+            pstrcpy(value, sizeof(value), "vmware4");
+        } else if (env->cpuid_hv_level == CPUID_HV_LEVEL_VMWARE_3) {
+            pstrcpy(value, sizeof(value), "vmware3");
+        }
+    } else if (!strcmp(value, CPUID_HV_VENDOR_XEN) &&
+               env->cpuid_hv_level == CPUID_HV_LEVEL_XEN) {
+        pstrcpy(value, sizeof(value), "xen");
+    } else if (!strcmp(value, CPUID_HV_VENDOR_KVM) &&
+               (env->cpuid_hv_level == 0 ||
+                env->cpuid_hv_level == CPUID_HV_LEVEL_KVM)) {
+        pstrcpy(value, sizeof(value), "kvm");
+    }
     return value;
 }
 
@@ -1220,7 +1238,35 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
 
     memset(adj_value, 0, sizeof(adj_value));
 
-    pstrcpy(adj_value, sizeof(adj_value), value);
+    /* Convert known names */
+    if (!strcmp(value, "hyperv")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_HYPERV;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_HYPERV);
+    } else if (!strcmp(value, "vmware") || !strcmp(value, "vmware4")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_VMWARE_4;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_VMWARE);
+    } else if (!strcmp(value, "vmware3")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_VMWARE_3;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_VMWARE);
+    } else if (!strcmp(value, "xen")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_XEN;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_XEN);
+    } else if (!strcmp(value, "kvm")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_KVM;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_KVM);
+    } else {
+        pstrcpy(adj_value, sizeof(adj_value), value);
+    }
 
     env->cpuid_hv_vendor1 = 0;
     env->cpuid_hv_vendor2 = 0;
@@ -1700,7 +1746,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
 
             /* Handle Hypervisor CPUIDs */
             if (real_level < 0x40000000) {
-                real_level = 0x40000000;
+                if (env->cpuid_hv_vendor1 == CPUID_HV_VENDOR_KVM_1 &&
+                    env->cpuid_hv_vendor2 == CPUID_HV_VENDOR_KVM_2 &&
+                    env->cpuid_hv_vendor3 == CPUID_HV_VENDOR_KVM_3 &&
+                    real_level == 0) {
+                    real_level = CPUID_HV_LEVEL_KVM;
+                } else {
+                    real_level = 0x40000000;
+                }
             }
             if (index > real_level) {
                 index = real_level;
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index eb6aa4a..ebb3498 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -490,8 +490,27 @@
 
 #define CPUID_HV_VENDOR_HYPERV "Microsoft Hv"
 
+#define CPUID_HV_VENDOR_VMWARE_1 0x61774d56 /* "VMwa" */
+#define CPUID_HV_VENDOR_VMWARE_2 0x4d566572 /* "reVM" */
+#define CPUID_HV_VENDOR_VMWARE_3 0x65726177 /* "ware" */
+#define CPUID_HV_VENDOR_VMWARE "VMwareVMware"
+
+#define CPUID_HV_VENDOR_XEN "XenVMMXenVMM"
+
+#define CPUID_HV_VENDOR_KVM_1 0x4b4d564b /* "KVMK" */
+#define CPUID_HV_VENDOR_KVM_2 0x564b4d56 /* "VMKV" */
+#define CPUID_HV_VENDOR_KVM_3 0x0000004d /* "M\0\0\0" */
+#define CPUID_HV_VENDOR_KVM "KVMKVMKVM"
+
 #define CPUID_HV_LEVEL_HYPERV  0x40000005
 
+#define CPUID_HV_LEVEL_VMWARE_3 0x40000002
+#define CPUID_HV_LEVEL_VMWARE_4 0x40000010
+
+#define CPUID_HV_LEVEL_XEN  0x40000002
+
+#define CPUID_HV_LEVEL_KVM  0x40000001
+
 #define CPUID_MWAIT_IBE     (1 << 1) /* Interrupts can exit capability */
 #define CPUID_MWAIT_EMX     (1 << 0) /* enumeration supported */
 
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 11/16] target-i386: Add some known names to Hypervisor vendor.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 target-i386/cpu.h |   19 +++++++++++++++++
 2 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index a929b64..9ab29a7 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1207,6 +1207,24 @@ static char *x86_cpuid_get_hv_vendor(Object *obj, Error **errp)
     }
     value[CPUID_VENDOR_SZ] = '\0';
 
+    /* Convert known names */
+    if (!strcmp(value, CPUID_HV_VENDOR_HYPERV) &&
+               env->cpuid_hv_level == CPUID_HV_LEVEL_HYPERV) {
+        pstrcpy(value, sizeof(value), "hyperv");
+    } else if (!strcmp(value, CPUID_HV_VENDOR_VMWARE)) {
+        if (env->cpuid_hv_level == CPUID_HV_LEVEL_VMWARE_4) {
+            pstrcpy(value, sizeof(value), "vmware4");
+        } else if (env->cpuid_hv_level == CPUID_HV_LEVEL_VMWARE_3) {
+            pstrcpy(value, sizeof(value), "vmware3");
+        }
+    } else if (!strcmp(value, CPUID_HV_VENDOR_XEN) &&
+               env->cpuid_hv_level == CPUID_HV_LEVEL_XEN) {
+        pstrcpy(value, sizeof(value), "xen");
+    } else if (!strcmp(value, CPUID_HV_VENDOR_KVM) &&
+               (env->cpuid_hv_level == 0 ||
+                env->cpuid_hv_level == CPUID_HV_LEVEL_KVM)) {
+        pstrcpy(value, sizeof(value), "kvm");
+    }
     return value;
 }
 
@@ -1220,7 +1238,35 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
 
     memset(adj_value, 0, sizeof(adj_value));
 
-    pstrcpy(adj_value, sizeof(adj_value), value);
+    /* Convert known names */
+    if (!strcmp(value, "hyperv")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_HYPERV;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_HYPERV);
+    } else if (!strcmp(value, "vmware") || !strcmp(value, "vmware4")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_VMWARE_4;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_VMWARE);
+    } else if (!strcmp(value, "vmware3")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_VMWARE_3;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_VMWARE);
+    } else if (!strcmp(value, "xen")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_XEN;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_XEN);
+    } else if (!strcmp(value, "kvm")) {
+        if (!env->cpuid_hv_level_set) {
+            env->cpuid_hv_level = CPUID_HV_LEVEL_KVM;
+        }
+        pstrcpy(adj_value, sizeof(adj_value), CPUID_HV_VENDOR_KVM);
+    } else {
+        pstrcpy(adj_value, sizeof(adj_value), value);
+    }
 
     env->cpuid_hv_vendor1 = 0;
     env->cpuid_hv_vendor2 = 0;
@@ -1700,7 +1746,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
 
             /* Handle Hypervisor CPUIDs */
             if (real_level < 0x40000000) {
-                real_level = 0x40000000;
+                if (env->cpuid_hv_vendor1 == CPUID_HV_VENDOR_KVM_1 &&
+                    env->cpuid_hv_vendor2 == CPUID_HV_VENDOR_KVM_2 &&
+                    env->cpuid_hv_vendor3 == CPUID_HV_VENDOR_KVM_3 &&
+                    real_level == 0) {
+                    real_level = CPUID_HV_LEVEL_KVM;
+                } else {
+                    real_level = 0x40000000;
+                }
             }
             if (index > real_level) {
                 index = real_level;
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index eb6aa4a..ebb3498 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -490,8 +490,27 @@
 
 #define CPUID_HV_VENDOR_HYPERV "Microsoft Hv"
 
+#define CPUID_HV_VENDOR_VMWARE_1 0x61774d56 /* "VMwa" */
+#define CPUID_HV_VENDOR_VMWARE_2 0x4d566572 /* "reVM" */
+#define CPUID_HV_VENDOR_VMWARE_3 0x65726177 /* "ware" */
+#define CPUID_HV_VENDOR_VMWARE "VMwareVMware"
+
+#define CPUID_HV_VENDOR_XEN "XenVMMXenVMM"
+
+#define CPUID_HV_VENDOR_KVM_1 0x4b4d564b /* "KVMK" */
+#define CPUID_HV_VENDOR_KVM_2 0x564b4d56 /* "VMKV" */
+#define CPUID_HV_VENDOR_KVM_3 0x0000004d /* "M\0\0\0" */
+#define CPUID_HV_VENDOR_KVM "KVMKVMKVM"
+
 #define CPUID_HV_LEVEL_HYPERV  0x40000005
 
+#define CPUID_HV_LEVEL_VMWARE_3 0x40000002
+#define CPUID_HV_LEVEL_VMWARE_4 0x40000010
+
+#define CPUID_HV_LEVEL_XEN  0x40000002
+
+#define CPUID_HV_LEVEL_KVM  0x40000001
+
 #define CPUID_MWAIT_IBE     (1 << 1) /* Interrupts can exit capability */
 #define CPUID_MWAIT_EMX     (1 << 0) /* enumeration supported */
 
-- 
1.7.1

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

* [PATCH v6 12/16] target-i386: Add optional Hypervisor leaf extra.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index ebb3498..254ddef 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -812,6 +812,10 @@ typedef struct CPUX86State {
     uint32_t cpuid_hv_vendor1;
     uint32_t cpuid_hv_vendor2;
     uint32_t cpuid_hv_vendor3;
+    /* VMware extra data */
+    uint32_t cpuid_hv_extra;
+    uint32_t cpuid_hv_extra_a;
+    uint32_t cpuid_hv_extra_b;
 
     /* MTRRs */
     uint64_t mtrr_fixed[11];
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 12/16] target-i386: Add optional Hypervisor leaf extra.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index ebb3498..254ddef 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -812,6 +812,10 @@ typedef struct CPUX86State {
     uint32_t cpuid_hv_vendor1;
     uint32_t cpuid_hv_vendor2;
     uint32_t cpuid_hv_vendor3;
+    /* VMware extra data */
+    uint32_t cpuid_hv_extra;
+    uint32_t cpuid_hv_extra_a;
+    uint32_t cpuid_hv_extra_b;
 
     /* MTRRs */
     uint64_t mtrr_fixed[11];
-- 
1.7.1

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

* [PATCH v6 13/16] target-i386: Add cpu object access routines for Hypervisor leaf extra.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   66 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 9ab29a7..8bb20c7 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1279,6 +1279,63 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
     env->cpuid_hv_vendor_set = true;
 }
 
+static void x86_cpuid_get_hv_extra(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra, name, errp);
+}
+
+static void x86_cpuid_set_hv_extra(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    uint32_t value;
+
+    visit_type_uint32(v, &value, name, errp);
+    if (error_is_set(errp)) {
+        return;
+    }
+
+    if ((value != 0) && (value < 0x40000000)) {
+        value += 0x40000000;
+    }
+    cpu->env.cpuid_hv_extra = value;
+}
+
+static void x86_cpuid_get_hv_extra_a(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra_a, name, errp);
+}
+
+static void x86_cpuid_set_hv_extra_a(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra_a, name, errp);
+}
+
+static void x86_cpuid_get_hv_extra_b(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra_b, name, errp);
+}
+
+static void x86_cpuid_set_hv_extra_b(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra_b, name, errp);
+}
+
 #if !defined(CONFIG_USER_ONLY)
 static void x86_set_hyperv(Object *obj, Error **errp)
 {
@@ -2225,6 +2282,15 @@ static void x86_cpu_initfn(Object *obj)
     object_property_add_str(obj, "hypervisor-vendor",
                             x86_cpuid_get_hv_vendor,
                             x86_cpuid_set_hv_vendor, NULL);
+    object_property_add(obj, "hypervisor-extra", "int",
+                        x86_cpuid_get_hv_extra,
+                        x86_cpuid_set_hv_extra, NULL, NULL, NULL);
+    object_property_add(obj, "hypervisor-extra-a", "int",
+                        x86_cpuid_get_hv_extra_a,
+                        x86_cpuid_set_hv_extra_a, NULL, NULL, NULL);
+    object_property_add(obj, "hypervisor-extra-b", "int",
+                        x86_cpuid_get_hv_extra_b,
+                        x86_cpuid_set_hv_extra_b, NULL, NULL, NULL);
 #if !defined(CONFIG_USER_ONLY)
     object_property_add(obj, "hv_spinlocks", "int",
                         x86_get_hv_spinlocks,
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 13/16] target-i386: Add cpu object access routines for Hypervisor leaf extra.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   66 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 9ab29a7..8bb20c7 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1279,6 +1279,63 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
     env->cpuid_hv_vendor_set = true;
 }
 
+static void x86_cpuid_get_hv_extra(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra, name, errp);
+}
+
+static void x86_cpuid_set_hv_extra(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+    uint32_t value;
+
+    visit_type_uint32(v, &value, name, errp);
+    if (error_is_set(errp)) {
+        return;
+    }
+
+    if ((value != 0) && (value < 0x40000000)) {
+        value += 0x40000000;
+    }
+    cpu->env.cpuid_hv_extra = value;
+}
+
+static void x86_cpuid_get_hv_extra_a(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra_a, name, errp);
+}
+
+static void x86_cpuid_set_hv_extra_a(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra_a, name, errp);
+}
+
+static void x86_cpuid_get_hv_extra_b(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra_b, name, errp);
+}
+
+static void x86_cpuid_set_hv_extra_b(Object *obj, Visitor *v, void *opaque,
+                                const char *name, Error **errp)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    visit_type_uint32(v, &cpu->env.cpuid_hv_extra_b, name, errp);
+}
+
 #if !defined(CONFIG_USER_ONLY)
 static void x86_set_hyperv(Object *obj, Error **errp)
 {
@@ -2225,6 +2282,15 @@ static void x86_cpu_initfn(Object *obj)
     object_property_add_str(obj, "hypervisor-vendor",
                             x86_cpuid_get_hv_vendor,
                             x86_cpuid_set_hv_vendor, NULL);
+    object_property_add(obj, "hypervisor-extra", "int",
+                        x86_cpuid_get_hv_extra,
+                        x86_cpuid_set_hv_extra, NULL, NULL, NULL);
+    object_property_add(obj, "hypervisor-extra-a", "int",
+                        x86_cpuid_get_hv_extra_a,
+                        x86_cpuid_set_hv_extra_a, NULL, NULL, NULL);
+    object_property_add(obj, "hypervisor-extra-b", "int",
+                        x86_cpuid_get_hv_extra_b,
+                        x86_cpuid_set_hv_extra_b, NULL, NULL, NULL);
 #if !defined(CONFIG_USER_ONLY)
     object_property_add(obj, "hv_spinlocks", "int",
                         x86_get_hv_spinlocks,
-- 
1.7.1

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

* [PATCH v6 14/16] target-i386: Add setting of Hypervisor leaf extra for known vmare4.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

This was taken from:
  http://article.gmane.org/gmane.comp.emulators.kvm.devel/22643

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 8bb20c7..b77dbfe 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1135,6 +1135,36 @@ static void x86_cpuid_set_model_id(Object *obj, const char *model_id,
     }
 }
 
+static void x86_cpuid_set_vmware_extra(Object *obj)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    if ((cpu->env.tsc_khz != 0) &&
+        (cpu->env.cpuid_hv_level == CPUID_HV_LEVEL_VMWARE_4) &&
+        (cpu->env.cpuid_hv_vendor1 == CPUID_HV_VENDOR_VMWARE_1) &&
+        (cpu->env.cpuid_hv_vendor2 == CPUID_HV_VENDOR_VMWARE_2) &&
+        (cpu->env.cpuid_hv_vendor3 == CPUID_HV_VENDOR_VMWARE_3)) {
+        const uint32_t apic_khz = 1000000L;
+
+        /*
+         * From article.gmane.org/gmane.comp.emulators.kvm.devel/22643
+         *
+         *    Leaf 0x40000010, Timing Information.
+         *
+         *    VMware has defined the first generic leaf to provide timing
+         *    information.  This leaf returns the current TSC frequency and
+         *    current Bus frequency in kHz.
+         *
+         *    # EAX: (Virtual) TSC frequency in kHz.
+         *    # EBX: (Virtual) Bus (local apic timer) frequency in kHz.
+         *    # ECX, EDX: RESERVED (Per above, reserved fields are set to zero).
+         */
+        cpu->env.cpuid_hv_extra = 0x40000010;
+        cpu->env.cpuid_hv_extra_a = (uint32_t)cpu->env.tsc_khz;
+        cpu->env.cpuid_hv_extra_b = apic_khz;
+    }
+}
+
 static void x86_cpuid_get_tsc_freq(Object *obj, Visitor *v, void *opaque,
                                    const char *name, Error **errp)
 {
@@ -1164,6 +1194,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
     }
 
     cpu->env.tsc_khz = value / 1000;
+    x86_cpuid_set_vmware_extra(obj);
 }
 
 static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
@@ -1277,6 +1308,7 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
         env->cpuid_hv_vendor3 |= ((uint8_t)adj_value[i + 8]) << (8 * i);
     }
     env->cpuid_hv_vendor_set = true;
+    x86_cpuid_set_vmware_extra(obj);
 }
 
 static void x86_cpuid_get_hv_extra(Object *obj, Visitor *v, void *opaque,
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 14/16] target-i386: Add setting of Hypervisor leaf extra for known vmare4.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

This was taken from:
  http://article.gmane.org/gmane.comp.emulators.kvm.devel/22643

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 8bb20c7..b77dbfe 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1135,6 +1135,36 @@ static void x86_cpuid_set_model_id(Object *obj, const char *model_id,
     }
 }
 
+static void x86_cpuid_set_vmware_extra(Object *obj)
+{
+    X86CPU *cpu = X86_CPU(obj);
+
+    if ((cpu->env.tsc_khz != 0) &&
+        (cpu->env.cpuid_hv_level == CPUID_HV_LEVEL_VMWARE_4) &&
+        (cpu->env.cpuid_hv_vendor1 == CPUID_HV_VENDOR_VMWARE_1) &&
+        (cpu->env.cpuid_hv_vendor2 == CPUID_HV_VENDOR_VMWARE_2) &&
+        (cpu->env.cpuid_hv_vendor3 == CPUID_HV_VENDOR_VMWARE_3)) {
+        const uint32_t apic_khz = 1000000L;
+
+        /*
+         * From article.gmane.org/gmane.comp.emulators.kvm.devel/22643
+         *
+         *    Leaf 0x40000010, Timing Information.
+         *
+         *    VMware has defined the first generic leaf to provide timing
+         *    information.  This leaf returns the current TSC frequency and
+         *    current Bus frequency in kHz.
+         *
+         *    # EAX: (Virtual) TSC frequency in kHz.
+         *    # EBX: (Virtual) Bus (local apic timer) frequency in kHz.
+         *    # ECX, EDX: RESERVED (Per above, reserved fields are set to zero).
+         */
+        cpu->env.cpuid_hv_extra = 0x40000010;
+        cpu->env.cpuid_hv_extra_a = (uint32_t)cpu->env.tsc_khz;
+        cpu->env.cpuid_hv_extra_b = apic_khz;
+    }
+}
+
 static void x86_cpuid_get_tsc_freq(Object *obj, Visitor *v, void *opaque,
                                    const char *name, Error **errp)
 {
@@ -1164,6 +1194,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
     }
 
     cpu->env.tsc_khz = value / 1000;
+    x86_cpuid_set_vmware_extra(obj);
 }
 
 static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
@@ -1277,6 +1308,7 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
         env->cpuid_hv_vendor3 |= ((uint8_t)adj_value[i + 8]) << (8 * i);
     }
     env->cpuid_hv_vendor_set = true;
+    x86_cpuid_set_vmware_extra(obj);
 }
 
 static void x86_cpuid_get_hv_extra(Object *obj, Visitor *v, void *opaque,
-- 
1.7.1

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

* [PATCH v6 15/16] target-i386: Use Hypervisor leaf extra in -machine pc,accel=kvm.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/kvm.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index f8a5177..ff82034 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -454,6 +454,25 @@ int kvm_arch_init_vcpu(CPUX86State *env)
         c->ebx = signature[0];
         c->ecx = signature[1];
         c->edx = signature[2];
+    } else if (env->cpuid_hv_extra != 0) {
+        for (i = KVM_CPUID_FEATURES + 1; i <= env->cpuid_hv_level; i++) {
+            c = &cpuid_data.entries[cpuid_i++];
+            memset(c, 0, sizeof(*c));
+            c->function = i;
+            if (i == env->cpuid_hv_extra) {
+                c->eax = env->cpuid_hv_extra_a;
+                c->ebx = env->cpuid_hv_extra_b;
+            }
+        }
+
+        c = &cpuid_data.entries[cpuid_i++];
+        memset(c, 0, sizeof(*c));
+        c->function = KVM_CPUID_SIGNATURE_NEXT;
+        memcpy(signature, "KVMKVMKVM\0\0\0", 12);
+        c->eax = 0;
+        c->ebx = signature[0];
+        c->ecx = signature[1];
+        c->edx = signature[2];
     }
 
     has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 15/16] target-i386: Use Hypervisor leaf extra in -machine pc, accel=kvm.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/kvm.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index f8a5177..ff82034 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -454,6 +454,25 @@ int kvm_arch_init_vcpu(CPUX86State *env)
         c->ebx = signature[0];
         c->ecx = signature[1];
         c->edx = signature[2];
+    } else if (env->cpuid_hv_extra != 0) {
+        for (i = KVM_CPUID_FEATURES + 1; i <= env->cpuid_hv_level; i++) {
+            c = &cpuid_data.entries[cpuid_i++];
+            memset(c, 0, sizeof(*c));
+            c->function = i;
+            if (i == env->cpuid_hv_extra) {
+                c->eax = env->cpuid_hv_extra_a;
+                c->ebx = env->cpuid_hv_extra_b;
+            }
+        }
+
+        c = &cpuid_data.entries[cpuid_i++];
+        memset(c, 0, sizeof(*c));
+        c->function = KVM_CPUID_SIGNATURE_NEXT;
+        memcpy(signature, "KVMKVMKVM\0\0\0", 12);
+        c->eax = 0;
+        c->ebx = signature[0];
+        c->ecx = signature[1];
+        c->edx = signature[2];
     }
 
     has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
-- 
1.7.1

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

* [PATCH v6 16/16] target-i386: Use Hypervisor leaf extra in -machine pc,accel=tcg.
  2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
@ 2012-09-24 14:32   ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index b77dbfe..1d81f00 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2001,6 +2001,17 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         *ecx = 0;
         *edx = 0;
         break;
+    case 0x40000002 ... 0x400000FF:
+        if (index == env->cpuid_hv_extra) {
+            *eax = env->cpuid_hv_extra_a;
+            *ebx = env->cpuid_hv_extra_b;
+        } else {
+            *eax = 0;
+            *ebx = 0;
+        }
+        *ecx = 0;
+        *edx = 0;
+        break;
     case 0x80000000:
         *eax = env->cpuid_xlevel;
         *ebx = env->cpuid_vendor1;
-- 
1.7.1


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

* [Qemu-devel] [PATCH v6 16/16] target-i386: Use Hypervisor leaf extra in -machine pc, accel=tcg.
@ 2012-09-24 14:32   ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-09-24 14:32 UTC (permalink / raw)
  To: qemu-devel, mtosatti, ehabkost, imammedo, avi, afaerber,
	peter.maydell, kvm, anthony
  Cc: Don Slutz

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 target-i386/cpu.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index b77dbfe..1d81f00 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2001,6 +2001,17 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         *ecx = 0;
         *edx = 0;
         break;
+    case 0x40000002 ... 0x400000FF:
+        if (index == env->cpuid_hv_extra) {
+            *eax = env->cpuid_hv_extra_a;
+            *ebx = env->cpuid_hv_extra_b;
+        } else {
+            *eax = 0;
+            *ebx = 0;
+        }
+        *ecx = 0;
+        *edx = 0;
+        break;
     case 0x80000000:
         *eax = env->cpuid_xlevel;
         *ebx = env->cpuid_vendor1;
-- 
1.7.1

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

* Re: [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
  2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
  (?)
@ 2012-10-09 16:25   ` Marcelo Tosatti
  2012-10-09 19:13       ` [Qemu-devel] " Don Slutz
  -1 siblings, 1 reply; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 16:25 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
> These are modeled after x86_cpuid_get_xlevel and x86_cpuid_set_xlevel.
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 25ca986..451de12 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1166,6 +1166,32 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
>      cpu->env.tsc_khz = value / 1000;
>  }
>  
> +static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
> +                                const char *name, Error **errp)
> +{
> +    X86CPU *cpu = X86_CPU(obj);
> +
> +    visit_type_uint32(v, &cpu->env.cpuid_hv_level, name, errp);
> +}
> +
> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
> +                                const char *name, Error **errp)
> +{
> +    X86CPU *cpu = X86_CPU(obj);
> +    uint32_t value;
> +
> +    visit_type_uint32(v, &value, name, errp);
> +    if (error_is_set(errp)) {
> +        return;
> +    }
> +
> +    if (value != 0 && value < 0x40000000) {
> +        value += 0x40000000;
> +    }

Whats the purpose of this? Adds ambiguity.

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

* Re: [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
  2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
  (?)
@ 2012-10-09 16:34   ` Marcelo Tosatti
  2012-10-09 17:17       ` [Qemu-devel] " Marcelo Tosatti
  -1 siblings, 1 reply; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 16:34 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Mon, Sep 24, 2012 at 10:32:06AM -0400, Don Slutz wrote:
> This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |    9 +++++++++
>  target-i386/cpu.h |    2 ++
>  2 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 451de12..48bdaf9 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
>  }
>  
>  #if !defined(CONFIG_USER_ONLY)
> +static void x86_set_hyperv(Object *obj, Error **errp)
> +{
> +    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
> +                            "hypervisor-level", errp);
> +}
> +
>  static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
>                                   const char *name, Error **errp)
>  {
> @@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
>          return;
>      }
>      hyperv_set_spinlock_retries(value);
> +    x86_set_hyperv(obj, errp);
>  }
>  
>  static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> @@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
>          return;
>      }
>      hyperv_enable_relaxed_timing(value);
> +    x86_set_hyperv(obj, errp);
>  }
>  
>  static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
> @@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
>          return;
>      }
>      hyperv_enable_vapic_recommended(value);
> +    x86_set_hyperv(obj, errp);
>  }
>  #endif
>  
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 1899f69..3152a4e 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -488,6 +488,8 @@
>  
>  #define CPUID_VENDOR_VIA   "CentaurHauls"
>  
> +#define CPUID_HV_LEVEL_HYPERV  0x40000005
> +

Where this comes from? 

http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx

has under "Leaf 0x40000000" (at very top of table):

EAX

The maximum input value for hypervisor CPUID information. For Microsoft
hypervisors, this value will be at least 0x40000005. The vendor ID
signature should be used only for reporting and diagnostic purposes.

Is that the same 0x40000005 as in this patch?


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

* Re: [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
  2012-10-09 16:34   ` Marcelo Tosatti
@ 2012-10-09 17:17       ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 17:17 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Tue, Oct 09, 2012 at 01:34:09PM -0300, Marcelo Tosatti wrote:
> On Mon, Sep 24, 2012 at 10:32:06AM -0400, Don Slutz wrote:
> > This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.
> > 
> > Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> > ---
> >  target-i386/cpu.c |    9 +++++++++
> >  target-i386/cpu.h |    2 ++
> >  2 files changed, 11 insertions(+), 0 deletions(-)
> > 
> > diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> > index 451de12..48bdaf9 100644
> > --- a/target-i386/cpu.c
> > +++ b/target-i386/cpu.c
> > @@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
> >  }
> >  
> >  #if !defined(CONFIG_USER_ONLY)
> > +static void x86_set_hyperv(Object *obj, Error **errp)
> > +{
> > +    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
> > +                            "hypervisor-level", errp);
> > +}
> > +
> >  static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> >                                   const char *name, Error **errp)
> >  {
> > @@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> >          return;
> >      }
> >      hyperv_set_spinlock_retries(value);
> > +    x86_set_hyperv(obj, errp);
> >  }
> >  
> >  static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> > @@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> >          return;
> >      }
> >      hyperv_enable_relaxed_timing(value);
> > +    x86_set_hyperv(obj, errp);
> >  }
> >  
> >  static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
> > @@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
> >          return;
> >      }
> >      hyperv_enable_vapic_recommended(value);
> > +    x86_set_hyperv(obj, errp);
> >  }
> >  #endif
> >  
> > diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> > index 1899f69..3152a4e 100644
> > --- a/target-i386/cpu.h
> > +++ b/target-i386/cpu.h
> > @@ -488,6 +488,8 @@
> >  
> >  #define CPUID_VENDOR_VIA   "CentaurHauls"
> >  
> > +#define CPUID_HV_LEVEL_HYPERV  0x40000005
> > +
> 
> Where this comes from? 
> 
> http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> 
> has under "Leaf 0x40000000" (at very top of table):
> 
> EAX
> 
> The maximum input value for hypervisor CPUID information. For Microsoft
> hypervisors, this value will be at least 0x40000005. The vendor ID
> signature should be used only for reporting and diagnostic purposes.
> 
> Is that the same 0x40000005 as in this patch?

Yes, the #define can be reused:

#define HYPERV_CPUID_MIN                        0x40000005


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

* Re: [Qemu-devel] [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
@ 2012-10-09 17:17       ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 17:17 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Tue, Oct 09, 2012 at 01:34:09PM -0300, Marcelo Tosatti wrote:
> On Mon, Sep 24, 2012 at 10:32:06AM -0400, Don Slutz wrote:
> > This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.
> > 
> > Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> > ---
> >  target-i386/cpu.c |    9 +++++++++
> >  target-i386/cpu.h |    2 ++
> >  2 files changed, 11 insertions(+), 0 deletions(-)
> > 
> > diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> > index 451de12..48bdaf9 100644
> > --- a/target-i386/cpu.c
> > +++ b/target-i386/cpu.c
> > @@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
> >  }
> >  
> >  #if !defined(CONFIG_USER_ONLY)
> > +static void x86_set_hyperv(Object *obj, Error **errp)
> > +{
> > +    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
> > +                            "hypervisor-level", errp);
> > +}
> > +
> >  static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> >                                   const char *name, Error **errp)
> >  {
> > @@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> >          return;
> >      }
> >      hyperv_set_spinlock_retries(value);
> > +    x86_set_hyperv(obj, errp);
> >  }
> >  
> >  static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> > @@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> >          return;
> >      }
> >      hyperv_enable_relaxed_timing(value);
> > +    x86_set_hyperv(obj, errp);
> >  }
> >  
> >  static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
> > @@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
> >          return;
> >      }
> >      hyperv_enable_vapic_recommended(value);
> > +    x86_set_hyperv(obj, errp);
> >  }
> >  #endif
> >  
> > diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> > index 1899f69..3152a4e 100644
> > --- a/target-i386/cpu.h
> > +++ b/target-i386/cpu.h
> > @@ -488,6 +488,8 @@
> >  
> >  #define CPUID_VENDOR_VIA   "CentaurHauls"
> >  
> > +#define CPUID_HV_LEVEL_HYPERV  0x40000005
> > +
> 
> Where this comes from? 
> 
> http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> 
> has under "Leaf 0x40000000" (at very top of table):
> 
> EAX
> 
> The maximum input value for hypervisor CPUID information. For Microsoft
> hypervisors, this value will be at least 0x40000005. The vendor ID
> signature should be used only for reporting and diagnostic purposes.
> 
> Is that the same 0x40000005 as in this patch?

Yes, the #define can be reused:

#define HYPERV_CPUID_MIN                        0x40000005

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

* Re: [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm.
  2012-09-24 14:32   ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Don Slutz
@ 2012-10-09 17:18     ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 17:18 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
> Also known as Paravirtualization level.
> 
> This change is based on:
> 
> Microsoft Hypervisor CPUID Leaves:
>   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> 
> Linux kernel change starts with:
>   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> Also:
>   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> 
> VMware documention on CPUIDs (Mechanisms to determine if software is
> running in a VMware virtual machine):
>   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> 
> QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/kvm.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 895d848..8462c75 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>      c = &cpuid_data.entries[cpuid_i++];
>      memset(c, 0, sizeof(*c));
>      c->function = KVM_CPUID_SIGNATURE
> -    if (!hyperv_enabled()) {
> +    if (!env->cpuid_hv_level_set) {
>          memcpy(signature, "KVMKVMKVM\0\0\0", 12);
>          c->eax = 0;
>      } else {
>          memcpy(signature, "Microsoft Hv", 12);
> -        c->eax = HYPERV_CPUID_MIN;
> +        c->eax = env->cpuid_hv_level;

This breaks hyperv_enabled() checks. 

Don, are you certain it is worthwhile to make this configurable? 
Can you explain why, under your scenario, it is worthwhile?

Because these are separate problems:

- "Fake" VMWare hypervisor  (which seems to be your main goal).
- Make CPUID HV leafs configurable via command line.

My point is that the CPUIDs must be carefully constructed, 
that i miss the point why making them configurable is 
desired.


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

* Re: [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
@ 2012-10-09 17:18     ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 17:18 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
> Also known as Paravirtualization level.
> 
> This change is based on:
> 
> Microsoft Hypervisor CPUID Leaves:
>   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> 
> Linux kernel change starts with:
>   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> Also:
>   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> 
> VMware documention on CPUIDs (Mechanisms to determine if software is
> running in a VMware virtual machine):
>   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> 
> QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/kvm.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 895d848..8462c75 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>      c = &cpuid_data.entries[cpuid_i++];
>      memset(c, 0, sizeof(*c));
>      c->function = KVM_CPUID_SIGNATURE
> -    if (!hyperv_enabled()) {
> +    if (!env->cpuid_hv_level_set) {
>          memcpy(signature, "KVMKVMKVM\0\0\0", 12);
>          c->eax = 0;
>      } else {
>          memcpy(signature, "Microsoft Hv", 12);
> -        c->eax = HYPERV_CPUID_MIN;
> +        c->eax = env->cpuid_hv_level;

This breaks hyperv_enabled() checks. 

Don, are you certain it is worthwhile to make this configurable? 
Can you explain why, under your scenario, it is worthwhile?

Because these are separate problems:

- "Fake" VMWare hypervisor  (which seems to be your main goal).
- Make CPUID HV leafs configurable via command line.

My point is that the CPUIDs must be carefully constructed, 
that i miss the point why making them configurable is 
desired.

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

* Re: [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
  2012-10-09 17:18     ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Marcelo Tosatti
@ 2012-10-09 18:27       ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 18:27 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
> On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
> > Also known as Paravirtualization level.
> > 
> > This change is based on:
> > 
> > Microsoft Hypervisor CPUID Leaves:
> >   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> > 
> > Linux kernel change starts with:
> >   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> > Also:
> >   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> > 
> > VMware documention on CPUIDs (Mechanisms to determine if software is
> > running in a VMware virtual machine):
> >   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> > 
> > QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
> > 
> > Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> > ---
> >  target-i386/kvm.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> > index 895d848..8462c75 100644
> > --- a/target-i386/kvm.c
> > +++ b/target-i386/kvm.c
> > @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
> >      c = &cpuid_data.entries[cpuid_i++];
> >      memset(c, 0, sizeof(*c));
> >      c->function = KVM_CPUID_SIGNATURE
> > -    if (!hyperv_enabled()) {
> > +    if (!env->cpuid_hv_level_set) {
> >          memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> >          c->eax = 0;
> >      } else {
> >          memcpy(signature, "Microsoft Hv", 12);
> > -        c->eax = HYPERV_CPUID_MIN;
> > +        c->eax = env->cpuid_hv_level;
> 
> This breaks hyperv_enabled() checks. 
> 
> Don, are you certain it is worthwhile to make this configurable? 
> Can you explain why, under your scenario, it is worthwhile?
> 
> Because these are separate problems:
> 
> - "Fake" VMWare hypervisor  (which seems to be your main goal).
> - Make CPUID HV leafs configurable via command line.

Err, meant via properties. Point is, why have VMWare CPUID
configuration as data, if there are reasons to believe code 
is a better fit (code as in current Hyper-V implementation).

> My point is that the CPUIDs must be carefully constructed, 
> that i miss the point why making them configurable is 
> desired.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
@ 2012-10-09 18:27       ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 18:27 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
> On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
> > Also known as Paravirtualization level.
> > 
> > This change is based on:
> > 
> > Microsoft Hypervisor CPUID Leaves:
> >   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> > 
> > Linux kernel change starts with:
> >   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> > Also:
> >   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> > 
> > VMware documention on CPUIDs (Mechanisms to determine if software is
> > running in a VMware virtual machine):
> >   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> > 
> > QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
> > 
> > Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> > ---
> >  target-i386/kvm.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> > index 895d848..8462c75 100644
> > --- a/target-i386/kvm.c
> > +++ b/target-i386/kvm.c
> > @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
> >      c = &cpuid_data.entries[cpuid_i++];
> >      memset(c, 0, sizeof(*c));
> >      c->function = KVM_CPUID_SIGNATURE
> > -    if (!hyperv_enabled()) {
> > +    if (!env->cpuid_hv_level_set) {
> >          memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> >          c->eax = 0;
> >      } else {
> >          memcpy(signature, "Microsoft Hv", 12);
> > -        c->eax = HYPERV_CPUID_MIN;
> > +        c->eax = env->cpuid_hv_level;
> 
> This breaks hyperv_enabled() checks. 
> 
> Don, are you certain it is worthwhile to make this configurable? 
> Can you explain why, under your scenario, it is worthwhile?
> 
> Because these are separate problems:
> 
> - "Fake" VMWare hypervisor  (which seems to be your main goal).
> - Make CPUID HV leafs configurable via command line.

Err, meant via properties. Point is, why have VMWare CPUID
configuration as data, if there are reasons to believe code 
is a better fit (code as in current Hyper-V implementation).

> My point is that the CPUIDs must be carefully constructed, 
> that i miss the point why making them configurable is 
> desired.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
  2012-10-09 18:27       ` [Qemu-devel] " Marcelo Tosatti
@ 2012-10-09 18:47         ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 18:47 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Tue, Oct 09, 2012 at 03:27:26PM -0300, Marcelo Tosatti wrote:
> On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
> > On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
> > > Also known as Paravirtualization level.
> > > 
> > > This change is based on:
> > > 
> > > Microsoft Hypervisor CPUID Leaves:
> > >   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> > > 
> > > Linux kernel change starts with:
> > >   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> > > Also:
> > >   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> > > 
> > > VMware documention on CPUIDs (Mechanisms to determine if software is
> > > running in a VMware virtual machine):
> > >   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> > > 
> > > QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
> > > 
> > > Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> > > ---
> > >  target-i386/kvm.c |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> > > index 895d848..8462c75 100644
> > > --- a/target-i386/kvm.c
> > > +++ b/target-i386/kvm.c
> > > @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
> > >      c = &cpuid_data.entries[cpuid_i++];
> > >      memset(c, 0, sizeof(*c));
> > >      c->function = KVM_CPUID_SIGNATURE
> > > -    if (!hyperv_enabled()) {
> > > +    if (!env->cpuid_hv_level_set) {
> > >          memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> > >          c->eax = 0;
> > >      } else {
> > >          memcpy(signature, "Microsoft Hv", 12);
> > > -        c->eax = HYPERV_CPUID_MIN;
> > > +        c->eax = env->cpuid_hv_level;
> > 
> > This breaks hyperv_enabled() checks. 
> > 
> > Don, are you certain it is worthwhile to make this configurable? 
> > Can you explain why, under your scenario, it is worthwhile?
> > 
> > Because these are separate problems:
> > 
> > - "Fake" VMWare hypervisor  (which seems to be your main goal).
> > - Make CPUID HV leafs configurable via command line.
> 
> Err, meant via properties. Point is, why have VMWare CPUID
> configuration as data, if there are reasons to believe code 
> is a better fit (code as in current Hyper-V implementation).

Nevermind, its the right thing to do. Just separate the patchset
please:

1) Create object properties.
2) Export VMWare CPUID via properties.
3) Convert Hyper-V. 

Be careful to make sure Hyper-V's current options are functional 
in 3).

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

* Re: [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
@ 2012-10-09 18:47         ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 18:47 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Tue, Oct 09, 2012 at 03:27:26PM -0300, Marcelo Tosatti wrote:
> On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
> > On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
> > > Also known as Paravirtualization level.
> > > 
> > > This change is based on:
> > > 
> > > Microsoft Hypervisor CPUID Leaves:
> > >   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> > > 
> > > Linux kernel change starts with:
> > >   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> > > Also:
> > >   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> > > 
> > > VMware documention on CPUIDs (Mechanisms to determine if software is
> > > running in a VMware virtual machine):
> > >   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> > > 
> > > QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
> > > 
> > > Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> > > ---
> > >  target-i386/kvm.c |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> > > index 895d848..8462c75 100644
> > > --- a/target-i386/kvm.c
> > > +++ b/target-i386/kvm.c
> > > @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
> > >      c = &cpuid_data.entries[cpuid_i++];
> > >      memset(c, 0, sizeof(*c));
> > >      c->function = KVM_CPUID_SIGNATURE
> > > -    if (!hyperv_enabled()) {
> > > +    if (!env->cpuid_hv_level_set) {
> > >          memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> > >          c->eax = 0;
> > >      } else {
> > >          memcpy(signature, "Microsoft Hv", 12);
> > > -        c->eax = HYPERV_CPUID_MIN;
> > > +        c->eax = env->cpuid_hv_level;
> > 
> > This breaks hyperv_enabled() checks. 
> > 
> > Don, are you certain it is worthwhile to make this configurable? 
> > Can you explain why, under your scenario, it is worthwhile?
> > 
> > Because these are separate problems:
> > 
> > - "Fake" VMWare hypervisor  (which seems to be your main goal).
> > - Make CPUID HV leafs configurable via command line.
> 
> Err, meant via properties. Point is, why have VMWare CPUID
> configuration as data, if there are reasons to believe code 
> is a better fit (code as in current Hyper-V implementation).

Nevermind, its the right thing to do. Just separate the patchset
please:

1) Create object properties.
2) Export VMWare CPUID via properties.
3) Convert Hyper-V. 

Be careful to make sure Hyper-V's current options are functional 
in 3).

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

* Re: [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc,accel=tcg.
  2012-09-24 14:32   ` [Qemu-devel] [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc, accel=tcg Don Slutz
@ 2012-10-09 19:01     ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:01 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Mon, Sep 24, 2012 at 10:32:08AM -0400, Don Slutz wrote:
> Also known as Paravirtualization level.
> 
> This change is based on:
> 
> Microsoft Hypervisor CPUID Leaves:
>   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> 
> Linux kernel change starts with:
>   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> Also:
>   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> 
> VMware documention on CPUIDs (Mechanisms to determine if software is
> running in a VMware virtual machine):
>   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> 
> QEMU knows this as KVM_CPUID_SIGNATURE (0x40000000) in kvm on linux.
> 
> This does not provide vendor support in tcg yet.
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |   27 +++++++++++++++++++++++++++
>  1 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 48bdaf9..920278b 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1651,6 +1651,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>                  index =  env->cpuid_xlevel;
>              }
>          }
> +    } else if (index & 0x40000000) {
> +        if (env->cpuid_hv_level_set) {
> +            uint32_t real_level = env->cpuid_hv_level;
> +
> +            /* Handle Hypervisor CPUIDs */
> +            if (real_level < 0x40000000) {
> +                real_level = 0x40000000;
> +            }
> +            if (index > real_level) {
> +                index = real_level;
> +            }
> +        } else {
> +            if (index > env->cpuid_level)
> +                index = env->cpuid_level;
> +        }

Whats the purpose of this checks?

Please provide changelogs for each patch.

>      } else {
>          if (index > env->cpuid_level)
>              index = env->cpuid_level;
> @@ -1789,6 +1804,18 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>              *edx = 0;
>          }
>          break;
> +    case 0x40000000:
> +        *eax = env->cpuid_hv_level;
> +        *ebx = 0;
> +        *ecx = 0;
> +        *edx = 0;
> +        break;
> +    case 0x40000001:
> +        *eax = env->cpuid_kvm_features;
> +        *ebx = 0;
> +        *ecx = 0;
> +        *edx = 0;
> +        break;
>      case 0x80000000:
>          *eax = env->cpuid_xlevel;
>          *ebx = env->cpuid_vendor1;
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [Qemu-devel] [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc, accel=tcg.
@ 2012-10-09 19:01     ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:01 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Mon, Sep 24, 2012 at 10:32:08AM -0400, Don Slutz wrote:
> Also known as Paravirtualization level.
> 
> This change is based on:
> 
> Microsoft Hypervisor CPUID Leaves:
>   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> 
> Linux kernel change starts with:
>   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> Also:
>   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> 
> VMware documention on CPUIDs (Mechanisms to determine if software is
> running in a VMware virtual machine):
>   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> 
> QEMU knows this as KVM_CPUID_SIGNATURE (0x40000000) in kvm on linux.
> 
> This does not provide vendor support in tcg yet.
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |   27 +++++++++++++++++++++++++++
>  1 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 48bdaf9..920278b 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1651,6 +1651,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>                  index =  env->cpuid_xlevel;
>              }
>          }
> +    } else if (index & 0x40000000) {
> +        if (env->cpuid_hv_level_set) {
> +            uint32_t real_level = env->cpuid_hv_level;
> +
> +            /* Handle Hypervisor CPUIDs */
> +            if (real_level < 0x40000000) {
> +                real_level = 0x40000000;
> +            }
> +            if (index > real_level) {
> +                index = real_level;
> +            }
> +        } else {
> +            if (index > env->cpuid_level)
> +                index = env->cpuid_level;
> +        }

Whats the purpose of this checks?

Please provide changelogs for each patch.

>      } else {
>          if (index > env->cpuid_level)
>              index = env->cpuid_level;
> @@ -1789,6 +1804,18 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>              *edx = 0;
>          }
>          break;
> +    case 0x40000000:
> +        *eax = env->cpuid_hv_level;
> +        *ebx = 0;
> +        *ecx = 0;
> +        *edx = 0;
> +        break;
> +    case 0x40000001:
> +        *eax = env->cpuid_kvm_features;
> +        *ebx = 0;
> +        *ecx = 0;
> +        *edx = 0;
> +        break;
>      case 0x80000000:
>          *eax = env->cpuid_xlevel;
>          *ebx = env->cpuid_vendor1;
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v6 08/16] target-i386: Add cpu object access routines for Hypervisor vendor.
  2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
@ 2012-10-09 19:02     ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:02 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Mon, Sep 24, 2012 at 10:32:10AM -0400, Don Slutz wrote:
> These are modeled after x86_cpuid_set_vendor and x86_cpuid_get_vendor.
> Since kvm's vendor is shorter, the test for correct size is removed and zero padding is added.
> 
> Set Microsoft's Vendor now that we can.  Value defined in:
>   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> And matches want is in target-i386/kvm.c
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
>  target-i386/cpu.h |    2 ++
>  2 files changed, 48 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 920278b..964877f 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1192,11 +1192,54 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
>      cpu->env.cpuid_hv_level_set = true;
>  }
>  
> +static char *x86_cpuid_get_hv_vendor(Object *obj, Error **errp)
> +{
> +    X86CPU *cpu = X86_CPU(obj);
> +    CPUX86State *env = &cpu->env;
> +    char *value;
> +    int i;
> +
> +    value = (char *)g_malloc(CPUID_VENDOR_SZ + 1);
> +    for (i = 0; i < 4; i++) {
> +        value[i + 0] = env->cpuid_hv_vendor1 >> (8 * i);
> +        value[i + 4] = env->cpuid_hv_vendor2 >> (8 * i);
> +        value[i + 8] = env->cpuid_hv_vendor3 >> (8 * i);
> +    }
> +    value[CPUID_VENDOR_SZ] = '\0';
> +
> +    return value;
> +}
> +
> +static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
> +                                    Error **errp)
> +{
> +    X86CPU *cpu = X86_CPU(obj);
> +    CPUX86State *env = &cpu->env;
> +    int i;
> +    char adj_value[CPUID_VENDOR_SZ + 1];
> +
> +    memset(adj_value, 0, sizeof(adj_value));
> +
> +    pstrcpy(adj_value, sizeof(adj_value), value);
> +
> +    env->cpuid_hv_vendor1 = 0;
> +    env->cpuid_hv_vendor2 = 0;
> +    env->cpuid_hv_vendor3 = 0;
> +    for (i = 0; i < 4; i++) {
> +        env->cpuid_hv_vendor1 |= ((uint8_t)adj_value[i + 0]) << (8 * i);
> +        env->cpuid_hv_vendor2 |= ((uint8_t)adj_value[i + 4]) << (8 * i);
> +        env->cpuid_hv_vendor3 |= ((uint8_t)adj_value[i + 8]) << (8 * i);
> +    }
> +    env->cpuid_hv_vendor_set = true;
> +}
> +
>  #if !defined(CONFIG_USER_ONLY)
>  static void x86_set_hyperv(Object *obj, Error **errp)
>  {
>      object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
>                              "hypervisor-level", errp);
> +    object_property_set_str(obj, CPUID_HV_VENDOR_HYPERV,
> +                            "hypervisor-vendor", errp);
>  }
>  
>  static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> @@ -2126,6 +2169,9 @@ static void x86_cpu_initfn(Object *obj)
>      object_property_add(obj, "hypervisor-level", "int",
>                          x86_cpuid_get_hv_level,
>                          x86_cpuid_set_hv_level, NULL, NULL, NULL);
> +    object_property_add_str(obj, "hypervisor-vendor",
> +                            x86_cpuid_get_hv_vendor,
> +                            x86_cpuid_set_hv_vendor, NULL);
>  #if !defined(CONFIG_USER_ONLY)
>      object_property_add(obj, "hv_spinlocks", "int",
>                          x86_get_hv_spinlocks,
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 11730b2..eb6aa4a 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -488,6 +488,8 @@
>  
>  #define CPUID_VENDOR_VIA   "CentaurHauls"
>  
> +#define CPUID_HV_VENDOR_HYPERV "Microsoft Hv"
> +
>  #define CPUID_HV_LEVEL_HYPERV  0x40000005

As requested, please separate patchset in groups.


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

* Re: [Qemu-devel] [PATCH v6 08/16] target-i386: Add cpu object access routines for Hypervisor vendor.
@ 2012-10-09 19:02     ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:02 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Mon, Sep 24, 2012 at 10:32:10AM -0400, Don Slutz wrote:
> These are modeled after x86_cpuid_set_vendor and x86_cpuid_get_vendor.
> Since kvm's vendor is shorter, the test for correct size is removed and zero padding is added.
> 
> Set Microsoft's Vendor now that we can.  Value defined in:
>   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> And matches want is in target-i386/kvm.c
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
>  target-i386/cpu.h |    2 ++
>  2 files changed, 48 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 920278b..964877f 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1192,11 +1192,54 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
>      cpu->env.cpuid_hv_level_set = true;
>  }
>  
> +static char *x86_cpuid_get_hv_vendor(Object *obj, Error **errp)
> +{
> +    X86CPU *cpu = X86_CPU(obj);
> +    CPUX86State *env = &cpu->env;
> +    char *value;
> +    int i;
> +
> +    value = (char *)g_malloc(CPUID_VENDOR_SZ + 1);
> +    for (i = 0; i < 4; i++) {
> +        value[i + 0] = env->cpuid_hv_vendor1 >> (8 * i);
> +        value[i + 4] = env->cpuid_hv_vendor2 >> (8 * i);
> +        value[i + 8] = env->cpuid_hv_vendor3 >> (8 * i);
> +    }
> +    value[CPUID_VENDOR_SZ] = '\0';
> +
> +    return value;
> +}
> +
> +static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
> +                                    Error **errp)
> +{
> +    X86CPU *cpu = X86_CPU(obj);
> +    CPUX86State *env = &cpu->env;
> +    int i;
> +    char adj_value[CPUID_VENDOR_SZ + 1];
> +
> +    memset(adj_value, 0, sizeof(adj_value));
> +
> +    pstrcpy(adj_value, sizeof(adj_value), value);
> +
> +    env->cpuid_hv_vendor1 = 0;
> +    env->cpuid_hv_vendor2 = 0;
> +    env->cpuid_hv_vendor3 = 0;
> +    for (i = 0; i < 4; i++) {
> +        env->cpuid_hv_vendor1 |= ((uint8_t)adj_value[i + 0]) << (8 * i);
> +        env->cpuid_hv_vendor2 |= ((uint8_t)adj_value[i + 4]) << (8 * i);
> +        env->cpuid_hv_vendor3 |= ((uint8_t)adj_value[i + 8]) << (8 * i);
> +    }
> +    env->cpuid_hv_vendor_set = true;
> +}
> +
>  #if !defined(CONFIG_USER_ONLY)
>  static void x86_set_hyperv(Object *obj, Error **errp)
>  {
>      object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
>                              "hypervisor-level", errp);
> +    object_property_set_str(obj, CPUID_HV_VENDOR_HYPERV,
> +                            "hypervisor-vendor", errp);
>  }
>  
>  static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> @@ -2126,6 +2169,9 @@ static void x86_cpu_initfn(Object *obj)
>      object_property_add(obj, "hypervisor-level", "int",
>                          x86_cpuid_get_hv_level,
>                          x86_cpuid_set_hv_level, NULL, NULL, NULL);
> +    object_property_add_str(obj, "hypervisor-vendor",
> +                            x86_cpuid_get_hv_vendor,
> +                            x86_cpuid_set_hv_vendor, NULL);
>  #if !defined(CONFIG_USER_ONLY)
>      object_property_add(obj, "hv_spinlocks", "int",
>                          x86_get_hv_spinlocks,
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 11730b2..eb6aa4a 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -488,6 +488,8 @@
>  
>  #define CPUID_VENDOR_VIA   "CentaurHauls"
>  
> +#define CPUID_HV_VENDOR_HYPERV "Microsoft Hv"
> +
>  #define CPUID_HV_LEVEL_HYPERV  0x40000005

As requested, please separate patchset in groups.

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

* Re: [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm.
  2012-10-09 18:47         ` [Qemu-devel] " Marcelo Tosatti
@ 2012-10-09 19:09           ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-09 19:09 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On 10/09/12 14:47, Marcelo Tosatti wrote:
> On Tue, Oct 09, 2012 at 03:27:26PM -0300, Marcelo Tosatti wrote:
>> On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
>>> On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
>>>> Also known as Paravirtualization level.
>>>>
>>>> This change is based on:
>>>>
>>>> Microsoft Hypervisor CPUID Leaves:
>>>>    http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
>>>>
>>>> Linux kernel change starts with:
>>>>    http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
>>>> Also:
>>>>    http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
>>>>
>>>> VMware documention on CPUIDs (Mechanisms to determine if software is
>>>> running in a VMware virtual machine):
>>>>    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
>>>>
>>>> QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
>>>>
>>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>>> ---
>>>>   target-i386/kvm.c |    4 ++--
>>>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
>>>> index 895d848..8462c75 100644
>>>> --- a/target-i386/kvm.c
>>>> +++ b/target-i386/kvm.c
>>>> @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>>>>       c = &cpuid_data.entries[cpuid_i++];
>>>>       memset(c, 0, sizeof(*c));
>>>>       c->function = KVM_CPUID_SIGNATURE
>>>> -    if (!hyperv_enabled()) {
>>>> +    if (!env->cpuid_hv_level_set) {
>>>>           memcpy(signature, "KVMKVMKVM\0\0\0", 12);
>>>>           c->eax = 0;
>>>>       } else {
>>>>           memcpy(signature, "Microsoft Hv", 12);
>>>> -        c->eax = HYPERV_CPUID_MIN;
>>>> +        c->eax = env->cpuid_hv_level;
>>> This breaks hyperv_enabled() checks.
>>>
>>> Don, are you certain it is worthwhile to make this configurable?
>>> Can you explain why, under your scenario, it is worthwhile?
>>>
>>> Because these are separate problems:
>>>
>>> - "Fake" VMWare hypervisor  (which seems to be your main goal).
>>> - Make CPUID HV leafs configurable via command line.
>> Err, meant via properties. Point is, why have VMWare CPUID
>> configuration as data, if there are reasons to believe code
>> is a better fit (code as in current Hyper-V implementation).
> Nevermind, its the right thing to do. Just separate the patchset
> please:
>
> 1) Create object properties.
> 2) Export VMWare CPUID via properties.
> 3) Convert Hyper-V.
>
> Be careful to make sure Hyper-V's current options are functional
> in 3).
>
Did you mean 3 patch sets (or more)? Or just a different order?
    -Don Slutz


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

* Re: [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
@ 2012-10-09 19:09           ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-09 19:09 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On 10/09/12 14:47, Marcelo Tosatti wrote:
> On Tue, Oct 09, 2012 at 03:27:26PM -0300, Marcelo Tosatti wrote:
>> On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
>>> On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
>>>> Also known as Paravirtualization level.
>>>>
>>>> This change is based on:
>>>>
>>>> Microsoft Hypervisor CPUID Leaves:
>>>>    http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
>>>>
>>>> Linux kernel change starts with:
>>>>    http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
>>>> Also:
>>>>    http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
>>>>
>>>> VMware documention on CPUIDs (Mechanisms to determine if software is
>>>> running in a VMware virtual machine):
>>>>    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
>>>>
>>>> QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
>>>>
>>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>>> ---
>>>>   target-i386/kvm.c |    4 ++--
>>>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
>>>> index 895d848..8462c75 100644
>>>> --- a/target-i386/kvm.c
>>>> +++ b/target-i386/kvm.c
>>>> @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>>>>       c = &cpuid_data.entries[cpuid_i++];
>>>>       memset(c, 0, sizeof(*c));
>>>>       c->function = KVM_CPUID_SIGNATURE
>>>> -    if (!hyperv_enabled()) {
>>>> +    if (!env->cpuid_hv_level_set) {
>>>>           memcpy(signature, "KVMKVMKVM\0\0\0", 12);
>>>>           c->eax = 0;
>>>>       } else {
>>>>           memcpy(signature, "Microsoft Hv", 12);
>>>> -        c->eax = HYPERV_CPUID_MIN;
>>>> +        c->eax = env->cpuid_hv_level;
>>> This breaks hyperv_enabled() checks.
>>>
>>> Don, are you certain it is worthwhile to make this configurable?
>>> Can you explain why, under your scenario, it is worthwhile?
>>>
>>> Because these are separate problems:
>>>
>>> - "Fake" VMWare hypervisor  (which seems to be your main goal).
>>> - Make CPUID HV leafs configurable via command line.
>> Err, meant via properties. Point is, why have VMWare CPUID
>> configuration as data, if there are reasons to believe code
>> is a better fit (code as in current Hyper-V implementation).
> Nevermind, its the right thing to do. Just separate the patchset
> please:
>
> 1) Create object properties.
> 2) Export VMWare CPUID via properties.
> 3) Convert Hyper-V.
>
> Be careful to make sure Hyper-V's current options are functional
> in 3).
>
Did you mean 3 patch sets (or more)? Or just a different order?
    -Don Slutz

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

* Re: [PATCH v6 14/16] target-i386: Add setting of Hypervisor leaf extra for known vmare4.
  2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
@ 2012-10-09 19:09     ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:09 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Mon, Sep 24, 2012 at 10:32:16AM -0400, Don Slutz wrote:
> This was taken from:
>   http://article.gmane.org/gmane.comp.emulators.kvm.devel/22643
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |   32 ++++++++++++++++++++++++++++++++
>  1 files changed, 32 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 8bb20c7..b77dbfe 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1135,6 +1135,36 @@ static void x86_cpuid_set_model_id(Object *obj, const char *model_id,
>      }
>  }
>  
> +static void x86_cpuid_set_vmware_extra(Object *obj)
> +{
> +    X86CPU *cpu = X86_CPU(obj);
> +
> +    if ((cpu->env.tsc_khz != 0) &&
> +        (cpu->env.cpuid_hv_level == CPUID_HV_LEVEL_VMWARE_4) &&
> +        (cpu->env.cpuid_hv_vendor1 == CPUID_HV_VENDOR_VMWARE_1) &&
> +        (cpu->env.cpuid_hv_vendor2 == CPUID_HV_VENDOR_VMWARE_2) &&
> +        (cpu->env.cpuid_hv_vendor3 == CPUID_HV_VENDOR_VMWARE_3)) {
> +        const uint32_t apic_khz = 1000000L;
> +
> +        /*
> +         * From article.gmane.org/gmane.comp.emulators.kvm.devel/22643
> +         *
> +         *    Leaf 0x40000010, Timing Information.
> +         *
> +         *    VMware has defined the first generic leaf to provide timing
> +         *    information.  This leaf returns the current TSC frequency and
> +         *    current Bus frequency in kHz.
> +         *
> +         *    # EAX: (Virtual) TSC frequency in kHz.
> +         *    # EBX: (Virtual) Bus (local apic timer) frequency in kHz.
> +         *    # ECX, EDX: RESERVED (Per above, reserved fields are set to zero).
> +         */
> +        cpu->env.cpuid_hv_extra = 0x40000010;
> +        cpu->env.cpuid_hv_extra_a = (uint32_t)cpu->env.tsc_khz;
> +        cpu->env.cpuid_hv_extra_b = apic_khz;
> +    }
> +}
> +
>  static void x86_cpuid_get_tsc_freq(Object *obj, Visitor *v, void *opaque,
>                                     const char *name, Error **errp)
>  {
> @@ -1164,6 +1194,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
>      }
>  
>      cpu->env.tsc_khz = value / 1000;
> +    x86_cpuid_set_vmware_extra(obj);
>  }
>  
>  static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
> @@ -1277,6 +1308,7 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
>          env->cpuid_hv_vendor3 |= ((uint8_t)adj_value[i + 8]) << (8 * i);
>      }
>      env->cpuid_hv_vendor_set = true;
> +    x86_cpuid_set_vmware_extra(obj);
>  }

This is strange. Please have this configuration, that depends on other
properties being set, ordered in x86_cpu_initfn. Say:

    object_property_add(obj, "tsc-frequency", "int",
                        x86_cpuid_get_tsc_freq,
                        x86_cpuid_set_tsc_freq, NULL, NULL, NULL);

    /* depends on tsc frequency */
    object_property_add(obj, "vmware-extra", "int",
                        x86_cpuid_get_vmware_extra,
                        x86_cpuid_set_vmware_extra, NULL, NULL, NULL);

Or something to that effect.


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

* Re: [Qemu-devel] [PATCH v6 14/16] target-i386: Add setting of Hypervisor leaf extra for known vmare4.
@ 2012-10-09 19:09     ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:09 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Mon, Sep 24, 2012 at 10:32:16AM -0400, Don Slutz wrote:
> This was taken from:
>   http://article.gmane.org/gmane.comp.emulators.kvm.devel/22643
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  target-i386/cpu.c |   32 ++++++++++++++++++++++++++++++++
>  1 files changed, 32 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 8bb20c7..b77dbfe 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1135,6 +1135,36 @@ static void x86_cpuid_set_model_id(Object *obj, const char *model_id,
>      }
>  }
>  
> +static void x86_cpuid_set_vmware_extra(Object *obj)
> +{
> +    X86CPU *cpu = X86_CPU(obj);
> +
> +    if ((cpu->env.tsc_khz != 0) &&
> +        (cpu->env.cpuid_hv_level == CPUID_HV_LEVEL_VMWARE_4) &&
> +        (cpu->env.cpuid_hv_vendor1 == CPUID_HV_VENDOR_VMWARE_1) &&
> +        (cpu->env.cpuid_hv_vendor2 == CPUID_HV_VENDOR_VMWARE_2) &&
> +        (cpu->env.cpuid_hv_vendor3 == CPUID_HV_VENDOR_VMWARE_3)) {
> +        const uint32_t apic_khz = 1000000L;
> +
> +        /*
> +         * From article.gmane.org/gmane.comp.emulators.kvm.devel/22643
> +         *
> +         *    Leaf 0x40000010, Timing Information.
> +         *
> +         *    VMware has defined the first generic leaf to provide timing
> +         *    information.  This leaf returns the current TSC frequency and
> +         *    current Bus frequency in kHz.
> +         *
> +         *    # EAX: (Virtual) TSC frequency in kHz.
> +         *    # EBX: (Virtual) Bus (local apic timer) frequency in kHz.
> +         *    # ECX, EDX: RESERVED (Per above, reserved fields are set to zero).
> +         */
> +        cpu->env.cpuid_hv_extra = 0x40000010;
> +        cpu->env.cpuid_hv_extra_a = (uint32_t)cpu->env.tsc_khz;
> +        cpu->env.cpuid_hv_extra_b = apic_khz;
> +    }
> +}
> +
>  static void x86_cpuid_get_tsc_freq(Object *obj, Visitor *v, void *opaque,
>                                     const char *name, Error **errp)
>  {
> @@ -1164,6 +1194,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
>      }
>  
>      cpu->env.tsc_khz = value / 1000;
> +    x86_cpuid_set_vmware_extra(obj);
>  }
>  
>  static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
> @@ -1277,6 +1308,7 @@ static void x86_cpuid_set_hv_vendor(Object *obj, const char *value,
>          env->cpuid_hv_vendor3 |= ((uint8_t)adj_value[i + 8]) << (8 * i);
>      }
>      env->cpuid_hv_vendor_set = true;
> +    x86_cpuid_set_vmware_extra(obj);
>  }

This is strange. Please have this configuration, that depends on other
properties being set, ordered in x86_cpu_initfn. Say:

    object_property_add(obj, "tsc-frequency", "int",
                        x86_cpuid_get_tsc_freq,
                        x86_cpuid_set_tsc_freq, NULL, NULL, NULL);

    /* depends on tsc frequency */
    object_property_add(obj, "vmware-extra", "int",
                        x86_cpuid_get_vmware_extra,
                        x86_cpuid_set_vmware_extra, NULL, NULL, NULL);

Or something to that effect.

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

* Re: [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm.
  2012-10-09 19:09           ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Don Slutz
@ 2012-10-09 19:11             ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:11 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Tue, Oct 09, 2012 at 03:09:17PM -0400, Don Slutz wrote:
> On 10/09/12 14:47, Marcelo Tosatti wrote:
> >On Tue, Oct 09, 2012 at 03:27:26PM -0300, Marcelo Tosatti wrote:
> >>On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
> >>>On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
> >>>>Also known as Paravirtualization level.
> >>>>
> >>>>This change is based on:
> >>>>
> >>>>Microsoft Hypervisor CPUID Leaves:
> >>>>   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> >>>>
> >>>>Linux kernel change starts with:
> >>>>   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> >>>>Also:
> >>>>   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> >>>>
> >>>>VMware documention on CPUIDs (Mechanisms to determine if software is
> >>>>running in a VMware virtual machine):
> >>>>   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> >>>>
> >>>>QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
> >>>>
> >>>>Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> >>>>---
> >>>>  target-i386/kvm.c |    4 ++--
> >>>>  1 files changed, 2 insertions(+), 2 deletions(-)
> >>>>
> >>>>diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> >>>>index 895d848..8462c75 100644
> >>>>--- a/target-i386/kvm.c
> >>>>+++ b/target-i386/kvm.c
> >>>>@@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
> >>>>      c = &cpuid_data.entries[cpuid_i++];
> >>>>      memset(c, 0, sizeof(*c));
> >>>>      c->function = KVM_CPUID_SIGNATURE
> >>>>-    if (!hyperv_enabled()) {
> >>>>+    if (!env->cpuid_hv_level_set) {
> >>>>          memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> >>>>          c->eax = 0;
> >>>>      } else {
> >>>>          memcpy(signature, "Microsoft Hv", 12);
> >>>>-        c->eax = HYPERV_CPUID_MIN;
> >>>>+        c->eax = env->cpuid_hv_level;
> >>>This breaks hyperv_enabled() checks.
> >>>
> >>>Don, are you certain it is worthwhile to make this configurable?
> >>>Can you explain why, under your scenario, it is worthwhile?
> >>>
> >>>Because these are separate problems:
> >>>
> >>>- "Fake" VMWare hypervisor  (which seems to be your main goal).
> >>>- Make CPUID HV leafs configurable via command line.
> >>Err, meant via properties. Point is, why have VMWare CPUID
> >>configuration as data, if there are reasons to believe code
> >>is a better fit (code as in current Hyper-V implementation).
> >Nevermind, its the right thing to do. Just separate the patchset
> >please:
> >
> >1) Create object properties.
> >2) Export VMWare CPUID via properties.
> >3) Convert Hyper-V.
> >
> >Be careful to make sure Hyper-V's current options are functional
> >in 3).
> >
> Did you mean 3 patch sets (or more)? Or just a different order?
>    -Don Slutz

Different order. Patches should be logically related (think of what
information the reviewer needs). Please write changelogs for
every patch.



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

* Re: [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
@ 2012-10-09 19:11             ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:11 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Tue, Oct 09, 2012 at 03:09:17PM -0400, Don Slutz wrote:
> On 10/09/12 14:47, Marcelo Tosatti wrote:
> >On Tue, Oct 09, 2012 at 03:27:26PM -0300, Marcelo Tosatti wrote:
> >>On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
> >>>On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
> >>>>Also known as Paravirtualization level.
> >>>>
> >>>>This change is based on:
> >>>>
> >>>>Microsoft Hypervisor CPUID Leaves:
> >>>>   http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> >>>>
> >>>>Linux kernel change starts with:
> >>>>   http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
> >>>>Also:
> >>>>   http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> >>>>
> >>>>VMware documention on CPUIDs (Mechanisms to determine if software is
> >>>>running in a VMware virtual machine):
> >>>>   http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
> >>>>
> >>>>QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
> >>>>
> >>>>Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> >>>>---
> >>>>  target-i386/kvm.c |    4 ++--
> >>>>  1 files changed, 2 insertions(+), 2 deletions(-)
> >>>>
> >>>>diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> >>>>index 895d848..8462c75 100644
> >>>>--- a/target-i386/kvm.c
> >>>>+++ b/target-i386/kvm.c
> >>>>@@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
> >>>>      c = &cpuid_data.entries[cpuid_i++];
> >>>>      memset(c, 0, sizeof(*c));
> >>>>      c->function = KVM_CPUID_SIGNATURE
> >>>>-    if (!hyperv_enabled()) {
> >>>>+    if (!env->cpuid_hv_level_set) {
> >>>>          memcpy(signature, "KVMKVMKVM\0\0\0", 12);
> >>>>          c->eax = 0;
> >>>>      } else {
> >>>>          memcpy(signature, "Microsoft Hv", 12);
> >>>>-        c->eax = HYPERV_CPUID_MIN;
> >>>>+        c->eax = env->cpuid_hv_level;
> >>>This breaks hyperv_enabled() checks.
> >>>
> >>>Don, are you certain it is worthwhile to make this configurable?
> >>>Can you explain why, under your scenario, it is worthwhile?
> >>>
> >>>Because these are separate problems:
> >>>
> >>>- "Fake" VMWare hypervisor  (which seems to be your main goal).
> >>>- Make CPUID HV leafs configurable via command line.
> >>Err, meant via properties. Point is, why have VMWare CPUID
> >>configuration as data, if there are reasons to believe code
> >>is a better fit (code as in current Hyper-V implementation).
> >Nevermind, its the right thing to do. Just separate the patchset
> >please:
> >
> >1) Create object properties.
> >2) Export VMWare CPUID via properties.
> >3) Convert Hyper-V.
> >
> >Be careful to make sure Hyper-V's current options are functional
> >in 3).
> >
> Did you mean 3 patch sets (or more)? Or just a different order?
>    -Don Slutz

Different order. Patches should be logically related (think of what
information the reviewer needs). Please write changelogs for
every patch.

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

* Re: [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
  2012-10-09 17:17       ` [Qemu-devel] " Marcelo Tosatti
@ 2012-10-09 19:12         ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-09 19:12 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On 10/09/12 13:17, Marcelo Tosatti wrote:
> On Tue, Oct 09, 2012 at 01:34:09PM -0300, Marcelo Tosatti wrote:
>> On Mon, Sep 24, 2012 at 10:32:06AM -0400, Don Slutz wrote:
>>> This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.
>>>
>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>> ---
>>>   target-i386/cpu.c |    9 +++++++++
>>>   target-i386/cpu.h |    2 ++
>>>   2 files changed, 11 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>>> index 451de12..48bdaf9 100644
>>> --- a/target-i386/cpu.c
>>> +++ b/target-i386/cpu.c
>>> @@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
>>>   }
>>>   
>>>   #if !defined(CONFIG_USER_ONLY)
>>> +static void x86_set_hyperv(Object *obj, Error **errp)
>>> +{
>>> +    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
>>> +                            "hypervisor-level", errp);
>>> +}
>>> +
>>>   static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
>>>                                    const char *name, Error **errp)
>>>   {
>>> @@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
>>>           return;
>>>       }
>>>       hyperv_set_spinlock_retries(value);
>>> +    x86_set_hyperv(obj, errp);
>>>   }
>>>   
>>>   static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
>>> @@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
>>>           return;
>>>       }
>>>       hyperv_enable_relaxed_timing(value);
>>> +    x86_set_hyperv(obj, errp);
>>>   }
>>>   
>>>   static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
>>> @@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
>>>           return;
>>>       }
>>>       hyperv_enable_vapic_recommended(value);
>>> +    x86_set_hyperv(obj, errp);
>>>   }
>>>   #endif
>>>   
>>> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
>>> index 1899f69..3152a4e 100644
>>> --- a/target-i386/cpu.h
>>> +++ b/target-i386/cpu.h
>>> @@ -488,6 +488,8 @@
>>>   
>>>   #define CPUID_VENDOR_VIA   "CentaurHauls"
>>>   
>>> +#define CPUID_HV_LEVEL_HYPERV  0x40000005
>>> +
>> Where this comes from?
>>
>> http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
>>
>> has under "Leaf 0x40000000" (at very top of table):
>>
>> EAX
>>
>> The maximum input value for hypervisor CPUID information. For Microsoft
>> hypervisors, this value will be at least 0x40000005. The vendor ID
>> signature should be used only for reporting and diagnostic purposes.
>>
>> Is that the same 0x40000005 as in this patch?
> Yes, the #define can be reused:
>
> #define HYPERV_CPUID_MIN                        0x40000005
>
Not as simple as it seems.

http://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg03359.html

I can make sure this info is part of the commit message.
     -Don Slutz

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

* Re: [Qemu-devel] [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
@ 2012-10-09 19:12         ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-09 19:12 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On 10/09/12 13:17, Marcelo Tosatti wrote:
> On Tue, Oct 09, 2012 at 01:34:09PM -0300, Marcelo Tosatti wrote:
>> On Mon, Sep 24, 2012 at 10:32:06AM -0400, Don Slutz wrote:
>>> This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.
>>>
>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>> ---
>>>   target-i386/cpu.c |    9 +++++++++
>>>   target-i386/cpu.h |    2 ++
>>>   2 files changed, 11 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>>> index 451de12..48bdaf9 100644
>>> --- a/target-i386/cpu.c
>>> +++ b/target-i386/cpu.c
>>> @@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
>>>   }
>>>   
>>>   #if !defined(CONFIG_USER_ONLY)
>>> +static void x86_set_hyperv(Object *obj, Error **errp)
>>> +{
>>> +    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
>>> +                            "hypervisor-level", errp);
>>> +}
>>> +
>>>   static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
>>>                                    const char *name, Error **errp)
>>>   {
>>> @@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
>>>           return;
>>>       }
>>>       hyperv_set_spinlock_retries(value);
>>> +    x86_set_hyperv(obj, errp);
>>>   }
>>>   
>>>   static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
>>> @@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
>>>           return;
>>>       }
>>>       hyperv_enable_relaxed_timing(value);
>>> +    x86_set_hyperv(obj, errp);
>>>   }
>>>   
>>>   static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
>>> @@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
>>>           return;
>>>       }
>>>       hyperv_enable_vapic_recommended(value);
>>> +    x86_set_hyperv(obj, errp);
>>>   }
>>>   #endif
>>>   
>>> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
>>> index 1899f69..3152a4e 100644
>>> --- a/target-i386/cpu.h
>>> +++ b/target-i386/cpu.h
>>> @@ -488,6 +488,8 @@
>>>   
>>>   #define CPUID_VENDOR_VIA   "CentaurHauls"
>>>   
>>> +#define CPUID_HV_LEVEL_HYPERV  0x40000005
>>> +
>> Where this comes from?
>>
>> http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
>>
>> has under "Leaf 0x40000000" (at very top of table):
>>
>> EAX
>>
>> The maximum input value for hypervisor CPUID information. For Microsoft
>> hypervisors, this value will be at least 0x40000005. The vendor ID
>> signature should be used only for reporting and diagnostic purposes.
>>
>> Is that the same 0x40000005 as in this patch?
> Yes, the #define can be reused:
>
> #define HYPERV_CPUID_MIN                        0x40000005
>
Not as simple as it seems.

http://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg03359.html

I can make sure this info is part of the commit message.
     -Don Slutz

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

* Re: [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
  2012-10-09 16:25   ` Marcelo Tosatti
@ 2012-10-09 19:13       ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-09 19:13 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On 10/09/12 12:25, Marcelo Tosatti wrote:
> On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
>> These are modeled after x86_cpuid_get_xlevel and x86_cpuid_set_xlevel.
>>
>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>> ---
>>   target-i386/cpu.c |   29 +++++++++++++++++++++++++++++
>>   1 files changed, 29 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>> index 25ca986..451de12 100644
>> --- a/target-i386/cpu.c
>> +++ b/target-i386/cpu.c
>> @@ -1166,6 +1166,32 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
>>       cpu->env.tsc_khz = value / 1000;
>>   }
>>   
>> +static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
>> +                                const char *name, Error **errp)
>> +{
>> +    X86CPU *cpu = X86_CPU(obj);
>> +
>> +    visit_type_uint32(v, &cpu->env.cpuid_hv_level, name, errp);
>> +}
>> +
>> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
>> +                                const char *name, Error **errp)
>> +{
>> +    X86CPU *cpu = X86_CPU(obj);
>> +    uint32_t value;
>> +
>> +    visit_type_uint32(v, &value, name, errp);
>> +    if (error_is_set(errp)) {
>> +        return;
>> +    }
>> +
>> +    if (value != 0 && value < 0x40000000) {
>> +        value += 0x40000000;
>> +    }
> Whats the purpose of this? Adds ambiguity.
Will add more info in this commit message.
    -Don

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

* Re: [Qemu-devel] [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
@ 2012-10-09 19:13       ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-09 19:13 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On 10/09/12 12:25, Marcelo Tosatti wrote:
> On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
>> These are modeled after x86_cpuid_get_xlevel and x86_cpuid_set_xlevel.
>>
>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>> ---
>>   target-i386/cpu.c |   29 +++++++++++++++++++++++++++++
>>   1 files changed, 29 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>> index 25ca986..451de12 100644
>> --- a/target-i386/cpu.c
>> +++ b/target-i386/cpu.c
>> @@ -1166,6 +1166,32 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
>>       cpu->env.tsc_khz = value / 1000;
>>   }
>>   
>> +static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void *opaque,
>> +                                const char *name, Error **errp)
>> +{
>> +    X86CPU *cpu = X86_CPU(obj);
>> +
>> +    visit_type_uint32(v, &cpu->env.cpuid_hv_level, name, errp);
>> +}
>> +
>> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
>> +                                const char *name, Error **errp)
>> +{
>> +    X86CPU *cpu = X86_CPU(obj);
>> +    uint32_t value;
>> +
>> +    visit_type_uint32(v, &value, name, errp);
>> +    if (error_is_set(errp)) {
>> +        return;
>> +    }
>> +
>> +    if (value != 0 && value < 0x40000000) {
>> +        value += 0x40000000;
>> +    }
> Whats the purpose of this? Adds ambiguity.
Will add more info in this commit message.
    -Don

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

* Re: [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
  2012-10-09 19:12         ` [Qemu-devel] " Don Slutz
@ 2012-10-09 19:15           ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:15 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Tue, Oct 09, 2012 at 03:12:00PM -0400, Don Slutz wrote:
> On 10/09/12 13:17, Marcelo Tosatti wrote:
> >On Tue, Oct 09, 2012 at 01:34:09PM -0300, Marcelo Tosatti wrote:
> >>On Mon, Sep 24, 2012 at 10:32:06AM -0400, Don Slutz wrote:
> >>>This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.
> >>>
> >>>Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> >>>---
> >>>  target-i386/cpu.c |    9 +++++++++
> >>>  target-i386/cpu.h |    2 ++
> >>>  2 files changed, 11 insertions(+), 0 deletions(-)
> >>>
> >>>diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> >>>index 451de12..48bdaf9 100644
> >>>--- a/target-i386/cpu.c
> >>>+++ b/target-i386/cpu.c
> >>>@@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
> >>>  }
> >>>  #if !defined(CONFIG_USER_ONLY)
> >>>+static void x86_set_hyperv(Object *obj, Error **errp)
> >>>+{
> >>>+    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
> >>>+                            "hypervisor-level", errp);
> >>>+}
> >>>+
> >>>  static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> >>>                                   const char *name, Error **errp)
> >>>  {
> >>>@@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> >>>          return;
> >>>      }
> >>>      hyperv_set_spinlock_retries(value);
> >>>+    x86_set_hyperv(obj, errp);
> >>>  }
> >>>  static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> >>>@@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> >>>          return;
> >>>      }
> >>>      hyperv_enable_relaxed_timing(value);
> >>>+    x86_set_hyperv(obj, errp);
> >>>  }
> >>>  }
> >>>  static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
> >>>@@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
> >>>          return;
> >>>      }
> >>>      hyperv_enable_vapic_recommended(value);
> >>>+    x86_set_hyperv(obj, errp);
> >>>  }
> >>>  #endif
> >>>diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> >>>index 1899f69..3152a4e 100644
> >>>--- a/target-i386/cpu.h
> >>>+++ b/target-i386/cpu.h
> >>>@@ -488,6 +488,8 @@
> >>>  #define CPUID_VENDOR_VIA   "CentaurHauls"
> >>>+#define CPUID_HV_LEVEL_HYPERV  0x40000005
> >>>+
> >>Where this comes from?
> >>
> >>http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> >>
> >>has under "Leaf 0x40000000" (at very top of table):
> >>
> >>EAX
> >>
> >>The maximum input value for hypervisor CPUID information. For Microsoft
> >>hypervisors, this value will be at least 0x40000005. The vendor ID
> >>signature should be used only for reporting and diagnostic purposes.
> >>
> >>Is that the same 0x40000005 as in this patch?
> >Yes, the #define can be reused:
> >
> >#define HYPERV_CPUID_MIN                        0x40000005
> >
> Not as simple as it seems.
> 
> http://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg03359.html
> 
> I can make sure this info is part of the commit message.
>     -Don Slutz

Ok add a copy but have CPUID_MIN in the name (because
CPUID_HV_LEVEL_HYPERV is very confusing). Add a comment 

/* maximum input value for h... 

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

* Re: [Qemu-devel] [PATCH v6 04/16] target-i386: Add x86_set_hyperv.
@ 2012-10-09 19:15           ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-09 19:15 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Tue, Oct 09, 2012 at 03:12:00PM -0400, Don Slutz wrote:
> On 10/09/12 13:17, Marcelo Tosatti wrote:
> >On Tue, Oct 09, 2012 at 01:34:09PM -0300, Marcelo Tosatti wrote:
> >>On Mon, Sep 24, 2012 at 10:32:06AM -0400, Don Slutz wrote:
> >>>This is used to set the cpu object's hypervisor level to the default for Microsoft's Hypervisor.
> >>>
> >>>Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> >>>---
> >>>  target-i386/cpu.c |    9 +++++++++
> >>>  target-i386/cpu.h |    2 ++
> >>>  2 files changed, 11 insertions(+), 0 deletions(-)
> >>>
> >>>diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> >>>index 451de12..48bdaf9 100644
> >>>--- a/target-i386/cpu.c
> >>>+++ b/target-i386/cpu.c
> >>>@@ -1193,6 +1193,12 @@ static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void *opaque,
> >>>  }
> >>>  #if !defined(CONFIG_USER_ONLY)
> >>>+static void x86_set_hyperv(Object *obj, Error **errp)
> >>>+{
> >>>+    object_property_set_int(obj, CPUID_HV_LEVEL_HYPERV,
> >>>+                            "hypervisor-level", errp);
> >>>+}
> >>>+
> >>>  static void x86_get_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> >>>                                   const char *name, Error **errp)
> >>>  {
> >>>@@ -1215,6 +1221,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, void *opaque,
> >>>          return;
> >>>      }
> >>>      hyperv_set_spinlock_retries(value);
> >>>+    x86_set_hyperv(obj, errp);
> >>>  }
> >>>  static void x86_get_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> >>>@@ -1235,6 +1242,7 @@ static void x86_set_hv_relaxed(Object *obj, Visitor *v, void *opaque,
> >>>          return;
> >>>      }
> >>>      hyperv_enable_relaxed_timing(value);
> >>>+    x86_set_hyperv(obj, errp);
> >>>  }
> >>>  }
> >>>  static void x86_get_hv_vapic(Object *obj, Visitor *v, void *opaque,
> >>>@@ -1255,6 +1263,7 @@ static void x86_set_hv_vapic(Object *obj, Visitor *v, void *opaque,
> >>>          return;
> >>>      }
> >>>      hyperv_enable_vapic_recommended(value);
> >>>+    x86_set_hyperv(obj, errp);
> >>>  }
> >>>  #endif
> >>>diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> >>>index 1899f69..3152a4e 100644
> >>>--- a/target-i386/cpu.h
> >>>+++ b/target-i386/cpu.h
> >>>@@ -488,6 +488,8 @@
> >>>  #define CPUID_VENDOR_VIA   "CentaurHauls"
> >>>+#define CPUID_HV_LEVEL_HYPERV  0x40000005
> >>>+
> >>Where this comes from?
> >>
> >>http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
> >>
> >>has under "Leaf 0x40000000" (at very top of table):
> >>
> >>EAX
> >>
> >>The maximum input value for hypervisor CPUID information. For Microsoft
> >>hypervisors, this value will be at least 0x40000005. The vendor ID
> >>signature should be used only for reporting and diagnostic purposes.
> >>
> >>Is that the same 0x40000005 as in this patch?
> >Yes, the #define can be reused:
> >
> >#define HYPERV_CPUID_MIN                        0x40000005
> >
> Not as simple as it seems.
> 
> http://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg03359.html
> 
> I can make sure this info is part of the commit message.
>     -Don Slutz

Ok add a copy but have CPUID_MIN in the name (because
CPUID_HV_LEVEL_HYPERV is very confusing). Add a comment 

/* maximum input value for h... 

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

* Re: [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm.
  2012-10-09 19:11             ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Marcelo Tosatti
@ 2012-10-10 13:03               ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-10 13:03 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On 10/09/12 15:11, Marcelo Tosatti wrote:
> On Tue, Oct 09, 2012 at 03:09:17PM -0400, Don Slutz wrote:
>> On 10/09/12 14:47, Marcelo Tosatti wrote:
>>> On Tue, Oct 09, 2012 at 03:27:26PM -0300, Marcelo Tosatti wrote:
>>>> On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
>>>>> On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
>>>>>> Also known as Paravirtualization level.
>>>>>>
>>>>>> This change is based on:
>>>>>>
>>>>>> Microsoft Hypervisor CPUID Leaves:
>>>>>>    http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
>>>>>>
>>>>>> Linux kernel change starts with:
>>>>>>    http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
>>>>>> Also:
>>>>>>    http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
>>>>>>
>>>>>> VMware documention on CPUIDs (Mechanisms to determine if software is
>>>>>> running in a VMware virtual machine):
>>>>>>    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
>>>>>>
>>>>>> QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
>>>>>>
>>>>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>>>>> ---
>>>>>>   target-i386/kvm.c |    4 ++--
>>>>>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
>>>>>> index 895d848..8462c75 100644
>>>>>> --- a/target-i386/kvm.c
>>>>>> +++ b/target-i386/kvm.c
>>>>>> @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>>>>>>       c = &cpuid_data.entries[cpuid_i++];
>>>>>>       memset(c, 0, sizeof(*c));
>>>>>>       c->function = KVM_CPUID_SIGNATURE
>>>>>> -    if (!hyperv_enabled()) {
>>>>>> +    if (!env->cpuid_hv_level_set) {
>>>>>>           memcpy(signature, "KVMKVMKVM\0\0\0", 12);
>>>>>>           c->eax = 0;
>>>>>>       } else {
>>>>>>           memcpy(signature, "Microsoft Hv", 12);
>>>>>> -        c->eax = HYPERV_CPUID_MIN;
>>>>>> +        c->eax = env->cpuid_hv_level;
>>>>> This breaks hyperv_enabled() checks.
>>>>>
>>>>> Don, are you certain it is worthwhile to make this configurable?
>>>>> Can you explain why, under your scenario, it is worthwhile?
>>>>>
>>>>> Because these are separate problems:
>>>>>
>>>>> - "Fake" VMWare hypervisor  (which seems to be your main goal).
>>>>> - Make CPUID HV leafs configurable via command line.
>>>> Err, meant via properties. Point is, why have VMWare CPUID
>>>> configuration as data, if there are reasons to believe code
>>>> is a better fit (code as in current Hyper-V implementation).
>>> Nevermind, its the right thing to do. Just separate the patchset
>>> please:
>>>
>>> 1) Create object properties.
>>> 2) Export VMWare CPUID via properties.
>>> 3) Convert Hyper-V.
>>>
>>> Be careful to make sure Hyper-V's current options are functional
>>> in 3).
>>>
>> Did you mean 3 patch sets (or more)? Or just a different order?
>>     -Don Slutz
> Different order. Patches should be logically related (think of what
> information the reviewer needs). Please write changelogs for
> every patch.
>
>
Using this order causes support for Hyper-V to stop working in the 
middle of the patch set.  How about this order:
1) Create object properties.
2) Convert Hyper-V to set the new properties.
3) Change kvm.c to use the new properties.
4) Export VMWare CPUID via properties.

5) Change accel=tcg to use the new properties.

    -Don Slutz


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

* Re: [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
@ 2012-10-10 13:03               ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-10 13:03 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On 10/09/12 15:11, Marcelo Tosatti wrote:
> On Tue, Oct 09, 2012 at 03:09:17PM -0400, Don Slutz wrote:
>> On 10/09/12 14:47, Marcelo Tosatti wrote:
>>> On Tue, Oct 09, 2012 at 03:27:26PM -0300, Marcelo Tosatti wrote:
>>>> On Tue, Oct 09, 2012 at 02:18:05PM -0300, Marcelo Tosatti wrote:
>>>>> On Mon, Sep 24, 2012 at 10:32:07AM -0400, Don Slutz wrote:
>>>>>> Also known as Paravirtualization level.
>>>>>>
>>>>>> This change is based on:
>>>>>>
>>>>>> Microsoft Hypervisor CPUID Leaves:
>>>>>>    http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
>>>>>>
>>>>>> Linux kernel change starts with:
>>>>>>    http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
>>>>>> Also:
>>>>>>    http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
>>>>>>
>>>>>> VMware documention on CPUIDs (Mechanisms to determine if software is
>>>>>> running in a VMware virtual machine):
>>>>>>    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
>>>>>>
>>>>>> QEMU knows this is KVM_CPUID_SIGNATURE (0x40000000).
>>>>>>
>>>>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>>>>> ---
>>>>>>   target-i386/kvm.c |    4 ++--
>>>>>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
>>>>>> index 895d848..8462c75 100644
>>>>>> --- a/target-i386/kvm.c
>>>>>> +++ b/target-i386/kvm.c
>>>>>> @@ -389,12 +389,12 @@ int kvm_arch_init_vcpu(CPUX86State *env)
>>>>>>       c = &cpuid_data.entries[cpuid_i++];
>>>>>>       memset(c, 0, sizeof(*c));
>>>>>>       c->function = KVM_CPUID_SIGNATURE
>>>>>> -    if (!hyperv_enabled()) {
>>>>>> +    if (!env->cpuid_hv_level_set) {
>>>>>>           memcpy(signature, "KVMKVMKVM\0\0\0", 12);
>>>>>>           c->eax = 0;
>>>>>>       } else {
>>>>>>           memcpy(signature, "Microsoft Hv", 12);
>>>>>> -        c->eax = HYPERV_CPUID_MIN;
>>>>>> +        c->eax = env->cpuid_hv_level;
>>>>> This breaks hyperv_enabled() checks.
>>>>>
>>>>> Don, are you certain it is worthwhile to make this configurable?
>>>>> Can you explain why, under your scenario, it is worthwhile?
>>>>>
>>>>> Because these are separate problems:
>>>>>
>>>>> - "Fake" VMWare hypervisor  (which seems to be your main goal).
>>>>> - Make CPUID HV leafs configurable via command line.
>>>> Err, meant via properties. Point is, why have VMWare CPUID
>>>> configuration as data, if there are reasons to believe code
>>>> is a better fit (code as in current Hyper-V implementation).
>>> Nevermind, its the right thing to do. Just separate the patchset
>>> please:
>>>
>>> 1) Create object properties.
>>> 2) Export VMWare CPUID via properties.
>>> 3) Convert Hyper-V.
>>>
>>> Be careful to make sure Hyper-V's current options are functional
>>> in 3).
>>>
>> Did you mean 3 patch sets (or more)? Or just a different order?
>>     -Don Slutz
> Different order. Patches should be logically related (think of what
> information the reviewer needs). Please write changelogs for
> every patch.
>
>
Using this order causes support for Hyper-V to stop working in the 
middle of the patch set.  How about this order:
1) Create object properties.
2) Convert Hyper-V to set the new properties.
3) Change kvm.c to use the new properties.
4) Export VMWare CPUID via properties.

5) Change accel=tcg to use the new properties.

    -Don Slutz

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

* Re: [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc,accel=tcg.
  2012-10-09 19:01     ` [Qemu-devel] [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc, accel=tcg Marcelo Tosatti
@ 2012-10-10 13:07       ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-10 13:07 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On 10/09/12 15:01, Marcelo Tosatti wrote:
> On Mon, Sep 24, 2012 at 10:32:08AM -0400, Don Slutz wrote:
>> Also known as Paravirtualization level.
>>
>> This change is based on:
>>
>> Microsoft Hypervisor CPUID Leaves:
>>    http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
>>
>> Linux kernel change starts with:
>>    http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
>> Also:
>>    http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
>>
>> VMware documention on CPUIDs (Mechanisms to determine if software is
>> running in a VMware virtual machine):
>>    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
>>
>> QEMU knows this as KVM_CPUID_SIGNATURE (0x40000000) in kvm on linux.
>>
>> This does not provide vendor support in tcg yet.
>>
>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>> ---
>>   target-i386/cpu.c |   27 +++++++++++++++++++++++++++
>>   1 files changed, 27 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>> index 48bdaf9..920278b 100644
>> --- a/target-i386/cpu.c
>> +++ b/target-i386/cpu.c
>> @@ -1651,6 +1651,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>>                   index =  env->cpuid_xlevel;
>>               }
>>           }
>> +    } else if (index & 0x40000000) {
>> +        if (env->cpuid_hv_level_set) {
>> +            uint32_t real_level = env->cpuid_hv_level;
>> +
>> +            /* Handle Hypervisor CPUIDs */
>> +            if (real_level < 0x40000000) {
>> +                real_level = 0x40000000;
>> +            }
>> +            if (index > real_level) {
>> +                index = real_level;
>> +            }
>> +        } else {
>> +            if (index > env->cpuid_level)
>> +                index = env->cpuid_level;
>> +        }
> Whats the purpose of this checks?
They control what happens for CPUID requests outside the defined 
ranges.  Very similar to code just above this.
>
> Please provide changelogs for each patch.
In progress.
>>       } else {
>>           if (index > env->cpuid_level)
>>               index = env->cpuid_level;
>> @@ -1789,6 +1804,18 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>>               *edx = 0;
>>           }
>>           break;
>> +    case 0x40000000:
>> +        *eax = env->cpuid_hv_level;
>> +        *ebx = 0;
>> +        *ecx = 0;
>> +        *edx = 0;
>> +        break;
>> +    case 0x40000001:
>> +        *eax = env->cpuid_kvm_features;
>> +        *ebx = 0;
>> +        *ecx = 0;
>> +        *edx = 0;
>> +        break;
>>       case 0x80000000:
>>           *eax = env->cpuid_xlevel;
>>           *ebx = env->cpuid_vendor1;
>> -- 
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
    -Don Slutz

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

* Re: [Qemu-devel] [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc, accel=tcg.
@ 2012-10-10 13:07       ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-10 13:07 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On 10/09/12 15:01, Marcelo Tosatti wrote:
> On Mon, Sep 24, 2012 at 10:32:08AM -0400, Don Slutz wrote:
>> Also known as Paravirtualization level.
>>
>> This change is based on:
>>
>> Microsoft Hypervisor CPUID Leaves:
>>    http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx
>>
>> Linux kernel change starts with:
>>    http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html
>> Also:
>>    http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
>>
>> VMware documention on CPUIDs (Mechanisms to determine if software is
>> running in a VMware virtual machine):
>>    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
>>
>> QEMU knows this as KVM_CPUID_SIGNATURE (0x40000000) in kvm on linux.
>>
>> This does not provide vendor support in tcg yet.
>>
>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>> ---
>>   target-i386/cpu.c |   27 +++++++++++++++++++++++++++
>>   1 files changed, 27 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>> index 48bdaf9..920278b 100644
>> --- a/target-i386/cpu.c
>> +++ b/target-i386/cpu.c
>> @@ -1651,6 +1651,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>>                   index =  env->cpuid_xlevel;
>>               }
>>           }
>> +    } else if (index & 0x40000000) {
>> +        if (env->cpuid_hv_level_set) {
>> +            uint32_t real_level = env->cpuid_hv_level;
>> +
>> +            /* Handle Hypervisor CPUIDs */
>> +            if (real_level < 0x40000000) {
>> +                real_level = 0x40000000;
>> +            }
>> +            if (index > real_level) {
>> +                index = real_level;
>> +            }
>> +        } else {
>> +            if (index > env->cpuid_level)
>> +                index = env->cpuid_level;
>> +        }
> Whats the purpose of this checks?
They control what happens for CPUID requests outside the defined 
ranges.  Very similar to code just above this.
>
> Please provide changelogs for each patch.
In progress.
>>       } else {
>>           if (index > env->cpuid_level)
>>               index = env->cpuid_level;
>> @@ -1789,6 +1804,18 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>>               *edx = 0;
>>           }
>>           break;
>> +    case 0x40000000:
>> +        *eax = env->cpuid_hv_level;
>> +        *ebx = 0;
>> +        *ecx = 0;
>> +        *edx = 0;
>> +        break;
>> +    case 0x40000001:
>> +        *eax = env->cpuid_kvm_features;
>> +        *ebx = 0;
>> +        *ecx = 0;
>> +        *edx = 0;
>> +        break;
>>       case 0x80000000:
>>           *eax = env->cpuid_xlevel;
>>           *ebx = env->cpuid_vendor1;
>> -- 
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
    -Don Slutz

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

* Re: [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm.
  2012-10-10 13:03               ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Don Slutz
@ 2012-10-10 14:08                 ` Marcelo Tosatti
  -1 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-10 14:08 UTC (permalink / raw)
  To: Don Slutz
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On Wed, Oct 10, 2012 at 09:03:20AM -0400, Don Slutz wrote:
> >>Did you mean 3 patch sets (or more)? Or just a different order?
> >>    -Don Slutz
> >Different order. Patches should be logically related (think of what
> >information the reviewer needs). Please write changelogs for
> >every patch.
> >
> >
> Using this order causes support for Hyper-V to stop working in the
> middle of the patch set.  How about this order:
> 1) Create object properties.
> 2) Convert Hyper-V to set the new properties.
> 3) Change kvm.c to use the new properties.
> 4) Export VMWare CPUID via properties.
> 
> 5) Change accel=tcg to use the new properties.
> 
>    -Don Slutz

Fine, as long as change from item A) does not leak to item B).


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

* Re: [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.
@ 2012-10-10 14:08                 ` Marcelo Tosatti
  0 siblings, 0 replies; 72+ messages in thread
From: Marcelo Tosatti @ 2012-10-10 14:08 UTC (permalink / raw)
  To: Don Slutz
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On Wed, Oct 10, 2012 at 09:03:20AM -0400, Don Slutz wrote:
> >>Did you mean 3 patch sets (or more)? Or just a different order?
> >>    -Don Slutz
> >Different order. Patches should be logically related (think of what
> >information the reviewer needs). Please write changelogs for
> >every patch.
> >
> >
> Using this order causes support for Hyper-V to stop working in the
> middle of the patch set.  How about this order:
> 1) Create object properties.
> 2) Convert Hyper-V to set the new properties.
> 3) Change kvm.c to use the new properties.
> 4) Export VMWare CPUID via properties.
> 
> 5) Change accel=tcg to use the new properties.
> 
>    -Don Slutz

Fine, as long as change from item A) does not leak to item B).

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

* Re: [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
  2012-10-09 19:13       ` [Qemu-devel] " Don Slutz
@ 2012-10-10 15:22         ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-10 15:22 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: qemu-devel, ehabkost, imammedo, avi, afaerber, peter.maydell,
	kvm, anthony

On 10/09/12 15:13, Don Slutz wrote:
> On 10/09/12 12:25, Marcelo Tosatti wrote:
>> On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
>>> These are modeled after x86_cpuid_get_xlevel and x86_cpuid_set_xlevel.
>>>
>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>> ---
>>>   target-i386/cpu.c |   29 +++++++++++++++++++++++++++++
>>>   1 files changed, 29 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>>> index 25ca986..451de12 100644
>>> --- a/target-i386/cpu.c
>>> +++ b/target-i386/cpu.c
>>> @@ -1166,6 +1166,32 @@ static void x86_cpuid_set_tsc_freq(Object 
>>> *obj, Visitor *v, void *opaque,
>>>       cpu->env.tsc_khz = value / 1000;
>>>   }
>>>   +static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void 
>>> *opaque,
>>> +                                const char *name, Error **errp)
>>> +{
>>> +    X86CPU *cpu = X86_CPU(obj);
>>> +
>>> +    visit_type_uint32(v, &cpu->env.cpuid_hv_level, name, errp);
>>> +}
>>> +
>>> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void 
>>> *opaque,
>>> +                                const char *name, Error **errp)
>>> +{
>>> +    X86CPU *cpu = X86_CPU(obj);
>>> +    uint32_t value;
>>> +
>>> +    visit_type_uint32(v, &value, name, errp);
>>> +    if (error_is_set(errp)) {
>>> +        return;
>>> +    }
>>> +
>>> +    if (value != 0 && value < 0x40000000) {
>>> +        value += 0x40000000;
>>> +    }
>> Whats the purpose of this? Adds ambiguity.
> Will add more info in this commit message.
>    -Don
> -- 
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Not clear on how to add info in the commit message.

This is direct copy with adjustment from x86_cpuid_set_xlevel():

     if (value < 0x80000000) {
         value += 0x80000000;
     }

(Pending patch: 
http://comments.gmane.org/gmane.comp.emulators.qemu/172703 adds this)

The adjustment is that 0 is a legal value. See 
http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

This does mean that just like xlevel=1 and xlevel=0x80000001 are the 
same; hypervisor-level=1 and hypervisor-level=0x4000001 are the same.  
If this is not wanted, I have no issue with removing it.

    -Don Slutz

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

* Re: [Qemu-devel] [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
@ 2012-10-10 15:22         ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-10 15:22 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: peter.maydell, ehabkost, kvm, qemu-devel, avi, anthony, imammedo,
	afaerber

On 10/09/12 15:13, Don Slutz wrote:
> On 10/09/12 12:25, Marcelo Tosatti wrote:
>> On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
>>> These are modeled after x86_cpuid_get_xlevel and x86_cpuid_set_xlevel.
>>>
>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>> ---
>>>   target-i386/cpu.c |   29 +++++++++++++++++++++++++++++
>>>   1 files changed, 29 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
>>> index 25ca986..451de12 100644
>>> --- a/target-i386/cpu.c
>>> +++ b/target-i386/cpu.c
>>> @@ -1166,6 +1166,32 @@ static void x86_cpuid_set_tsc_freq(Object 
>>> *obj, Visitor *v, void *opaque,
>>>       cpu->env.tsc_khz = value / 1000;
>>>   }
>>>   +static void x86_cpuid_get_hv_level(Object *obj, Visitor *v, void 
>>> *opaque,
>>> +                                const char *name, Error **errp)
>>> +{
>>> +    X86CPU *cpu = X86_CPU(obj);
>>> +
>>> +    visit_type_uint32(v, &cpu->env.cpuid_hv_level, name, errp);
>>> +}
>>> +
>>> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void 
>>> *opaque,
>>> +                                const char *name, Error **errp)
>>> +{
>>> +    X86CPU *cpu = X86_CPU(obj);
>>> +    uint32_t value;
>>> +
>>> +    visit_type_uint32(v, &value, name, errp);
>>> +    if (error_is_set(errp)) {
>>> +        return;
>>> +    }
>>> +
>>> +    if (value != 0 && value < 0x40000000) {
>>> +        value += 0x40000000;
>>> +    }
>> Whats the purpose of this? Adds ambiguity.
> Will add more info in this commit message.
>    -Don
> -- 
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Not clear on how to add info in the commit message.

This is direct copy with adjustment from x86_cpuid_set_xlevel():

     if (value < 0x80000000) {
         value += 0x80000000;
     }

(Pending patch: 
http://comments.gmane.org/gmane.comp.emulators.qemu/172703 adds this)

The adjustment is that 0 is a legal value. See 
http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html

This does mean that just like xlevel=1 and xlevel=0x80000001 are the 
same; hypervisor-level=1 and hypervisor-level=0x4000001 are the same.  
If this is not wanted, I have no issue with removing it.

    -Don Slutz

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

* Re: [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
  2012-10-10 15:22         ` [Qemu-devel] " Don Slutz
@ 2012-10-10 15:40           ` Andreas Färber
  -1 siblings, 0 replies; 72+ messages in thread
From: Andreas Färber @ 2012-10-10 15:40 UTC (permalink / raw)
  To: Don Slutz, Igor Mammedov
  Cc: Marcelo Tosatti, qemu-devel, ehabkost, avi, peter.maydell, kvm, anthony

Am 10.10.2012 17:22, schrieb Don Slutz:
> On 10/09/12 15:13, Don Slutz wrote:
>> On 10/09/12 12:25, Marcelo Tosatti wrote:
>>> On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
>>>> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void
>>>> *opaque,
>>>> +                                const char *name, Error **errp)
>>>> +{
>>>> +    X86CPU *cpu = X86_CPU(obj);
>>>> +    uint32_t value;
>>>> +
>>>> +    visit_type_uint32(v, &value, name, errp);
>>>> +    if (error_is_set(errp)) {
>>>> +        return;
>>>> +    }
>>>> +
>>>> +    if (value != 0 && value < 0x40000000) {
>>>> +        value += 0x40000000;
>>>> +    }
>>> Whats the purpose of this? Adds ambiguity.
[...]
> This is direct copy with adjustment from x86_cpuid_set_xlevel():
> 
>     if (value < 0x80000000) {
>         value += 0x80000000;
>     }
> 
> (Pending patch:
> http://comments.gmane.org/gmane.comp.emulators.qemu/172703 adds this)

(Any pending patch can be changed ;))

> The adjustment is that 0 is a legal value. See
> http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> 
> This does mean that just like xlevel=1 and xlevel=0x80000001 are the
> same; hypervisor-level=1 and hypervisor-level=0x4000001 are the same. 
> If this is not wanted, I have no issue with removing it.

I have no strong opinion either way, but if there's only one call site,
I'd prefer to apply these fixups to user input before setting the
property and to have the property setter error out on invalid values. I
consider that cleaner than silently fixing up values inside the setter.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
@ 2012-10-10 15:40           ` Andreas Färber
  0 siblings, 0 replies; 72+ messages in thread
From: Andreas Färber @ 2012-10-10 15:40 UTC (permalink / raw)
  To: Don Slutz, Igor Mammedov
  Cc: peter.maydell, ehabkost, kvm, Marcelo Tosatti, qemu-devel, avi, anthony

Am 10.10.2012 17:22, schrieb Don Slutz:
> On 10/09/12 15:13, Don Slutz wrote:
>> On 10/09/12 12:25, Marcelo Tosatti wrote:
>>> On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
>>>> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void
>>>> *opaque,
>>>> +                                const char *name, Error **errp)
>>>> +{
>>>> +    X86CPU *cpu = X86_CPU(obj);
>>>> +    uint32_t value;
>>>> +
>>>> +    visit_type_uint32(v, &value, name, errp);
>>>> +    if (error_is_set(errp)) {
>>>> +        return;
>>>> +    }
>>>> +
>>>> +    if (value != 0 && value < 0x40000000) {
>>>> +        value += 0x40000000;
>>>> +    }
>>> Whats the purpose of this? Adds ambiguity.
[...]
> This is direct copy with adjustment from x86_cpuid_set_xlevel():
> 
>     if (value < 0x80000000) {
>         value += 0x80000000;
>     }
> 
> (Pending patch:
> http://comments.gmane.org/gmane.comp.emulators.qemu/172703 adds this)

(Any pending patch can be changed ;))

> The adjustment is that 0 is a legal value. See
> http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
> 
> This does mean that just like xlevel=1 and xlevel=0x80000001 are the
> same; hypervisor-level=1 and hypervisor-level=0x4000001 are the same. 
> If this is not wanted, I have no issue with removing it.

I have no strong opinion either way, but if there's only one call site,
I'd prefer to apply these fixups to user input before setting the
property and to have the property setter error out on invalid values. I
consider that cleaner than silently fixing up values inside the setter.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
  2012-10-10 15:40           ` [Qemu-devel] " Andreas Färber
@ 2012-10-11 22:20             ` Don Slutz
  -1 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-11 22:20 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Igor Mammedov, Marcelo Tosatti, qemu-devel, ehabkost, avi,
	peter.maydell, kvm, anthony

On 10/10/12 11:40, Andreas Färber wrote:
> Am 10.10.2012 17:22, schrieb Don Slutz:
>> On 10/09/12 15:13, Don Slutz wrote:
>>> On 10/09/12 12:25, Marcelo Tosatti wrote:
>>>> On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
>>>>> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void
>>>>> *opaque,
>>>>> +                                const char *name, Error **errp)
>>>>> +{
>>>>> +    X86CPU *cpu = X86_CPU(obj);
>>>>> +    uint32_t value;
>>>>> +
>>>>> +    visit_type_uint32(v, &value, name, errp);
>>>>> +    if (error_is_set(errp)) {
>>>>> +        return;
>>>>> +    }
>>>>> +
>>>>> +    if (value != 0 && value < 0x40000000) {
>>>>> +        value += 0x40000000;
>>>>> +    }
>>>> Whats the purpose of this? Adds ambiguity.
> [...]
>> This is direct copy with adjustment from x86_cpuid_set_xlevel():
>>
>>      if (value < 0x80000000) {
>>          value += 0x80000000;
>>      }
>>
>> (Pending patch:
>> http://comments.gmane.org/gmane.comp.emulators.qemu/172703 adds this)
> (Any pending patch can be changed ;))
>
>> The adjustment is that 0 is a legal value. See
>> http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
>>
>> This does mean that just like xlevel=1 and xlevel=0x80000001 are the
>> same; hypervisor-level=1 and hypervisor-level=0x4000001 are the same.
>> If this is not wanted, I have no issue with removing it.
> I have no strong opinion either way, but if there's only one call site,
> I'd prefer to apply these fixups to user input before setting the
> property and to have the property setter error out on invalid values. I
> consider that cleaner than silently fixing up values inside the setter.
>
> Regards,
> Andreas
>
I find more then one call site.  And one of them is converting the 
predefined x86 cpus (like 486).  So I am not planning on a change.

I have finished up the v7 changes except for this.  I will wait until 
some time tomorrow to send it in case there is more on this topic.
     -Don Slutz



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

* Re: [Qemu-devel] [PATCH v6 03/16] target-i386: Add cpu object access routines for Hypervisor level.
@ 2012-10-11 22:20             ` Don Slutz
  0 siblings, 0 replies; 72+ messages in thread
From: Don Slutz @ 2012-10-11 22:20 UTC (permalink / raw)
  To: Andreas Färber
  Cc: peter.maydell, ehabkost, kvm, Marcelo Tosatti, qemu-devel, avi,
	anthony, Igor Mammedov

On 10/10/12 11:40, Andreas Färber wrote:
> Am 10.10.2012 17:22, schrieb Don Slutz:
>> On 10/09/12 15:13, Don Slutz wrote:
>>> On 10/09/12 12:25, Marcelo Tosatti wrote:
>>>> On Mon, Sep 24, 2012 at 10:32:05AM -0400, Don Slutz wrote:
>>>>> +static void x86_cpuid_set_hv_level(Object *obj, Visitor *v, void
>>>>> *opaque,
>>>>> +                                const char *name, Error **errp)
>>>>> +{
>>>>> +    X86CPU *cpu = X86_CPU(obj);
>>>>> +    uint32_t value;
>>>>> +
>>>>> +    visit_type_uint32(v, &value, name, errp);
>>>>> +    if (error_is_set(errp)) {
>>>>> +        return;
>>>>> +    }
>>>>> +
>>>>> +    if (value != 0 && value < 0x40000000) {
>>>>> +        value += 0x40000000;
>>>>> +    }
>>>> Whats the purpose of this? Adds ambiguity.
> [...]
>> This is direct copy with adjustment from x86_cpuid_set_xlevel():
>>
>>      if (value < 0x80000000) {
>>          value += 0x80000000;
>>      }
>>
>> (Pending patch:
>> http://comments.gmane.org/gmane.comp.emulators.qemu/172703 adds this)
> (Any pending patch can be changed ;))
>
>> The adjustment is that 0 is a legal value. See
>> http://lkml.indiana.edu/hypermail/linux/kernel/1205.0/00100.html
>>
>> This does mean that just like xlevel=1 and xlevel=0x80000001 are the
>> same; hypervisor-level=1 and hypervisor-level=0x4000001 are the same.
>> If this is not wanted, I have no issue with removing it.
> I have no strong opinion either way, but if there's only one call site,
> I'd prefer to apply these fixups to user input before setting the
> property and to have the property setter error out on invalid values. I
> consider that cleaner than silently fixing up values inside the setter.
>
> Regards,
> Andreas
>
I find more then one call site.  And one of them is converting the 
predefined x86 cpus (like 486).  So I am not planning on a change.

I have finished up the v7 changes except for this.  I will wait until 
some time tomorrow to send it in case there is more on this topic.
     -Don Slutz

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

end of thread, other threads:[~2012-10-11 22:20 UTC | newest]

Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-24 14:32 [PATCH v6 00/16] Allow changing of Hypervisor CPUIDs Don Slutz
2012-09-24 14:32 ` [Qemu-devel] " Don Slutz
2012-09-24 14:32 ` [PATCH v6 01/16] target-i386: Add missing kvm bits Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-09-24 14:32 ` [PATCH v6 02/16] target-i386: Add Hypervisor level Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-09-24 14:32 ` [PATCH v6 03/16] target-i386: Add cpu object access routines for " Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-10-09 16:25   ` Marcelo Tosatti
2012-10-09 19:13     ` Don Slutz
2012-10-09 19:13       ` [Qemu-devel] " Don Slutz
2012-10-10 15:22       ` Don Slutz
2012-10-10 15:22         ` [Qemu-devel] " Don Slutz
2012-10-10 15:40         ` Andreas Färber
2012-10-10 15:40           ` [Qemu-devel] " Andreas Färber
2012-10-11 22:20           ` Don Slutz
2012-10-11 22:20             ` [Qemu-devel] " Don Slutz
2012-09-24 14:32 ` [PATCH v6 04/16] target-i386: Add x86_set_hyperv Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-10-09 16:34   ` Marcelo Tosatti
2012-10-09 17:17     ` Marcelo Tosatti
2012-10-09 17:17       ` [Qemu-devel] " Marcelo Tosatti
2012-10-09 19:12       ` Don Slutz
2012-10-09 19:12         ` [Qemu-devel] " Don Slutz
2012-10-09 19:15         ` Marcelo Tosatti
2012-10-09 19:15           ` [Qemu-devel] " Marcelo Tosatti
2012-09-24 14:32 ` [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm Don Slutz
2012-09-24 14:32   ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Don Slutz
2012-10-09 17:18   ` [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm Marcelo Tosatti
2012-10-09 17:18     ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Marcelo Tosatti
2012-10-09 18:27     ` Marcelo Tosatti
2012-10-09 18:27       ` [Qemu-devel] " Marcelo Tosatti
2012-10-09 18:47       ` Marcelo Tosatti
2012-10-09 18:47         ` [Qemu-devel] " Marcelo Tosatti
2012-10-09 19:09         ` [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm Don Slutz
2012-10-09 19:09           ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Don Slutz
2012-10-09 19:11           ` [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm Marcelo Tosatti
2012-10-09 19:11             ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Marcelo Tosatti
2012-10-10 13:03             ` [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm Don Slutz
2012-10-10 13:03               ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Don Slutz
2012-10-10 14:08               ` [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc,accel=kvm Marcelo Tosatti
2012-10-10 14:08                 ` [Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm Marcelo Tosatti
2012-09-24 14:32 ` [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc,accel=tcg Don Slutz
2012-09-24 14:32   ` [Qemu-devel] [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc, accel=tcg Don Slutz
2012-10-09 19:01   ` [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc,accel=tcg Marcelo Tosatti
2012-10-09 19:01     ` [Qemu-devel] [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc, accel=tcg Marcelo Tosatti
2012-10-10 13:07     ` [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc,accel=tcg Don Slutz
2012-10-10 13:07       ` [Qemu-devel] [PATCH v6 06/16] target-i386: Use Hypervisor level in -machine pc, accel=tcg Don Slutz
2012-09-24 14:32 ` [PATCH v6 07/16] target-i386: Add Hypervisor vendor Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-09-24 14:32 ` [PATCH v6 08/16] target-i386: Add cpu object access routines for " Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-10-09 19:02   ` Marcelo Tosatti
2012-10-09 19:02     ` [Qemu-devel] " Marcelo Tosatti
2012-09-24 14:32 ` [PATCH v6 09/16] target-i386: Use Hypervisor vendor in -machine pc,accel=kvm Don Slutz
2012-09-24 14:32   ` [Qemu-devel] [PATCH v6 09/16] target-i386: Use Hypervisor vendor in -machine pc, accel=kvm Don Slutz
2012-09-24 14:32 ` [PATCH v6 10/16] target-i386: Use Hypervisor vendor in -machine pc,accel=tcg Don Slutz
2012-09-24 14:32   ` [Qemu-devel] [PATCH v6 10/16] target-i386: Use Hypervisor vendor in -machine pc, accel=tcg Don Slutz
2012-09-24 14:32 ` [PATCH v6 11/16] target-i386: Add some known names to Hypervisor vendor Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-09-24 14:32 ` [PATCH v6 12/16] target-i386: Add optional Hypervisor leaf extra Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-09-24 14:32 ` [PATCH v6 13/16] target-i386: Add cpu object access routines for " Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-09-24 14:32 ` [PATCH v6 14/16] target-i386: Add setting of Hypervisor leaf extra for known vmare4 Don Slutz
2012-09-24 14:32   ` [Qemu-devel] " Don Slutz
2012-10-09 19:09   ` Marcelo Tosatti
2012-10-09 19:09     ` [Qemu-devel] " Marcelo Tosatti
2012-09-24 14:32 ` [PATCH v6 15/16] target-i386: Use Hypervisor leaf extra in -machine pc,accel=kvm Don Slutz
2012-09-24 14:32   ` [Qemu-devel] [PATCH v6 15/16] target-i386: Use Hypervisor leaf extra in -machine pc, accel=kvm Don Slutz
2012-09-24 14:32 ` [PATCH v6 16/16] target-i386: Use Hypervisor leaf extra in -machine pc,accel=tcg Don Slutz
2012-09-24 14:32   ` [Qemu-devel] [PATCH v6 16/16] target-i386: Use Hypervisor leaf extra in -machine pc, accel=tcg Don Slutz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.