]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commit
x86/msr: Handle MSR_TSC_AUX consistently for PV and HVM guests
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 15 Nov 2018 21:04:37 +0000 (21:04 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 18 Dec 2018 17:13:51 +0000 (17:13 +0000)
commit5f5a7a6d3669fb94fa15daf563e5dc54cc9dbece
treeccbdf489cfebc8976ca48c48bb8e915ca20010e5
parent06b988f3e07a9581e7c2ef5ae119524c0c13fed7
x86/msr: Handle MSR_TSC_AUX consistently for PV and HVM guests

With PVRDTSCP mode removed, handling of MSR_TSC_AUX can move into the common
code.  Move its storage into struct vcpu_msrs (dropping the HVM-specific
msr_tsc_aux), and add an RDPID feature check as this bit also enumerates the
presence of the MSR.

Introduce cpu_has_rdpid along with the synthesized cpu_has_msr_tsc_aux to
correct the context switch paths, as MSR_TSC_AUX is enumerated by either
RDTSCP or RDPID.

Drop hvm_msr_tsc_aux() entirely, and use v->arch.msrs->tsc_aux directly.
Update hvm_load_cpu_ctxt() to check that the incoming ctxt.msr_tsc_aux isn't
out of range.  In practice, no previous version of Xen ever wrote an
out-of-range value.  Add MSR_TSC_AUX to the list of MSRs migrated for PV
guests, but leave the HVM path using the existing space in hvm_hw_cpu.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Brian Woods <brian.woods@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/domain.c
xen/arch/x86/domctl.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/msr.c
xen/arch/x86/pv/emul-priv-op.c
xen/include/asm-x86/cpufeature.h
xen/include/asm-x86/hvm/hvm.h
xen/include/asm-x86/hvm/vcpu.h
xen/include/asm-x86/msr.h