Skip to contentSkip to conversation

enable architectural PMU cpuid leaf for kvm

PATCH In review Gleb Natapov 2 participants 3 messages Dec 15, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 enable architectural PMU cpuid leaf for kvm

target-i386/cpuid.c +13 -4
index 0b3af90..91a104b 100644
@@ -1180,10 +1180,19 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         break;
     case 0xA:
         /* Architectural Performance Monitoring Leaf */
-        *eax = 0;
-        *ebx = 0;
-        *ecx = 0;
-        *edx = 0;
+        if (kvm_enabled()) {
+            KVMState *s = env->kvm_state;
+
+            *eax = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EAX);
+            *ebx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EBX);
+            *ecx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_ECX);
+            *edx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EDX);
+        } else {
+            *eax = 0;
+            *ebx = 0;
+            *ecx = 0;
+            *edx = 0;
+        }
         break;
     case 0xD:
         /* Processor Extended State */

--
Gleb.

#1 lore raw
Quoted 2 lines · Gleb Natapov

This should go in via uq/master.

Regards,

Anthony Liguori

Quoted 32 lines
target-i386/cpuid.c +13 -5
index 0b3af90..91a104b 100644
@@ -1180,10 +1180,19 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
          break;
      case 0xA:
          /* Architectural Performance Monitoring Leaf */
-        *eax = 0;
-        *ebx = 0;
-        *ecx = 0;
-        *edx = 0;
+        if (kvm_enabled()) {
+            KVMState *s = env->kvm_state;
+
+            *eax = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EAX);
+            *ebx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EBX);
+            *ecx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_ECX);
+            *edx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EDX);
+        } else {
+            *eax = 0;
+            *ebx = 0;
+            *ecx = 0;
+            *edx = 0;
+        }
          break;
      case 0xD:
          /* Processor Extended State */
--

Gleb.

#2 lore raw
Quoted 5 lines · Anthony Liguori
Quoted 2 lines · Gleb Natapov

This should go in via uq/master.

uq/master maintainers can you take it?

Quoted 29 lines

Regards,

Anthony Liguori

Quoted 24 lines
target-i386/cpuid.c +12 -4
index 0b3af90..91a104b 100644
@@ -1180,10 +1180,19 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         break;
     case 0xA:
         /* Architectural Performance Monitoring Leaf */
-        *eax = 0;
-        *ebx = 0;
-        *ecx = 0;
-        *edx = 0;
+        if (kvm_enabled()) {
+            KVMState *s = env->kvm_state;
+
+            *eax = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EAX);
+            *ebx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EBX);
+            *ecx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_ECX);
+            *edx = kvm_arch_get_supported_cpuid(s, 0xA, count, R_EDX);
+        } else {
+            *eax = 0;
+            *ebx = 0;
+            *ecx = 0;
+            *edx = 0;
Quoted 8 lines
Quoted 8 lines
target-i386/cpuid.c +1 -1
+        }
         break;
     case 0xD:
         /* Processor Extended State */
--

Gleb.

--
Gleb.