hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/linux/cpu.h
....@@ -64,6 +64,12 @@
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);
6773
6874 extern __printf(4, 5)
6975 struct device *cpu_device_create(struct device *parent, void *drvdata,
....@@ -88,10 +94,13 @@
8894
8995 #ifdef CONFIG_SMP
9096 extern bool cpuhp_tasks_frozen;
91
-int cpu_up(unsigned int cpu);
97
+int add_cpu(unsigned int cpu);
98
+int cpu_device_up(struct device *dev);
9299 void notify_cpu_starting(unsigned int cpu);
93100 extern void cpu_maps_update_begin(void);
94101 extern void cpu_maps_update_done(void);
102
+int bringup_hibernate_cpu(unsigned int sleep_cpu);
103
+void bringup_nonboot_cpus(unsigned int setup_max_cpus);
95104
96105 #else /* CONFIG_SMP */
97106 #define cpuhp_tasks_frozen 0
....@@ -117,7 +126,11 @@
117126 extern void cpu_hotplug_disable(void);
118127 extern void cpu_hotplug_enable(void);
119128 void clear_tasks_mm_cpumask(int cpu);
120
-int cpu_down(unsigned int cpu);
129
+int remove_cpu(unsigned int cpu);
130
+int pause_cpus(struct cpumask *cpumask);
131
+int resume_cpus(struct cpumask *cpumask);
132
+int cpu_device_down(struct device *dev);
133
+extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu);
121134
122135 #else /* CONFIG_HOTPLUG_CPU */
123136
....@@ -129,7 +142,9 @@
129142 static inline void lockdep_assert_cpus_held(void) { }
130143 static inline void cpu_hotplug_disable(void) { }
131144 static inline void cpu_hotplug_enable(void) { }
132
-
145
+static inline int pause_cpus(struct cpumask *cpumask) { return -ENODEV; }
146
+static inline int resume_cpus(struct cpumask *cpumask) { return -ENODEV; }
147
+static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { }
133148 #endif /* !CONFIG_HOTPLUG_CPU */
134149
135150 /* Wrappers which go away once all code is converted */
....@@ -140,14 +155,26 @@
140155
141156 #ifdef CONFIG_PM_SLEEP_SMP
142157 extern int freeze_secondary_cpus(int primary);
143
-static inline int disable_nonboot_cpus(void)
158
+extern void thaw_secondary_cpus(void);
159
+
160
+static inline int suspend_disable_secondary_cpus(void)
144161 {
145
- return freeze_secondary_cpus(0);
162
+ int cpu = 0;
163
+
164
+ if (IS_ENABLED(CONFIG_PM_SLEEP_SMP_NONZERO_CPU))
165
+ cpu = -1;
166
+
167
+ return freeze_secondary_cpus(cpu);
146168 }
147
-extern void enable_nonboot_cpus(void);
169
+static inline void suspend_enable_secondary_cpus(void)
170
+{
171
+ return thaw_secondary_cpus();
172
+}
173
+
148174 #else /* !CONFIG_PM_SLEEP_SMP */
149
-static inline int disable_nonboot_cpus(void) { return 0; }
150
-static inline void enable_nonboot_cpus(void) {}
175
+static inline void thaw_secondary_cpus(void) {}
176
+static inline int suspend_disable_secondary_cpus(void) { return 0; }
177
+static inline void suspend_enable_secondary_cpus(void) { }
151178 #endif /* !CONFIG_PM_SLEEP_SMP */
152179
153180 void cpu_startup_entry(enum cpuhp_state state);
....@@ -155,7 +182,7 @@
155182 void cpu_idle_poll_ctrl(bool enable);
156183
157184 /* Attach to any functions which should be considered cpuidle. */
158
-#define __cpuidle __attribute__((__section__(".cpuidle.text")))
185
+#define __cpuidle __section(".cpuidle.text")
159186
160187 bool cpu_in_idle(unsigned long pc);
161188
....@@ -168,7 +195,12 @@
168195 int cpu_report_state(int cpu);
169196 int cpu_check_up_prepare(int cpu);
170197 void cpu_set_state_online(int cpu);
171
-void play_idle(unsigned long duration_ms);
198
+void play_idle_precise(u64 duration_ns, u64 latency_ns);
199
+
200
+static inline void play_idle(unsigned long duration_us)
201
+{
202
+ play_idle_precise(duration_us * NSEC_PER_USEC, U64_MAX);
203
+}
172204
173205 #ifdef CONFIG_HOTPLUG_CPU
174206 bool cpu_wait_death(unsigned int cpu, int seconds);
....@@ -183,18 +215,21 @@
183215 CPU_SMT_DISABLED,
184216 CPU_SMT_FORCE_DISABLED,
185217 CPU_SMT_NOT_SUPPORTED,
218
+ CPU_SMT_NOT_IMPLEMENTED,
186219 };
187220
188221 #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
189222 extern enum cpuhp_smt_control cpu_smt_control;
190223 extern void cpu_smt_disable(bool force);
191224 extern void cpu_smt_check_topology(void);
225
+extern bool cpu_smt_possible(void);
192226 extern int cpuhp_smt_enable(void);
193227 extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval);
194228 #else
195
-# define cpu_smt_control (CPU_SMT_ENABLED)
229
+# define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED)
196230 static inline void cpu_smt_disable(bool force) { }
197231 static inline void cpu_smt_check_topology(void) { }
232
+static inline bool cpu_smt_possible(void) { return false; }
198233 static inline int cpuhp_smt_enable(void) { return 0; }
199234 static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; }
200235 #endif