• Maciej S. Szmigiero's avatar
    KVM: x86: Give a hint when Win2016 might fail to boot due to XSAVES erratum · d52734d0
    Maciej S. Szmigiero authored
    Since commit b0563468 ("x86/CPU/AMD: Disable XSAVES on AMD family 0x17")
    kernel unconditionally clears the XSAVES CPU feature bit on Zen1/2 CPUs.
    
    Because KVM CPU caps are initialized from the kernel boot CPU features this
    makes the XSAVES feature also unavailable for KVM guests in this case.
    At the same time the XSAVEC feature is left enabled.
    
    Unfortunately, having XSAVEC but no XSAVES in CPUID breaks Hyper-V enabled
    Windows Server 2016 VMs that have more than one vCPU.
    
    Let's at least give users hint in the kernel log what could be wrong since
    these VMs currently simply hang at boot with a black screen - giving no
    clue what suddenly broke them and how to make them work again.
    
    Trigger the kernel message hint based on the particular guest ID written to
    the Guest OS Identity Hyper-V MSR implemented by KVM.
    
    Defer this check to when the L1 Hyper-V hypervisor enables SVM in EFER
    since we want to limit this message to Hyper-V enabled Windows guests only
    (Windows session running nested as L2) but the actual Guest OS Identity MSR
    write is done by L1 and happens before it enables SVM.
    
    Fixes: b0563468 ("x86/CPU/AMD: Disable XSAVES on AMD family 0x17")
    Signed-off-by: default avatarMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Message-Id: <b83ab45c5e239e5d148b0ae7750133a67ac9575c.1706127425.git.maciej.szmigiero@oracle.com>
    [Move some checks before mutex_lock(), rename function. - Paolo]
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    d52734d0
hyperv.c 76.7 KB