Re: [Qemu-devel] [PATCH 4/4] kvm: Trim cpu features not supported by kvm

Mark McLoughlin
2009-05-12T11:52:44Z

On Sun, 2009-05-03 at 17:04 +0300, Avi Kivity wrote:
> Remove cpu features that are not supported by kvm from the cpuid features
> reported to the guest.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
....
> @@ -1699,5 +1714,20 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
>
> qemu_init_vcpu(env);
>
> + if (kvm_enabled()) {
> + kvm_trim_features(&env->cpuid_features,
> + kvm_arch_get_supported_cpuid(env, 1, R_EDX),
> + feature_name);

This isn't work in qemu.git because the features are only queried from
qemu_init_vcpu() (see kvm_arch_init_vcpu())

The obvious fix is to move qemu_init_vcpu() after the feature trimming,
but that requires us to split env->kvm_state initialization out of
kvm_init_vcpu()

Also, it works in qemu-kvm.git, but only because actually call
kvm_qemu_init_env() twice - once before feature trimming and once after.

Cheers,
Mark.