This patchset adds support for VMX TSC scaling feature which is available on Intel Skylake CPU. The specification of VMX TSC scaling can be found at http://www.intel.com/content/www/us/en/processors/timestamp-counter-scaling-virtualization-white-paper.html
VMX TSC scaling allows guest TSC which is read by guest rdtsc(p) instructions increases in a rate that is customized by the hypervisor and can be different than the host TSC rate. Basically, VMX TSC scaling adds a 64-bit field called TSC multiplier in VMCS so that, if VMX TSC scaling is enabled, TSC read by guest rdtsc(p) instructions will be calculated by the following formula: guest EDX:EAX = (Host TSC * TSC multiplier) >> 48 + VMX TSC Offset where, Host TSC = Host MSR_IA32_TSC + Host MSR_IA32_TSC_ADJUST. This patchset is composed of following four parts. 1. PATCH 01 - 02 fix bugs in tsc_get_info() which could result in errors when VMX TSC scaling is used. 2. PATCH 03 - 09 add/move the common parts of VMX TSC scaling and SVM TSC ratio to hvm.c and x86/time.c. 3. PATCH 10 - 12 implement the VMX-specific code for supporting VMX TSC scaling. 4. PATCH 13 adapts libxl for VMX TSC scaling (as well as SVM TSC ratio). Haozhong Zhang (13): x86/time.c: Use system time to calculate elapsed_nsec in tsc_get_info() x86/time.c: Get the correct guest TSC rate in tsc_get_info() x86/hvm: Collect information of TSC scaling ratio x86/hvm: Setup TSC scaling ratio x86/hvm: Replace architecture TSC scaling by a common function x86/hvm: Scale host TSC when setting/getting guest TSC x86/hvm: Move saving/loading vcpu's TSC to common code x86/hvm: Detect TSC scaling through hvm_funcs in tsc_set_info() x86/time.c: Scale host TSC in pvclock properly vmx: Detect and initialize VMX RDTSC(P) scaling vmx: Use scaled host TSC to calculate TSC offset vmx: Add a call-back to apply TSC scaling ratio to hardware tools/libxl: Add 'vtsc_khz' option to set guest TSC rate tools/libxl/libxl_types.idl | 1 + tools/libxl/libxl_x86.c | 4 +- tools/libxl/xl_cmdimpl.c | 22 ++++++++ xen/arch/x86/hvm/hvm.c | 110 +++++++++++++++++++++++++++++++++---- xen/arch/x86/hvm/svm/svm.c | 25 ++++++--- xen/arch/x86/hvm/vmx/vmcs.c | 11 +++- xen/arch/x86/hvm/vmx/vmx.c | 39 +++++++++++-- xen/arch/x86/time.c | 33 ++++++++--- xen/include/asm-x86/domain.h | 2 + xen/include/asm-x86/hvm/hvm.h | 19 +++++++ xen/include/asm-x86/hvm/svm/svm.h | 4 +- xen/include/asm-x86/hvm/vmx/vmcs.h | 7 +++ 12 files changed, 240 insertions(+), 37 deletions(-) -- 2.4.8 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel