forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
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>
....@@ -41,12 +42,18 @@
4142 {
4243 unsigned int cpu = smp_processor_id();
4344
45
+ mte_suspend_exit();
46
+
4447 /*
4548 * We are resuming from reset with the idmap active in TTBR0_EL1.
4649 * We must uninstall the idmap and restore the expected MMU
4750 * state before we can possibly return to userspace.
4851 */
4952 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));
5057
5158 /*
5259 * PSTATE was not saved over suspend/resume, re-enable any detected
....@@ -68,8 +75,10 @@
6875 * have turned the mitigation on. If the user has forcefully
6976 * disabled it, make sure their wishes are obeyed.
7077 */
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();
7382 }
7483
7584 /*
....@@ -84,6 +93,9 @@
8493 int ret = 0;
8594 unsigned long flags;
8695 struct sleep_stack_data state;
96
+
97
+ /* Report any MTE async fault before going to suspend */
98
+ mte_suspend_enter();
8799
88100 /*
89101 * From this point debug exceptions are disabled to prevent
....@@ -113,7 +125,7 @@
113125 if (!ret)
114126 ret = -EOPNOTSUPP;
115127 } else {
116
- __cpu_suspend_exit();
128
+ RCU_NONIDLE(__cpu_suspend_exit());
117129 }
118130
119131 unpause_graph_tracing();