qemu-devel
[Top][All Lists]
Advanced

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

Re: [PULL 20/59] target/i386: kvm: initialize microcode revision from KV


From: Alex Williamson
Subject: Re: [PULL 20/59] target/i386: kvm: initialize microcode revision from KVM
Date: Thu, 6 Feb 2020 16:24:12 -0700

On Thu, 23 Jan 2020 14:50:10 +0100
Paolo Bonzini <address@hidden> wrote:

> KVM can return the host microcode revision as a feature MSR.
> Use it as the default value for -cpu host.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> Message-Id: <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  target/i386/cpu.c | 4 ++++
>  target/i386/kvm.c | 5 +++++
>  2 files changed, 9 insertions(+)

Hey Paolo,

My Windows 10 VM boot loops with this :-\  It seems to be related to
the CPU model.  Now fails (host-passthrough):

-cpu 
host,hv-time,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-vendor-id=KeenlyKVM,kvm=off

Works (host-model):

-cpu 
IvyBridge-IBRS,ss=on,vmx=on,pcid=on,hypervisor=on,arat=on,tsc-adjust=on,umip=on,md-clear=on,stibp=on,arch-capabilities=on,ssbd=on,xsaveopt=on,skip-l1dfl-vmentry=on,hv-time,hv-relaxed,hv-vapic,hv-spinlocks=0x1fff,hv-vendor-id=KeenlyKVM,kvm=off

Thanks,
Alex

> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 790254e..ffe5de0 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -6416,6 +6416,10 @@ static void x86_cpu_realizefn(DeviceState *dev, Error 
> **errp)
>                         &cpu->mwait.ecx, &cpu->mwait.edx);
>              env->features[FEAT_1_ECX] |= CPUID_EXT_MONITOR;
>          }
> +        if (kvm_enabled() && cpu->ucode_rev == 0) {
> +            cpu->ucode_rev = kvm_arch_get_supported_msr_feature(kvm_state,
> +                                                                
> MSR_IA32_UCODE_REV);
> +        }
>      }
>  
>      if (cpu->ucode_rev == 0) {
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index f6dd6b7..1b67090 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -2696,6 +2696,11 @@ static void kvm_init_msrs(X86CPU *cpu)
>                            env->features[FEAT_CORE_CAPABILITY]);
>      }
>  
> +    if (kvm_arch_get_supported_msr_feature(kvm_state,
> +                                           MSR_IA32_UCODE_REV)) {
> +        kvm_msr_entry_add(cpu, MSR_IA32_UCODE_REV, cpu->ucode_rev);
> +    }
> +
>      /*
>       * Older kernels do not include VMX MSRs in KVM_GET_MSR_INDEX_LIST, but
>       * all kernels with MSR features should have them.




reply via email to

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