From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47B9418F2E3; Tue, 10 Sep 2024 10:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725963459; cv=none; b=UAH/Ro9x3hdNRJqwOxF9O+9YezGDhU4D1ql4TJbIjz8LBgCXNSh5kFGyHLt7ynwwm7lAJEhMVbpUWKqX6RR/m9MEyEhQrZBP8AmR3Ks2FBDwQwtmwN5ti4i/wzBShot4/7Mjen9piJ+FgAwJUddBK2ZfeswecKiufrqGBwP8NyM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725963459; c=relaxed/simple; bh=KIECj7tTTIqV2LKDsN6adl9sJ503oC8Mmg/Lahg+1Kk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dIud9AWCTU4U2dUIQyaEQartSOoKki3x6cCcFLVuOjJ/G8eO4AMDoYyJU5wU/hpcmu+gALW2IqnqQUggpyj8J97rbo/gCLD2vTRS5nECGhj3JNOAevPCXhqK/FmUSjYjFv/LpzZ40JtklvU9EVmuP8bTRoEuPOK5vAl7uRU49fk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yvd3qSJP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yvd3qSJP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE3C6C4CEC3; Tue, 10 Sep 2024 10:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725963459; bh=KIECj7tTTIqV2LKDsN6adl9sJ503oC8Mmg/Lahg+1Kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yvd3qSJPDkNCTcGi24tI8miXZf1MmCF1Em2VQxBv2J+sZX+8WVSXgZoLMbR/qzPEQ Nc9N5S4P8n3mfRWGbV/N61g3vft76Zwrb84i73pwWxnb7jbvWAxxdUKupvhhKCBPV9 HiC0u52dVfFHn7EFPMvprVL2SdxbIALVwQIh/aP8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jim Mattson , Ravi Bangoria , Tom Lendacky , Sean Christopherson Subject: [PATCH 5.15 065/214] KVM: SVM: Dont advertise Bus Lock Detect to guest if SVM support is missing Date: Tue, 10 Sep 2024 11:31:27 +0200 Message-ID: <20240910092601.416666487@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092558.714365667@linuxfoundation.org> References: <20240910092558.714365667@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ravi Bangoria commit 54950bfe2b69cdc06ef753872b5225e54eb73506 upstream. 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: Jim Mattson Closes: https://lore.kernel.org/r/CALMp9eRet6+v8Y1Q-i6mqPm4hUow_kJNhmVHfOV8tMfuSS=tVg@mail.gmail.com Fixes: 76ea438b4afc ("KVM: X86: Expose bus lock debug exception to guest") Cc: stable@vger.kernel.org Signed-off-by: Ravi Bangoria Reviewed-by: Jim Mattson Reviewed-by: Tom Lendacky Link: https://lore.kernel.org/r/20240808062937.1149-4-ravi.bangoria@amd.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/svm/svm.c | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -958,6 +958,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)