Commit 54950bfe authored by Ravi Bangoria's avatar Ravi Bangoria Committed by Sean Christopherson
Browse files

KVM: SVM: Don't advertise Bus Lock Detect to guest if SVM support is missing



If host supports Bus Lock Detect, KVM advertises it to guests even if
SVM support is absent. Additionally, guest wouldn't be able to use it
despite guest CPUID bit being set. Fix it by unconditionally clearing
the feature bit in KVM cpu capability.

Reported-by: default avatarJim Mattson <jmattson@google.com>
Closes: https://lore.kernel.org/r/CALMp9eRet6+v8Y1Q-i6mqPm4hUow_kJNhmVHfOV8tMfuSS=tVg@mail.gmail.com


Fixes: 76ea438b ("KVM: X86: Expose bus lock debug exception to guest")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
Reviewed-by: default avatarJim Mattson <jmattson@google.com>
Reviewed-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20240808062937.1149-4-ravi.bangoria@amd.com


Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent dad1613e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5236,6 +5236,9 @@ static __init void svm_set_cpu_caps(void)

	/* CPUID 0x8000001F (SME/SEV features) */
	sev_set_cpu_caps();

	/* Don't advertise Bus Lock Detect to guest if SVM support is absent */
	kvm_cpu_cap_clear(X86_FEATURE_BUS_LOCK_DETECT);
}

static __init int svm_hardware_setup(void)