提交 d1319bab 编写于 作者: H Hao Xiang 提交者: Aichun Shi

KVM: VMX: Remove redundant handling of bus lock vmexit

mainline inclusion
from mainline-v5.15-rc7
commit d61863c6
category: feature
feature: KVM Bus Lock VM Exit
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I5RJCB
CVE: N/A
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
commit/?id=d61863c6

Intel-SIG: commit d61863c6 ("KVM: VMX: Remove redundant handling of bus lock vmexit")

-------------------------------------

KVM: VMX: Remove redundant handling of bus lock vmexit

Hardware may or may not set exit_reason.bus_lock_detected on BUS_LOCK
VM-Exits. Dealing with KVM_RUN_X86_BUS_LOCK in handle_bus_lock_vmexit
could be redundant when exit_reason.basic is EXIT_REASON_BUS_LOCK.

We can remove redundant handling of bus lock vmexit. Unconditionally Set
exit_reason.bus_lock_detected in handle_bus_lock_vmexit(), and deal with
KVM_RUN_X86_BUS_LOCK only in vmx_handle_exit().
Signed-off-by: NHao Xiang <hao.xiang@linux.alibaba.com>
Message-Id: <1634299161-30101-1-git-send-email-hao.xiang@linux.alibaba.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NAichun Shi <aichun.shi@intel.com>
上级 3d5237ab
...@@ -5931,9 +5931,13 @@ static int handle_encls(struct kvm_vcpu *vcpu) ...@@ -5931,9 +5931,13 @@ static int handle_encls(struct kvm_vcpu *vcpu)
static int handle_bus_lock_vmexit(struct kvm_vcpu *vcpu) static int handle_bus_lock_vmexit(struct kvm_vcpu *vcpu)
{ {
vcpu->run->exit_reason = KVM_EXIT_X86_BUS_LOCK; /*
vcpu->run->flags |= KVM_RUN_X86_BUS_LOCK; * Hardware may or may not set the BUS_LOCK_DETECTED flag on BUS_LOCK
return 0; * VM-Exits. Unconditionally set the flag here and leave the handling to
* vmx_handle_exit().
*/
to_vmx(vcpu)->exit_reason.bus_lock_detected = true;
return 1;
} }
/* /*
...@@ -6409,9 +6413,8 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) ...@@ -6409,9 +6413,8 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
int ret = __vmx_handle_exit(vcpu, exit_fastpath); int ret = __vmx_handle_exit(vcpu, exit_fastpath);
/* /*
* Even when current exit reason is handled by KVM internally, we * Exit to user space when bus lock detected to inform that there is
* still need to exit to user space when bus lock detected to inform * a bus lock in guest.
* that there is a bus lock in guest.
*/ */
if (to_vmx(vcpu)->exit_reason.bus_lock_detected) { if (to_vmx(vcpu)->exit_reason.bus_lock_detected) {
if (ret > 0) if (ret > 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册