]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: X86: Add functions that calculate the nested TSC fields
authorIlias Stamatis <ilstam@amazon.com>
Wed, 26 May 2021 18:44:14 +0000 (19:44 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Jun 2021 17:09:29 +0000 (13:09 -0400)
commit538520e18b86056e5810080d050bcb2c7f76f4da
treeba42c0ea93773743d40a0838151496eace71a8f2
parent155cd4cef11d09ad55dfeaf2f675ad2da079f750
KVM: X86: Add functions that calculate the nested TSC fields

When L2 is entered we need to "merge" the TSC multiplier and TSC offset
values of 01 and 12 together.

The merging is done using the following equations:
  offset_02 = ((offset_01 * mult_12) >> shift_bits) + offset_12
  mult_02 = (mult_01 * mult_12) >> shift_bits

Where shift_bits is kvm_tsc_scaling_ratio_frac_bits.

Signed-off-by: Ilias Stamatis <ilstam@amazon.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20210526184418.28881-8-ilstam@amazon.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c