qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH uq/master V2] kvm: Add CPUID support for VIA CPU


From: BrillyWu
Subject: Re: [Qemu-devel] [PATCH uq/master V2] kvm: Add CPUID support for VIA CPU
Date: Mon, 30 May 2011 12:02:12 +0800

Hi, Jan
> 
> > @@ -855,6 +870,8 @@ int cpu_x86_register (CPUX86State *env,
> >      env->cpuid_xlevel = def->xlevel;
> >      env->cpuid_kvm_features = def->kvm_features;
> >      env->cpuid_svm_features = def->svm_features;
> > +    env->cpuid_ext4_features = def->ext4_features;
> > +    env->cpuid_xlevel2 = def->xlevel2;
> >      if (!kvm_enabled()) {
> >          env->cpuid_features &= TCG_FEATURES;
> >          env->cpuid_ext_features &= TCG_EXT_FEATURES; @@ -1034,7
> > +1051,12 @@ void cpu_x86_cpuid(CPUX86State *env, uin
> >                     uint32_t *ecx, uint32_t *edx)  {
> >      /* test if maximum index reached */
> > -    if (index & 0x80000000) {
> > +    if ((index & 0xC000000f) == index) {
> 
> This condition can't be correct. It triggers on every index <= 15 and 
> breaks qemu.

I'm so sorry to make such a stupid mistake. Thank you very for your revieview.

> 
> > +        /* Handle the Centaur's CPUID instruction. */
> > +        if (index > env->cpuid_xlevel2) {
> > +            index = env->cpuid_xlevel2;
> > +        }
> > +    } else if (index & 0x80000000) {
> 
> Your very first version looked like this:

The first version has some problem, so you could ignore it.

> 
> -    if (index & 0x80000000) {
> +    if ((index & 0xC0000000) == 0xC0000000) {
> +     /* Handle the Centaur's CPUID instruction.*
> +     * If cpuid_xlevel2 is "0", then put into the*
> +     * default case. */
> +     if (env->cpuid_xlevel2 == 0)
> +         index = 0xF0000000;
> +     else if (index > env->cpuid_xlevel2)
> +         index = env->cpuid_xlevel2;
> +    } else if (index & 0x80000000) {
> 
> Something went wrong here, please re-validate the patch carefully.

Ok, I will check it soon. 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]