summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/vmx
diff options
context:
space:
mode:
authorJim Mattson <jmattson@google.com>2020-06-04 02:56:22 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2020-07-08 23:21:45 +0300
commit8a14fe4f0c54f27c89389d13c4a1e467a88c35ea (patch)
tree05019b573db700cca2a4cf8406966e5f899f61d4 /arch/x86/kvm/vmx
parent1aa561b1a4c0ae2a9a9b9c21a84b5ca66b4775d8 (diff)
downloadlinux-8a14fe4f0c54f27c89389d13c4a1e467a88c35ea.tar.xz
kvm: x86: Move last_cpu into kvm_vcpu_arch as last_vmentry_cpu
Both the vcpu_vmx structure and the vcpu_svm structure have a 'last_cpu' field. Move the common field into the kvm_vcpu_arch structure. For clarity, rename it to 'last_vmentry_cpu.' Suggested-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Jim Mattson <jmattson@google.com> Reviewed-by: Oliver Upton <oupton@google.com> Reviewed-by: Peter Shier <pshier@google.com> Message-Id: <20200603235623.245638-6-jmattson@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx')
-rw-r--r--arch/x86/kvm/vmx/vmx.c12
-rw-r--r--arch/x86/kvm/vmx/vmx.h3
2 files changed, 6 insertions, 9 deletions
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index b52bcebfa094..d9ee31b0679b 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -4785,7 +4785,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
vcpu->run->internal.data[0] = vect_info;
vcpu->run->internal.data[1] = intr_info;
vcpu->run->internal.data[2] = error_code;
- vcpu->run->internal.data[3] = vmx->last_cpu;
+ vcpu->run->internal.data[3] = vcpu->arch.last_vmentry_cpu;
return 0;
}
@@ -6007,7 +6007,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
vcpu->run->fail_entry.hardware_entry_failure_reason
= exit_reason;
- vcpu->run->fail_entry.cpu = vmx->last_cpu;
+ vcpu->run->fail_entry.cpu = vcpu->arch.last_vmentry_cpu;
return 0;
}
@@ -6016,7 +6016,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
vcpu->run->fail_entry.hardware_entry_failure_reason
= vmcs_read32(VM_INSTRUCTION_ERROR);
- vcpu->run->fail_entry.cpu = vmx->last_cpu;
+ vcpu->run->fail_entry.cpu = vcpu->arch.last_vmentry_cpu;
return 0;
}
@@ -6044,7 +6044,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
vmcs_read64(GUEST_PHYSICAL_ADDRESS);
}
vcpu->run->internal.data[vcpu->run->internal.ndata++] =
- vmx->last_cpu;
+ vcpu->arch.last_vmentry_cpu;
return 0;
}
@@ -6102,7 +6102,7 @@ unexpected_vmexit:
KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON;
vcpu->run->internal.ndata = 2;
vcpu->run->internal.data[0] = exit_reason;
- vcpu->run->internal.data[1] = vmx->last_cpu;
+ vcpu->run->internal.data[1] = vcpu->arch.last_vmentry_cpu;
return 0;
}
@@ -6740,7 +6740,7 @@ reenter_guest:
if (vcpu->arch.cr2 != read_cr2())
write_cr2(vcpu->arch.cr2);
- vmx->last_cpu = vcpu->cpu;
+ vcpu->arch.last_vmentry_cpu = vcpu->cpu;
vmx->fail = __vmx_vcpu_run(vmx, (unsigned long *)&vcpu->arch.regs,
vmx->loaded_vmcs->launched);
diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
index f8f9e214d285..639798e4a6ca 100644
--- a/arch/x86/kvm/vmx/vmx.h
+++ b/arch/x86/kvm/vmx/vmx.h
@@ -300,9 +300,6 @@ struct vcpu_vmx {
u64 ept_pointer;
struct pt_desc pt_desc;
-
- /* which host CPU was used for running this vcpu */
- unsigned int last_cpu;
};
enum ept_pointers_status {