.. | .. |
---|
3 | 3 | #include <linux/percpu.h> |
---|
4 | 4 | #include <linux/slab.h> |
---|
5 | 5 | #include <linux/uaccess.h> |
---|
| 6 | +#include <linux/pgtable.h> |
---|
6 | 7 | #include <asm/alternative.h> |
---|
7 | 8 | #include <asm/cacheflush.h> |
---|
8 | 9 | #include <asm/cpufeature.h> |
---|
9 | 10 | #include <asm/daifflags.h> |
---|
10 | 11 | #include <asm/debug-monitors.h> |
---|
11 | 12 | #include <asm/exec.h> |
---|
12 | | -#include <asm/pgtable.h> |
---|
| 13 | +#include <asm/mte.h> |
---|
13 | 14 | #include <asm/memory.h> |
---|
14 | 15 | #include <asm/mmu_context.h> |
---|
15 | 16 | #include <asm/smp_plat.h> |
---|
.. | .. |
---|
41 | 42 | { |
---|
42 | 43 | unsigned int cpu = smp_processor_id(); |
---|
43 | 44 | |
---|
| 45 | + mte_suspend_exit(); |
---|
| 46 | + |
---|
44 | 47 | /* |
---|
45 | 48 | * We are resuming from reset with the idmap active in TTBR0_EL1. |
---|
46 | 49 | * We must uninstall the idmap and restore the expected MMU |
---|
47 | 50 | * state before we can possibly return to userspace. |
---|
48 | 51 | */ |
---|
49 | 52 | cpu_uninstall_idmap(); |
---|
| 53 | + |
---|
| 54 | + /* Restore CnP bit in TTBR1_EL1 */ |
---|
| 55 | + if (system_supports_cnp()) |
---|
| 56 | + cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); |
---|
50 | 57 | |
---|
51 | 58 | /* |
---|
52 | 59 | * PSTATE was not saved over suspend/resume, re-enable any detected |
---|
.. | .. |
---|
68 | 75 | * have turned the mitigation on. If the user has forcefully |
---|
69 | 76 | * disabled it, make sure their wishes are obeyed. |
---|
70 | 77 | */ |
---|
71 | | - if (arm64_get_ssbd_state() == ARM64_SSBD_FORCE_DISABLE) |
---|
72 | | - arm64_set_ssbd_mitigation(false); |
---|
| 78 | + spectre_v4_enable_mitigation(NULL); |
---|
| 79 | + |
---|
| 80 | + /* Restore additional feature-specific configuration */ |
---|
| 81 | + ptrauth_suspend_exit(); |
---|
73 | 82 | } |
---|
74 | 83 | |
---|
75 | 84 | /* |
---|
.. | .. |
---|
84 | 93 | int ret = 0; |
---|
85 | 94 | unsigned long flags; |
---|
86 | 95 | struct sleep_stack_data state; |
---|
| 96 | + |
---|
| 97 | + /* Report any MTE async fault before going to suspend */ |
---|
| 98 | + mte_suspend_enter(); |
---|
87 | 99 | |
---|
88 | 100 | /* |
---|
89 | 101 | * From this point debug exceptions are disabled to prevent |
---|
.. | .. |
---|
113 | 125 | if (!ret) |
---|
114 | 126 | ret = -EOPNOTSUPP; |
---|
115 | 127 | } else { |
---|
116 | | - __cpu_suspend_exit(); |
---|
| 128 | + RCU_NONIDLE(__cpu_suspend_exit()); |
---|
117 | 129 | } |
---|
118 | 130 | |
---|
119 | 131 | unpause_graph_tracing(); |
---|