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 4657A1F706E; Mon, 21 Oct 2024 10:36:57 +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=1729507017; cv=none; b=LF/YRGEnCVztkhxy6m6RhOniLdtGh+G9iv5RPjK+hIeJqXR7fwnuk+gYsuKZ6DT1xFiUkHS/viusKMUpYVijlwOn8BcAYo/BTJDWBYOm2zLF8EMiFvfFG/pAD0Kq5aDLs+d7rfFXeuMF/s3sYlc3QGXfop3B49wOTXi8qbTFU9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507017; c=relaxed/simple; bh=Ur62jsoWDGiGrYWJZmncaGH+tREd21XFboDKRMUdO2g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CF1fRYGSZezG0BmfQIhqRPFDI+bCyt5rWLXysl+MFuza/0jSiaF5kUZ+sWxqBu8lDhrlGdRW5O091r8mHt/SCpH9HSt1YV5T8euh1vHZAOdEU55bOmcPDOO+PD/1mU05wKNEcufGEJmMGIEGE4mPwg3tY/eezBZ82E2tj0pI/vc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QbKDVKT6; 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="QbKDVKT6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50B6AC4CEC3; Mon, 21 Oct 2024 10:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1729507016; bh=Ur62jsoWDGiGrYWJZmncaGH+tREd21XFboDKRMUdO2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbKDVKT6+6HbruFyd73OxnqLALbwAVP5h2uxKqF9VBeaTjWYagqqPucCNTH1A/73B s2t1K37uvRh4jTdiUg7x/l6dtMnOU7bMTE1GrLuhiqN/wkXh37SWvDfAZiJnoOOpWp ysXA7yrrFnBVxiaXfqFaSs9n1G2iq5ksDcNRFwR0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Venkatesh Srinivas , Jim Mattson , "Borislav Petkov (AMD)" , Tom Lendacky , Thomas Gleixner , stable@kernel.org Subject: [PATCH 6.6 054/124] x86/cpufeatures: Define X86_FEATURE_AMD_IBPB_RET Date: Mon, 21 Oct 2024 12:24:18 +0200 Message-ID: <20241021102258.820632684@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021102256.706334758@linuxfoundation.org> References: <20241021102256.706334758@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jim Mattson commit ff898623af2ed564300752bba83a680a1e4fec8d upstream. AMD's initial implementation of IBPB did not clear the return address predictor. Beginning with Zen4, AMD's IBPB *does* clear the return address predictor. This behavior is enumerated by CPUID.80000008H:EBX.IBPB_RET[30]. Define X86_FEATURE_AMD_IBPB_RET for use in KVM_GET_SUPPORTED_CPUID, when determining cross-vendor capabilities. Suggested-by: Venkatesh Srinivas Signed-off-by: Jim Mattson Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Tom Lendacky Reviewed-by: Thomas Gleixner Cc: Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/cpufeatures.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -216,7 +216,7 @@ #define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE ( 7*32+23) /* "" Disable Speculative Store Bypass. */ #define X86_FEATURE_LS_CFG_SSBD ( 7*32+24) /* "" AMD SSBD implementation via LS_CFG MSR */ #define X86_FEATURE_IBRS ( 7*32+25) /* Indirect Branch Restricted Speculation */ -#define X86_FEATURE_IBPB ( 7*32+26) /* Indirect Branch Prediction Barrier */ +#define X86_FEATURE_IBPB ( 7*32+26) /* "ibpb" Indirect Branch Prediction Barrier without a guaranteed RSB flush */ #define X86_FEATURE_STIBP ( 7*32+27) /* Single Thread Indirect Branch Predictors */ #define X86_FEATURE_ZEN ( 7*32+28) /* "" Generic flag for all Zen and newer */ #define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */ @@ -347,6 +347,7 @@ #define X86_FEATURE_CPPC (13*32+27) /* Collaborative Processor Performance Control */ #define X86_FEATURE_AMD_PSFD (13*32+28) /* "" Predictive Store Forwarding Disable */ #define X86_FEATURE_BTC_NO (13*32+29) /* "" Not vulnerable to Branch Type Confusion */ +#define X86_FEATURE_AMD_IBPB_RET (13*32+30) /* "" IBPB clears return address predictor */ #define X86_FEATURE_BRS (13*32+31) /* Branch Sampling available */ /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */