OSDN Git Service

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)
commit83150f2932ec4712e2630009ac4a585d4aba7a9e
treeba42c0ea93773743d40a0838151496eace71a8f2
parent307a94c721fed1aaaeee68115df6f7fb8193b23f
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