hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/cpu.h
....@@ -64,6 +64,16 @@
6464 char *buf);
6565 extern ssize_t cpu_show_itlb_multihit(struct device *dev,
6666 struct device_attribute *attr, char *buf);
67
+extern ssize_t cpu_show_srbds(struct device *dev, struct device_attribute *attr, char *buf);
68
+extern ssize_t cpu_show_mmio_stale_data(struct device *dev,
69
+ struct device_attribute *attr,
70
+ char *buf);
71
+extern ssize_t cpu_show_retbleed(struct device *dev,
72
+ struct device_attribute *attr, char *buf);
73
+extern ssize_t cpu_show_spec_rstack_overflow(struct device *dev,
74
+ struct device_attribute *attr, char *buf);
75
+extern ssize_t cpu_show_gds(struct device *dev,
76
+ struct device_attribute *attr, char *buf);
6777
6878 extern __printf(4, 5)
6979 struct device *cpu_device_create(struct device *parent, void *drvdata,
....@@ -88,10 +98,13 @@
8898
8999 #ifdef CONFIG_SMP
90100 extern bool cpuhp_tasks_frozen;
91
-int cpu_up(unsigned int cpu);
101
+int add_cpu(unsigned int cpu);
102
+int cpu_device_up(struct device *dev);
92103 void notify_cpu_starting(unsigned int cpu);
93104 extern void cpu_maps_update_begin(void);
94105 extern void cpu_maps_update_done(void);
106
+int bringup_hibernate_cpu(unsigned int sleep_cpu);
107
+void bringup_nonboot_cpus(unsigned int setup_max_cpus);
95108
96109 #else /* CONFIG_SMP */
97110 #define cpuhp_tasks_frozen 0
....@@ -117,7 +130,11 @@
117130 extern void cpu_hotplug_disable(void);
118131 extern void cpu_hotplug_enable(void);
119132 void clear_tasks_mm_cpumask(int cpu);
120
-int cpu_down(unsigned int cpu);
133
+int remove_cpu(unsigned int cpu);
134
+int pause_cpus(struct cpumask *cpumask);
135
+int resume_cpus(struct cpumask *cpumask);
136
+int cpu_device_down(struct device *dev);
137
+extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu);
121138
122139 #else /* CONFIG_HOTPLUG_CPU */
123140
....@@ -129,7 +146,9 @@
129146 static inline void lockdep_assert_cpus_held(void) { }
130147 static inline void cpu_hotplug_disable(void) { }
131148 static inline void cpu_hotplug_enable(void) { }
132
-
149
+static inline int pause_cpus(struct cpumask *cpumask) { return -ENODEV; }
150
+static inline int resume_cpus(struct cpumask *cpumask) { return -ENODEV; }
151
+static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { }
133152 #endif /* !CONFIG_HOTPLUG_CPU */
134153
135154 /* Wrappers which go away once all code is converted */
....@@ -140,14 +159,26 @@
140159
141160 #ifdef CONFIG_PM_SLEEP_SMP
142161 extern int freeze_secondary_cpus(int primary);
143
-static inline int disable_nonboot_cpus(void)
162
+extern void thaw_secondary_cpus(void);
163
+
164
+static inline int suspend_disable_secondary_cpus(void)
144165 {
145
- return freeze_secondary_cpus(0);
166
+ int cpu = 0;
167
+
168
+ if (IS_ENABLED(CONFIG_PM_SLEEP_SMP_NONZERO_CPU))
169
+ cpu = -1;
170
+
171
+ return freeze_secondary_cpus(cpu);
146172 }
147
-extern void enable_nonboot_cpus(void);
173
+static inline void suspend_enable_secondary_cpus(void)
174
+{
175
+ return thaw_secondary_cpus();
176
+}
177
+
148178 #else /* !CONFIG_PM_SLEEP_SMP */
149
-static inline int disable_nonboot_cpus(void) { return 0; }
150
-static inline void enable_nonboot_cpus(void) {}
179
+static inline void thaw_secondary_cpus(void) {}
180
+static inline int suspend_disable_secondary_cpus(void) { return 0; }
181
+static inline void suspend_enable_secondary_cpus(void) { }
151182 #endif /* !CONFIG_PM_SLEEP_SMP */
152183
153184 void cpu_startup_entry(enum cpuhp_state state);
....@@ -155,7 +186,7 @@
155186 void cpu_idle_poll_ctrl(bool enable);
156187
157188 /* Attach to any functions which should be considered cpuidle. */
158
-#define __cpuidle __attribute__((__section__(".cpuidle.text")))
189
+#define __cpuidle __section(".cpuidle.text")
159190
160191 bool cpu_in_idle(unsigned long pc);
161192
....@@ -165,10 +196,21 @@
165196 void arch_cpu_idle_exit(void);
166197 void arch_cpu_idle_dead(void);
167198
199
+#ifdef CONFIG_ARCH_HAS_CPU_FINALIZE_INIT
200
+void arch_cpu_finalize_init(void);
201
+#else
202
+static inline void arch_cpu_finalize_init(void) { }
203
+#endif
204
+
168205 int cpu_report_state(int cpu);
169206 int cpu_check_up_prepare(int cpu);
170207 void cpu_set_state_online(int cpu);
171
-void play_idle(unsigned long duration_ms);
208
+void play_idle_precise(u64 duration_ns, u64 latency_ns);
209
+
210
+static inline void play_idle(unsigned long duration_us)
211
+{
212
+ play_idle_precise(duration_us * NSEC_PER_USEC, U64_MAX);
213
+}
172214
173215 #ifdef CONFIG_HOTPLUG_CPU
174216 bool cpu_wait_death(unsigned int cpu, int seconds);
....@@ -183,18 +225,21 @@
183225 CPU_SMT_DISABLED,
184226 CPU_SMT_FORCE_DISABLED,
185227 CPU_SMT_NOT_SUPPORTED,
228
+ CPU_SMT_NOT_IMPLEMENTED,
186229 };
187230
188231 #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
189232 extern enum cpuhp_smt_control cpu_smt_control;
190233 extern void cpu_smt_disable(bool force);
191234 extern void cpu_smt_check_topology(void);
235
+extern bool cpu_smt_possible(void);
192236 extern int cpuhp_smt_enable(void);
193237 extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval);
194238 #else
195
-# define cpu_smt_control (CPU_SMT_ENABLED)
239
+# define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED)
196240 static inline void cpu_smt_disable(bool force) { }
197241 static inline void cpu_smt_check_topology(void) { }
242
+static inline bool cpu_smt_possible(void) { return false; }
198243 static inline int cpuhp_smt_enable(void) { return 0; }
199244 static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; }
200245 #endif