]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
arm64: proton-pack: Expose whether the branchy loop k value
authorJames Morse <james.morse@arm.com>
Tue, 29 Apr 2025 12:55:17 +0000 (13:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:21:25 +0000 (08:21 +0200)
commit a1152be30a043d2d4dcb1683415f328bf3c51978 upstream.

Add a helper to expose the k value of the branchy loop. This is needed
by the BPF JIT to generate the mitigation sequence in BPF programs.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/spectre.h
arch/arm64/kernel/proton-pack.c

index a107a87aa11972985bbaec54e5af12d6cf781e13..5b4b9854b2bcdcdd3d2df7c378ebff87d5d8bc1b 100644 (file)
@@ -96,6 +96,7 @@ enum mitigation_state arm64_get_meltdown_state(void);
 
 enum mitigation_state arm64_get_spectre_bhb_state(void);
 bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry, int scope);
+u8 get_spectre_bhb_loop_value(void);
 bool is_spectre_bhb_fw_mitigated(void);
 void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
 #endif /* __ASSEMBLY__ */
index a1e5e1f9cbe0e9d6b37cd0d82919d43297cfe734..8c7b93fd778c10af7a58271c79b50c35cd30f5d3 100644 (file)
@@ -1010,6 +1010,11 @@ bool is_spectre_bhb_affected(const struct arm64_cpu_capabilities *entry,
        return true;
 }
 
+u8 get_spectre_bhb_loop_value(void)
+{
+       return max_bhb_k;
+}
+
 static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot)
 {
        const char *v = arm64_get_bp_hardening_vector(slot);