Re: [PATCH 2/3] target-i386: Introduce x86_cpu_load_host_data() function

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

 



On Mon, 20 Jun 2016 17:12:43 -0300
Eduardo Habkost <ehabkost@xxxxxxxxxx> wrote:

> The code that loads host-specific information inside
> x86_cpu_realizefn() will be reused by the implementation of
> query-host-cpu, so move it to a separate function.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
> ---
>  target-i386/cpu.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index aadd0b9..3d3635d 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -1491,6 +1491,20 @@ void x86_cpu_change_kvm_default(const char
> *prop, const char *value) static uint32_t
> x86_cpu_get_supported_feature_word(FeatureWord w, bool
> migratable_only); 
> +/* Load host-dependent CPU information, when applicable */
> +static void x86_cpu_load_host_data(X86CPU *cpu)
> +{
> +    CPUX86State *env = &cpu->env;
> +    FeatureWord w;
> +
> +    if (cpu->host_features) {
> +        for (w = 0; w < FEATURE_WORDS; w++) {
> +            env->features[w] =
> +                x86_cpu_get_supported_feature_word(w,
> cpu->migratable);
> +        }
> +    }
> +}
> +
>  #ifdef CONFIG_KVM
>  
>  static int cpu_x86_fill_model_id(char *str)
> @@ -3012,18 +3026,13 @@ static void x86_cpu_realizefn(DeviceState
> *dev, Error **errp) return;
>      }
>  
> +    x86_cpu_load_host_data(cpu);
this function should be below TODO comment as it applies to moved
code.

with this fixed
Reviewed-by: Igor Mammedov <imammedo@xxxxxxxxxx>

> +
>      /*TODO: cpu->host_features incorrectly overwrites features
>       * set using "feat=on|off". Once we fix this, we can convert
>       * plus_features & minus_features to global properties
>       * inside x86_cpu_parse_featurestr() too.
>       */
> -    if (cpu->host_features) {
> -        for (w = 0; w < FEATURE_WORDS; w++) {
> -            env->features[w] =
> -                x86_cpu_get_supported_feature_word(w,
> cpu->migratable);
> -        }
> -    }
> -
>      for (w = 0; w < FEATURE_WORDS; w++) {
>          cpu->env.features[w] |= plus_features[w];
>          cpu->env.features[w] &= ~minus_features[w];

--
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]