hv: cache tsc_offset

Guest write tsc: cache the offset into run_context.tsc_offset;
Guest read tsc : use run_context.tsc_offset to calculate guest_tsc.

Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Qi Yadong
2018-04-09 10:56:25 +08:00
committed by Jack Ren
parent 51414536fa
commit ef0c5ec2e3
4 changed files with 12 additions and 15 deletions

View File

@@ -203,11 +203,8 @@ void destroy_secure_world(struct vm *vm)
static void save_world_ctx(struct run_context *context)
{
/* VMCS Execution field */
context->tsc_offset = exec_vmread64(VMX_TSC_OFFSET_FULL);
/* VMCS GUEST field */
/* CR3, RIP, RSP, RFLAGS already saved on VMEXIT */
/* TSC_OFFSET, CR3, RIP, RSP, RFLAGS already saved on VMEXIT */
context->cr0 = exec_vmread(VMX_GUEST_CR0);
context->cr4 = exec_vmread(VMX_GUEST_CR4);
context->dr7 = exec_vmread(VMX_GUEST_DR7);