blob: fcdfbce302bdfb9fec12cef198139b4814e9642d [file] [log] [blame]
Will Deacond4647f02020-09-15 23:30:17 +01001/* 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. */
15enum mitigation_state {
16 SPECTRE_UNAFFECTED,
17 SPECTRE_MITIGATED,
18 SPECTRE_VULNERABLE,
19};
20
21struct task_struct;
22
23enum mitigation_state arm64_get_spectre_v2_state(void);
24bool has_spectre_v2(const struct arm64_cpu_capabilities *cap, int scope);
25void spectre_v2_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
26
Will Deaconc2876202020-09-18 11:54:33 +010027enum mitigation_state arm64_get_spectre_v4_state(void);
28bool has_spectre_v4(const struct arm64_cpu_capabilities *cap, int scope);
29void spectre_v4_enable_mitigation(const struct arm64_cpu_capabilities *__unused);
30void spectre_v4_enable_task_mitigation(struct task_struct *tsk);
31
Will Deacond4647f02020-09-15 23:30:17 +010032#endif /* __ASM_SPECTRE_H */