powerpc/pseries: add new branch prediction security bits for link stack
Nicholas Piggin
reviewerPATCH 1/1 powerpc/pseries: add new branch prediction security bits for link stack
The hypervisor interface has defined branch prediction security bits for handling the link stack. Wire them up.
Signed-off-by Nicholas Piggin <[email protected]>
--- arch/powerpc/include/asm/hvcall.h | 2 ++ arch/powerpc/platforms/pseries/setup.c | 6 ++++++ 2 files changed, 8 insertions(+)
arch/powerpc/include/asm/hvcall.h +2 -0
@@ -375,11 +375,13 @@#define H_CPU_CHAR_THREAD_RECONFIG_CTRL (1ull << 57) // IBM bit 6#define H_CPU_CHAR_COUNT_CACHE_DISABLED (1ull << 56) // IBM bit 7#define H_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54) // IBM bit 9 +#define H_CPU_CHAR_BCCTR_LINK_FLUSH_ASSIST (1ull << 52) // IBM bit 11#define H_CPU_BEHAV_FAVOUR_SECURITY (1ull << 63) // IBM bit 0#define H_CPU_BEHAV_L1D_FLUSH_PR (1ull << 62) // IBM bit 1#define H_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ull << 61) // IBM bit 2#define H_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58) // IBM bit 5 +#define H_CPU_BEHAV_FLUSH_LINK_STACK (1ull << 57) // IBM bit 6/* Flag values used in H_REGISTER_PROC_TBL hcall */ #define PROC_TABLE_OP_MASK 0x18
arch/powerpc/platforms/pseries/setup.c +6 -0
@@ -519,9 +519,15 @@ static void init_cpu_char_feature_flags(struct h_cpu_char_result *result)if (result->character &H_CPU_CHAR_BCCTR_FLUSH_ASSIST )security_ftr_set (SEC_FTR_BCCTR_FLUSH_ASSIST ); +if (result->character &H_CPU_CHAR_BCCTR_LINK_FLUSH_ASSIST ) +security_ftr_set (SEC_FTR_BCCTR_LINK_FLUSH_ASSIST ); +if (result->behaviour &H_CPU_BEHAV_FLUSH_COUNT_CACHE )security_ftr_set (SEC_FTR_FLUSH_COUNT_CACHE ); +if (result->behaviour &H_CPU_BEHAV_FLUSH_LINK_STACK ) +security_ftr_set (SEC_FTR_FLUSH_LINK_STACK ); +/* * The features below are enabled by default, so we instead look to see * if firmware has *disabled* them, and clear them if so.
Signature · 1 line
2.23.0
Michael Ellerman
AppliedQuoted 2 lines · Nicholas Piggin
The hypervisor interface has defined branch prediction security bits for handling the link stack. Wire them up.
Applied to powerpc/next.
[1/1] powerpc/pseries: add new branch prediction security bits for link stack
https://git.kernel.org/powerpc/c/cdb1ea0276bd6a225aa1203b4829b8c3c0d4d069
cheers