Re: [Qemu-devel] [PATCH qom-cpu 4/9] target-i386: Replace cpuid_*features fields with a feature word array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 02, 2013 at 01:03:01AM +0200, Andreas Färber wrote:
> Am 22.04.2013 21:00, schrieb Eduardo Habkost:
> > This replaces the feature-bit fields on both X86CPU and x86_def_t
> > structs with an array.
> > 
> > With this, we will be able to simplify code that simply does the same
> > operation on all feature words (e.g. kvm_check_features_against_host(),
> > filter_features_for_kvm(), add_flagname_to_bitmaps(), CPU feature-bit
> > property lookup/registration, and the proposed "feature-words" property)
> > 
> > The following field replacements were made on X86CPU and x86_def_t:
> > 
> >   (cpuid_)features         -> features[FEAT_1_EDX]
> >   (cpuid_)ext_features     -> features[FEAT_1_ECX]
> >   (cpuid_)ext2_features    -> features[FEAT_8000_0001_EDX]
> >   (cpuid_)ext3_features    -> features[FEAT_8000_0001_ECX]
> >   (cpuid_)ext4_features    -> features[FEAT_C000_0001_EDX]
> >   (cpuid_)kvm_features     -> features[FEAT_KVM]
> >   (cpuid_)svm_features     -> features[FEAT_SVM]
> >   (cpuid_)7_0_ebx_features -> features[FEAT_7_0_EBX]
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
> > Reviewed-By: Igor Mammedov <imammedo@xxxxxxxxxx>
> [...]
> > diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> > index 73ae2ef..110ef98 100644
> > --- a/target-i386/cpu.c
> > +++ b/target-i386/cpu.c
> [...]
> > @@ -1490,22 +1485,22 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char *features, Error **errp)
> >          }
> >          featurestr = strtok(NULL, ",");
> >      }
> > -    env->cpuid_features |= plus_features[FEAT_1_EDX];
> > -    env->cpuid_ext_features |= plus_features[FEAT_1_ECX];
> > -    env->cpuid_ext2_features |= plus_features[FEAT_8000_0001_EDX];
> > -    env->cpuid_ext3_features |= plus_features[FEAT_8000_0001_ECX];
> > -    env->cpuid_ext4_features |= plus_features[FEAT_C000_0001_EDX];
> > -    env->cpuid_kvm_features |= plus_features[FEAT_KVM];
> > -    env->cpuid_svm_features |= plus_features[FEAT_SVM];
> > -    env->cpuid_7_0_ebx_features |= plus_features[FEAT_7_0_EBX];
> > -    env->cpuid_features &= ~minus_features[FEAT_1_EDX];
> > -    env->cpuid_ext_features &= ~minus_features[FEAT_1_ECX];
> > -    env->cpuid_ext2_features &= ~minus_features[FEAT_8000_0001_EDX];
> > -    env->cpuid_ext3_features &= ~minus_features[FEAT_8000_0001_ECX];
> > -    env->cpuid_ext4_features &= ~minus_features[FEAT_C000_0001_EDX];
> > -    env->cpuid_kvm_features &= ~minus_features[FEAT_KVM];
> > -    env->cpuid_svm_features &= ~minus_features[FEAT_SVM];
> > -    env->cpuid_7_0_ebx_features &= ~minus_features[FEAT_7_0_EBX];
> > +    env->features[FEAT_1_EDX] |= plus_features[FEAT_1_EDX];
> > +    env->features[FEAT_1_ECX] |= plus_features[FEAT_1_ECX];
> > +    env->features[FEAT_8000_0001_EDX] |= plus_features[FEAT_8000_0001_EDX];
> > +    env->features[FEAT_8000_0001_ECX] |= plus_features[FEAT_8000_0001_ECX];
> > +    env->features[FEAT_C000_0001_EDX] |= plus_features[FEAT_C000_0001_EDX];
> > +    env->features[FEAT_KVM] |= plus_features[FEAT_KVM];
> > +    env->features[FEAT_SVM] |= plus_features[FEAT_SVM];
> > +    env->features[FEAT_7_0_EBX] |= plus_features[FEAT_7_0_EBX];
> > +    env->features[FEAT_1_EDX] &= ~minus_features[FEAT_1_EDX];
> > +    env->features[FEAT_1_ECX] &= ~minus_features[FEAT_1_ECX];
> > +    env->features[FEAT_8000_0001_EDX] &= ~minus_features[FEAT_8000_0001_EDX];
> > +    env->features[FEAT_8000_0001_ECX] &= ~minus_features[FEAT_8000_0001_ECX];
> > +    env->features[FEAT_C000_0001_EDX] &= ~minus_features[FEAT_C000_0001_EDX];
> > +    env->features[FEAT_KVM] &= ~minus_features[FEAT_KVM];
> > +    env->features[FEAT_SVM] &= ~minus_features[FEAT_SVM];
> > +    env->features[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX];
> >  
> >  out:
> >      return;
> 
> Can this be done in a loop as a follow-up?

Yes, that was exactly the plan. :-)

But it's something to be done after 1.5, I guess?

-- 
Eduardo

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]