xref: /openbmc/linux/arch/arm64/include/asm/spectre.h (revision 7f43c201)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Interface for managing mitigations for Spectre vulnerabilities.
4  *
5  * Copyright (C) 2020 Google LLC
6  * Author: Will Deacon <will@kernel.org>
7  */
8 
9 #ifndef __ASM_SPECTRE_H
10 #define __ASM_SPECTRE_H
11 
12 #include <asm/cpufeature.h>
13 
14 /* Watch out, ordering is important here. */
15 enum mitigation_state {
16 	SPECTRE_UNAFFECTED,
17 	SPECTRE_MITIGATED,
18 	SPECTRE_VULNERABLE,
19 };
20 
21 struct task_struct;
22 
23 enum mitigation_state arm64_get_spectre_v2_state(void);
24 bool has_spectre_v2(const struct arm64_cpu_capabilities *cap, int scope);
25 void spectre_v2_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
26 
27 enum mitigation_state arm64_get_spectre_v4_state(void);
28 bool has_spectre_v4(const struct arm64_cpu_capabilities *cap, int scope);
29 void spectre_v4_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
30 void spectre_v4_enable_task_mitigation(struct task_struct *tsk);
31 
32 enum mitigation_state arm64_get_meltdown_state(void);
33 
34 #endif	/* __ASM_SPECTRE_H */
35