diff mbox series

[RFC,10/22] i386: add reserved FEAT_HV_RECOMM_ECX/FEAT_HV_RECOMM_EDX CPUID leaves

Message ID 20200904145431.196885-11-vkuznets@redhat.com (mailing list archive)
State New, archived
Headers show
Series i386: KVM: expand Hyper-V features early | expand

Commit Message

Vitaly Kuznetsov Sept. 4, 2020, 2:54 p.m. UTC
As a preparation to expanding Hyper-V CPU features early, add reserved
FEAT_HV_RECOMM_ECX/FEAT_HV_RECOMM_EDX CPUID leaves.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 target/i386/cpu.c | 10 ++++++++++
 target/i386/cpu.h |  2 ++
 target/i386/kvm.c |  5 +++++
 3 files changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 70588571ccb1..3665f22093e9 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1021,6 +1021,16 @@  static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = { .eax = 0x40000004, .reg = R_EAX, },
     },
+    [FEAT_HV_RECOMM_ECX] = {
+        .type = CPUID_FEATURE_WORD,
+        /* reserved */
+        .cpuid = { .eax = 0x40000004, .reg = R_ECX, },
+    },
+    [FEAT_HV_RECOMM_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        /* reserved */
+        .cpuid = { .eax = 0x40000004, .reg = R_EDX, },
+    },
     [FEAT_HV_NESTED_EAX] = {
         .type = CPUID_FEATURE_WORD,
         .cpuid = { .eax = 0x4000000A, .reg = R_EAX, },
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 39e0e89aa41f..0668fe74df4f 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -524,6 +524,8 @@  typedef enum FeatureWord {
     FEAT_HYPERV_ECX,    /* CPUID[4000_0003].ECX */
     FEAT_HYPERV_EDX,    /* CPUID[4000_0003].EDX */
     FEAT_HV_RECOMM_EAX, /* CPUID[4000_0004].EAX */
+    FEAT_HV_RECOMM_ECX, /* CPUID[4000_0004].ECX */
+    FEAT_HV_RECOMM_EDX, /* CPUID[4000_0004].EDX */
     FEAT_HV_NESTED_EAX, /* CPUID[4000_000A].EAX */
     FEAT_SVM,           /* CPUID[8000_000A].EDX */
     FEAT_XSAVE,         /* CPUID[EAX=0xd,ECX=1].EAX */
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 259be2d514dd..c18f221cd301 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -1267,7 +1267,10 @@  static int hyperv_handle_properties(CPUState *cs,
         if (c) {
             env->features[FEAT_HV_RECOMM_EAX] = c->eax;
             cpu->hyperv_spinlock_attempts = c->ebx;
+            env->features[FEAT_HV_RECOMM_ECX] = c->ecx;
+            env->features[FEAT_HV_RECOMM_EDX] = c->edx;
         }
+
         c = cpuid_find_entry(cpuid, HV_CPUID_NESTED_FEATURES, 0);
         if (c) {
             env->features[FEAT_HV_NESTED_EAX] = c->eax;
@@ -1358,6 +1361,8 @@  static int hyperv_handle_properties(CPUState *cs,
     c->function = HV_CPUID_ENLIGHTMENT_INFO;
     c->eax = env->features[FEAT_HV_RECOMM_EAX];
     c->ebx = cpu->hyperv_spinlock_attempts;
+    c->ecx = env->features[FEAT_HV_RECOMM_ECX];
+    c->edx = env->features[FEAT_HV_RECOMM_EDX];
 
     c = &cpuid_ent[cpuid_i++];
     c->function = HV_CPUID_IMPLEMENT_LIMITS;