diff mbox series

[RFC,11/22] i386: add reserved FEAT_HV_NESTED_EBX/ECX/EDX CPUID leaves

Message ID 20200904145431.196885-12-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_NESTED_EBX/ECX/EDX CPUID leaves.

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

Patch

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3665f22093e9..479c4bbbf459 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1035,6 +1035,21 @@  static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         .type = CPUID_FEATURE_WORD,
         .cpuid = { .eax = 0x4000000A, .reg = R_EAX, },
     },
+    [FEAT_HV_NESTED_EBX] = {
+        .type = CPUID_FEATURE_WORD,
+        /* reserved */
+        .cpuid = { .eax = 0x4000000A, .reg = R_EBX, },
+    },
+    [FEAT_HV_NESTED_ECX] = {
+        .type = CPUID_FEATURE_WORD,
+        /* reserved */
+        .cpuid = { .eax = 0x4000000A, .reg = R_ECX, },
+    },
+    [FEAT_HV_NESTED_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        /* reserved */
+        .cpuid = { .eax = 0x4000000A, .reg = R_EDX, },
+    },
     [FEAT_SVM] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 0668fe74df4f..0aad60e0c707 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -527,6 +527,9 @@  typedef enum FeatureWord {
     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_HV_NESTED_EBX, /* CPUID[4000_000A].EBX */
+    FEAT_HV_NESTED_ECX, /* CPUID[4000_000A].ECX */
+    FEAT_HV_NESTED_EDX, /* CPUID[4000_000A].EDX */
     FEAT_SVM,           /* CPUID[8000_000A].EDX */
     FEAT_XSAVE,         /* CPUID[EAX=0xd,ECX=1].EAX */
     FEAT_6_EAX,         /* CPUID[6].EAX */
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index c18f221cd301..87b83a2aa2cb 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -1274,6 +1274,9 @@  static int hyperv_handle_properties(CPUState *cs,
         c = cpuid_find_entry(cpuid, HV_CPUID_NESTED_FEATURES, 0);
         if (c) {
             env->features[FEAT_HV_NESTED_EAX] = c->eax;
+            env->features[FEAT_HV_NESTED_EBX] = c->ebx;
+            env->features[FEAT_HV_NESTED_ECX] = c->ecx;
+            env->features[FEAT_HV_NESTED_EDX] = c->edx;
         }
     }
 
@@ -1384,6 +1387,9 @@  static int hyperv_handle_properties(CPUState *cs,
         c = &cpuid_ent[cpuid_i++];
         c->function = HV_CPUID_NESTED_FEATURES;
         c->eax = env->features[FEAT_HV_NESTED_EAX];
+        c->ebx = env->features[FEAT_HV_NESTED_EBX];
+        c->ecx = env->features[FEAT_HV_NESTED_ECX];
+        c->edx = env->features[FEAT_HV_NESTED_EDX];
     }
     r = cpuid_i;