]> xenbits.xensource.com Git - people/royger/xen.git/commit
x86/vmx: fix vmentry failure with TSX bits in LBR
authorSergey Dyasli <sergey.dyasli@citrix.com>
Thu, 23 Feb 2017 09:33:27 +0000 (09:33 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 27 Feb 2017 10:22:24 +0000 (10:22 +0000)
commitd6e9f8d4f35d938417f9dc2ea50f6e8004e26725
treecf2848615b752418934736bca81d383e68c3fb24
parent7f11aa4b2b1ff6f47da772aa4e532a891dc13c70
x86/vmx: fix vmentry failure with TSX bits in LBR

During VM entry, H/W will automatically load guest's MSRs from MSR-load
area in the same way as they would be written by WRMSR.

However, under the following conditions:

    1. LBR (Last Branch Record) MSRs were placed in the MSR-load area
    2. Address format of LBR includes TSX bits 61:62
    3. CPU has TSX support disabled

VM entry will fail with a message in the log similar to:

    (XEN) [   97.239514] d1v0 vmentry failure (reason 0x80000022): MSR loading (entry 3)
    (XEN) [   97.239516]   msr 00000680 val 1fff800000102e60 (mbz 0)

This happens because of the following behaviour:

    - When capturing branches, LBR H/W will always clear bits 61:62
      regardless of the sign extension
    - For WRMSR, bits 61:62 are considered the part of the sign extension

This bug affects only certain pCPUs (e.g. Haswell) with vCPUs that
use LBR.  Fix it by sign-extending TSX bits in all LBR entries during
VM entry in affected cases.

LBR MSRs are currently not Live Migrated. In order to implement such
functionality, the MSR levelling work has to be done first because
hosts can have different LBR formats.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/cpufeature.h
xen/include/asm-x86/hvm/vmx/vmcs.h
xen/include/asm-x86/msr-index.h