lkml.org 
[lkml]   [2019]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 417/434] kvm: x86: Host feature SSBD doesnt imply guest feature AMD_SSBD
    Date
    From: Jim Mattson <jmattson@google.com>

    commit 8715f05269bfbc6453e25e80825d781a82902f8e upstream.

    The host reports support for the synthetic feature X86_FEATURE_SSBD
    when any of the three following hardware features are set:
    CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31]
    CPUID.80000008H:EBX.AMD_SSBD[bit 24]
    CPUID.80000008H:EBX.VIRT_SSBD[bit 25]

    Either of the first two hardware features implies the existence of the
    IA32_SPEC_CTRL MSR, but CPUID.80000008H:EBX.VIRT_SSBD[bit 25] does
    not. Therefore, CPUID.80000008H:EBX.AMD_SSBD[bit 24] should only be
    set in the guest if CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] or
    CPUID.80000008H:EBX.AMD_SSBD[bit 24] is set on the host.

    Fixes: 4c6903a0f9d76 ("KVM: x86: fix reporting of AMD speculation bug CPUID leaf")
    Signed-off-by: Jim Mattson <jmattson@google.com>
    Reviewed-by: Jacob Xu <jacobhxu@google.com>
    Reviewed-by: Peter Shier <pshier@google.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: stable@vger.kernel.org
    Reported-by: Eric Biggers <ebiggers@kernel.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    arch/x86/kvm/cpuid.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    --- a/arch/x86/kvm/cpuid.c
    +++ b/arch/x86/kvm/cpuid.c
    @@ -760,7 +760,8 @@ static inline int __do_cpuid_func(struct
    entry->ebx |= F(AMD_IBRS);
    if (boot_cpu_has(X86_FEATURE_STIBP))
    entry->ebx |= F(AMD_STIBP);
    - if (boot_cpu_has(X86_FEATURE_SSBD))
    + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) ||
    + boot_cpu_has(X86_FEATURE_AMD_SSBD))
    entry->ebx |= F(AMD_SSBD);
    if (!boot_cpu_has_bug(X86_BUG_SPEC_STORE_BYPASS))
    entry->ebx |= F(AMD_SSB_NO);

    \
     
     \ /
      Last update: 2019-12-29 18:58    [W:5.158 / U:0.564 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site