Message ID | 20200904145431.196885-10-vkuznets@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | i386: KVM: expand Hyper-V features early | expand |
On Fri, Sep 04, 2020 at 04:54:18PM +0200, Vitaly Kuznetsov wrote: > As a preparation to expanding Hyper-V CPU features early, add > reserved FEAT_HYPERV_ECX CPUID leaf. > > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> > --- > target/i386/cpu.c | 5 +++++ > target/i386/cpu.h | 1 + > target/i386/kvm.c | 2 ++ > 3 files changed, 8 insertions(+) > > diff --git a/target/i386/cpu.c b/target/i386/cpu.c > index ef3c672cf415..70588571ccb1 100644 > --- a/target/i386/cpu.c > +++ b/target/i386/cpu.c > @@ -974,6 +974,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { > }, > .cpuid = { .eax = 0x40000003, .reg = R_EBX, }, > }, > + [FEAT_HYPERV_ECX] = { > + .type = CPUID_FEATURE_WORD, > + /* reserved */ What does "reserved" mean here? > + .cpuid = { .eax = 0x40000003, .reg = R_ECX, }, > + }, > [FEAT_HYPERV_EDX] = { > .type = CPUID_FEATURE_WORD, > .feat_names = { > diff --git a/target/i386/cpu.h b/target/i386/cpu.h > index 095d0bf75493..39e0e89aa41f 100644 > --- a/target/i386/cpu.h > +++ b/target/i386/cpu.h > @@ -521,6 +521,7 @@ typedef enum FeatureWord { > FEAT_KVM_HINTS, /* CPUID[4000_0001].EDX */ > FEAT_HYPERV_EAX, /* CPUID[4000_0003].EAX */ > FEAT_HYPERV_EBX, /* CPUID[4000_0003].EBX */ > + FEAT_HYPERV_ECX, /* CPUID[4000_0003].ECX */ > FEAT_HYPERV_EDX, /* CPUID[4000_0003].EDX */ > FEAT_HV_RECOMM_EAX, /* CPUID[4000_0004].EAX */ > FEAT_HV_NESTED_EAX, /* CPUID[4000_000A].EAX */ > diff --git a/target/i386/kvm.c b/target/i386/kvm.c > index 96ac719adca1..259be2d514dd 100644 > --- a/target/i386/kvm.c > +++ b/target/i386/kvm.c > @@ -1251,6 +1251,7 @@ static int hyperv_handle_properties(CPUState *cs, > if (c) { > env->features[FEAT_HYPERV_EAX] = c->eax; > env->features[FEAT_HYPERV_EBX] = c->ebx; > + env->features[FEAT_HYPERV_ECX] = c->ecx; > env->features[FEAT_HYPERV_EDX] = c->edx; > } > > @@ -1350,6 +1351,7 @@ static int hyperv_handle_properties(CPUState *cs, > c->function = HV_CPUID_FEATURES; > c->eax = env->features[FEAT_HYPERV_EAX]; > c->ebx = env->features[FEAT_HYPERV_EBX]; > + c->ecx = env->features[FEAT_HYPERV_ECX]; > c->edx = env->features[FEAT_HYPERV_EDX]; > > c = &cpuid_ent[cpuid_i++]; > -- > 2.25.4 >
Eduardo Habkost <ehabkost@redhat.com> writes: > On Fri, Sep 04, 2020 at 04:54:18PM +0200, Vitaly Kuznetsov wrote: >> As a preparation to expanding Hyper-V CPU features early, add >> reserved FEAT_HYPERV_ECX CPUID leaf. >> >> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> >> --- >> target/i386/cpu.c | 5 +++++ >> target/i386/cpu.h | 1 + >> target/i386/kvm.c | 2 ++ >> 3 files changed, 8 insertions(+) >> >> diff --git a/target/i386/cpu.c b/target/i386/cpu.c >> index ef3c672cf415..70588571ccb1 100644 >> --- a/target/i386/cpu.c >> +++ b/target/i386/cpu.c >> @@ -974,6 +974,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { >> }, >> .cpuid = { .eax = 0x40000003, .reg = R_EBX, }, >> }, >> + [FEAT_HYPERV_ECX] = { >> + .type = CPUID_FEATURE_WORD, >> + /* reserved */ > > What does "reserved" mean here? This is actually from TLFS, these bits are currently reserved and there are no features represented by them. We can, of course, short-circuit this to '0' but I'd prefer to keep it for consistency. I can change to something like 'Reserved as of TLFS v6.0b' to make it clear. > >> + .cpuid = { .eax = 0x40000003, .reg = R_ECX, }, >> + }, >> [FEAT_HYPERV_EDX] = { >> .type = CPUID_FEATURE_WORD, >> .feat_names = { >> diff --git a/target/i386/cpu.h b/target/i386/cpu.h >> index 095d0bf75493..39e0e89aa41f 100644 >> --- a/target/i386/cpu.h >> +++ b/target/i386/cpu.h >> @@ -521,6 +521,7 @@ typedef enum FeatureWord { >> FEAT_KVM_HINTS, /* CPUID[4000_0001].EDX */ >> FEAT_HYPERV_EAX, /* CPUID[4000_0003].EAX */ >> FEAT_HYPERV_EBX, /* CPUID[4000_0003].EBX */ >> + FEAT_HYPERV_ECX, /* CPUID[4000_0003].ECX */ >> FEAT_HYPERV_EDX, /* CPUID[4000_0003].EDX */ >> FEAT_HV_RECOMM_EAX, /* CPUID[4000_0004].EAX */ >> FEAT_HV_NESTED_EAX, /* CPUID[4000_000A].EAX */ >> diff --git a/target/i386/kvm.c b/target/i386/kvm.c >> index 96ac719adca1..259be2d514dd 100644 >> --- a/target/i386/kvm.c >> +++ b/target/i386/kvm.c >> @@ -1251,6 +1251,7 @@ static int hyperv_handle_properties(CPUState *cs, >> if (c) { >> env->features[FEAT_HYPERV_EAX] = c->eax; >> env->features[FEAT_HYPERV_EBX] = c->ebx; >> + env->features[FEAT_HYPERV_ECX] = c->ecx; >> env->features[FEAT_HYPERV_EDX] = c->edx; >> } >> >> @@ -1350,6 +1351,7 @@ static int hyperv_handle_properties(CPUState *cs, >> c->function = HV_CPUID_FEATURES; >> c->eax = env->features[FEAT_HYPERV_EAX]; >> c->ebx = env->features[FEAT_HYPERV_EBX]; >> + c->ecx = env->features[FEAT_HYPERV_ECX]; >> c->edx = env->features[FEAT_HYPERV_EDX]; >> >> c = &cpuid_ent[cpuid_i++]; >> -- >> 2.25.4 >>
diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ef3c672cf415..70588571ccb1 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -974,6 +974,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, .cpuid = { .eax = 0x40000003, .reg = R_EBX, }, }, + [FEAT_HYPERV_ECX] = { + .type = CPUID_FEATURE_WORD, + /* reserved */ + .cpuid = { .eax = 0x40000003, .reg = R_ECX, }, + }, [FEAT_HYPERV_EDX] = { .type = CPUID_FEATURE_WORD, .feat_names = { diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 095d0bf75493..39e0e89aa41f 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -521,6 +521,7 @@ typedef enum FeatureWord { FEAT_KVM_HINTS, /* CPUID[4000_0001].EDX */ FEAT_HYPERV_EAX, /* CPUID[4000_0003].EAX */ FEAT_HYPERV_EBX, /* CPUID[4000_0003].EBX */ + FEAT_HYPERV_ECX, /* CPUID[4000_0003].ECX */ FEAT_HYPERV_EDX, /* CPUID[4000_0003].EDX */ FEAT_HV_RECOMM_EAX, /* CPUID[4000_0004].EAX */ FEAT_HV_NESTED_EAX, /* CPUID[4000_000A].EAX */ diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 96ac719adca1..259be2d514dd 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1251,6 +1251,7 @@ static int hyperv_handle_properties(CPUState *cs, if (c) { env->features[FEAT_HYPERV_EAX] = c->eax; env->features[FEAT_HYPERV_EBX] = c->ebx; + env->features[FEAT_HYPERV_ECX] = c->ecx; env->features[FEAT_HYPERV_EDX] = c->edx; } @@ -1350,6 +1351,7 @@ static int hyperv_handle_properties(CPUState *cs, c->function = HV_CPUID_FEATURES; c->eax = env->features[FEAT_HYPERV_EAX]; c->ebx = env->features[FEAT_HYPERV_EBX]; + c->ecx = env->features[FEAT_HYPERV_ECX]; c->edx = env->features[FEAT_HYPERV_EDX]; c = &cpuid_ent[cpuid_i++];
As a preparation to expanding Hyper-V CPU features early, add reserved FEAT_HYPERV_ECX CPUID leaf. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- target/i386/cpu.c | 5 +++++ target/i386/cpu.h | 1 + target/i386/kvm.c | 2 ++ 3 files changed, 8 insertions(+)