[PATCH kernel 7/9] KVM: SEV-ES: Eliminate #DB intercept when DebugSwap enabled

From: Alexey Kardashevskiy
Date: Thu Jun 15 2023 - 02:47:04 EST


Disable #DB for SEV-ES guests when DebugSwap is enabled. There is no point
in such intercept as KVM does not allow guest debug for SEV-ES guests.

Signed-off-by: Alexey Kardashevskiy <aik@xxxxxxx>
---
Changes:
v6:
* new to the series
---
arch/x86/kvm/svm/sev.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index abc502ce7871..9c43cbdab022 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -3000,6 +3000,8 @@ static void sev_es_init_vmcb(struct vcpu_svm *svm)
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_READ);
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_WRITE);
recalc_intercepts(svm);
+ } else {
+ clr_exception_intercept(svm, DB_VECTOR);
}

/* Can't intercept XSETBV, HV can't modify XCR0 directly */
--
2.40.1