Skip to content

Commit 90cbf6d

Browse files
aiksean-jc
authored andcommitted
KVM: SEV-ES: Eliminate #DB intercept when DebugSwap enabled
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] [sean: add comment as to why KVM disables #DB intercept iff DebugSwap=1] Signed-off-by: Sean Christopherson <[email protected]>
1 parent d1f85fb commit 90cbf6d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/x86/kvm/svm/sev.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,6 +2997,17 @@ static void sev_es_init_vmcb(struct vcpu_svm *svm)
29972997
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_READ);
29982998
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_WRITE);
29992999
recalc_intercepts(svm);
3000+
} else {
3001+
/*
3002+
* Disable #DB intercept iff DebugSwap is enabled. KVM doesn't
3003+
* allow debugging SEV-ES guests, and enables DebugSwap iff
3004+
* NO_NESTED_DATA_BP is supported, so there's no reason to
3005+
* intercept #DB when DebugSwap is enabled. For simplicity
3006+
* with respect to guest debug, intercept #DB for other VMs
3007+
* even if NO_NESTED_DATA_BP is supported, i.e. even if the
3008+
* guest can't DoS the CPU with infinite #DB vectoring.
3009+
*/
3010+
clr_exception_intercept(svm, DB_VECTOR);
30003011
}
30013012

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

0 commit comments

Comments
 (0)