Skip to content

Commit 103f053

Browse files
author
Maxim Levitsky
committed
KVM: SVM: Treat DEBUGCTL[5:2] as reserved
JIRA: https://issues.redhat.com/browse/RHEL-47242 commit 5ecdb48 Author: Sean Christopherson <seanjc@google.com> Date: Thu Feb 27 14:24:11 2025 -0800 KVM: SVM: Treat DEBUGCTL[5:2] as reserved Stop ignoring DEBUGCTL[5:2] on AMD CPUs and instead treat them as reserved. KVM has never properly virtualized AMD's legacy PBi bits, but did allow the guest (and host userspace) to set the bits. To avoid breaking guests when running on CPUs with BusLockTrap, which redefined bit 2 to BLCKDB and made bits 5:3 reserved, a previous KVM change ignored bits 5:3, e.g. so that legacy guest software wouldn't inadvertently enable BusLockTrap or hit a VMRUN failure due to setting reserved. To allow for virtualizing BusLockTrap and whatever future features may use bits 5:3, treat bits 5:2 as reserved (and hope that doing so doesn't break any existing guests). Reviewed-and-tested-by: Ravi Bangoria <ravi.bangoria@amd.com> Link: https://lore.kernel.org/r/20250227222411.3490595-7-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
1 parent 4adabef commit 103f053

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,17 +3233,6 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
32333233
break;
32343234
}
32353235

3236-
/*
3237-
* AMD changed the architectural behavior of bits 5:2. On CPUs
3238-
* without BusLockTrap, bits 5:2 control "external pins", but
3239-
* on CPUs that support BusLockDetect, bit 2 enables BusLockTrap
3240-
* and bits 5:3 are reserved-to-zero. Sadly, old KVM allowed
3241-
* the guest to set bits 5:2 despite not actually virtualizing
3242-
* Performance-Monitoring/Breakpoint external pins. Drop bits
3243-
* 5:2 for backwards compatibility.
3244-
*/
3245-
data &= ~GENMASK(5, 2);
3246-
32473236
/*
32483237
* Suppress BTF as KVM doesn't virtualize BTF, but there's no
32493238
* way to communicate lack of support to the guest.

0 commit comments

Comments
 (0)