forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/arm64/kernel/suspend.c
....@@ -3,13 +3,14 @@
33 #include <linux/percpu.h>
44 #include <linux/slab.h>
55 #include <linux/uaccess.h>
6
+#include <linux/pgtable.h>
67 #include <asm/alternative.h>
78 #include <asm/cacheflush.h>
89 #include <asm/cpufeature.h>
910 #include <asm/daifflags.h>
1011 #include <asm/debug-monitors.h>
1112 #include <asm/exec.h>
12
-#include <asm/pgtable.h>
13
+#include <asm/mte.h>
1314 #include <asm/memory.h>
1415 #include <asm/mmu_context.h>
1516 #include <asm/smp_plat.h>
....@@ -48,6 +49,10 @@
4849 */
4950 cpu_uninstall_idmap();
5051
52
+ /* Restore CnP bit in TTBR1_EL1 */
53
+ if (system_supports_cnp())
54
+ cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
55
+
5156 /*
5257 * PSTATE was not saved over suspend/resume, re-enable any detected
5358 * features that might not have been set correctly.
....@@ -68,8 +73,10 @@
6873 * have turned the mitigation on. If the user has forcefully
6974 * disabled it, make sure their wishes are obeyed.
7075 */
71
- if (arm64_get_ssbd_state() == ARM64_SSBD_FORCE_DISABLE)
72
- arm64_set_ssbd_mitigation(false);
76
+ spectre_v4_enable_mitigation(NULL);
77
+
78
+ /* Restore additional feature-specific configuration */
79
+ ptrauth_suspend_exit();
7380 }
7481
7582 /*
....@@ -84,6 +91,9 @@
8491 int ret = 0;
8592 unsigned long flags;
8693 struct sleep_stack_data state;
94
+
95
+ /* Report any MTE async fault before going to suspend */
96
+ mte_suspend_enter();
8797
8898 /*
8999 * From this point debug exceptions are disabled to prevent
....@@ -113,7 +123,7 @@
113123 if (!ret)
114124 ret = -EOPNOTSUPP;
115125 } else {
116
- __cpu_suspend_exit();
126
+ RCU_NONIDLE(__cpu_suspend_exit());
117127 }
118128
119129 unpause_graph_tracing();