hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/x86/include/asm/topology.h
....@@ -106,14 +106,24 @@
106106
107107 #define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id)
108108 #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
109
+#define topology_logical_die_id(cpu) (cpu_data(cpu).logical_die_id)
110
+#define topology_die_id(cpu) (cpu_data(cpu).cpu_die_id)
109111 #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
110112
113
+extern unsigned int __max_die_per_package;
114
+
111115 #ifdef CONFIG_SMP
116
+#define topology_die_cpumask(cpu) (per_cpu(cpu_die_map, cpu))
112117 #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
113118 #define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
114119
115120 extern unsigned int __max_logical_packages;
116121 #define topology_max_packages() (__max_logical_packages)
122
+
123
+static inline int topology_max_die_per_package(void)
124
+{
125
+ return __max_die_per_package;
126
+}
117127
118128 extern int __max_smt_threads;
119129
....@@ -123,14 +133,21 @@
123133 }
124134
125135 int topology_update_package_map(unsigned int apicid, unsigned int cpu);
136
+int topology_update_die_map(unsigned int dieid, unsigned int cpu);
126137 int topology_phys_to_logical_pkg(unsigned int pkg);
138
+int topology_phys_to_logical_die(unsigned int die, unsigned int cpu);
127139 bool topology_is_primary_thread(unsigned int cpu);
128140 bool topology_smt_supported(void);
129141 #else
130142 #define topology_max_packages() (1)
131143 static inline int
132144 topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; }
145
+static inline int
146
+topology_update_die_map(unsigned int dieid, unsigned int cpu) { return 0; }
133147 static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
148
+static inline int topology_phys_to_logical_die(unsigned int die,
149
+ unsigned int cpu) { return 0; }
150
+static inline int topology_max_die_per_package(void) { return 1; }
134151 static inline int topology_max_smt_threads(void) { return 1; }
135152 static inline bool topology_is_primary_thread(unsigned int cpu) { return true; }
136153 static inline bool topology_smt_supported(void) { return false; }
....@@ -176,4 +193,29 @@
176193 }
177194 #endif /* CONFIG_SCHED_MC_PRIO */
178195
196
+#if defined(CONFIG_SMP) && defined(CONFIG_X86_64)
197
+#include <asm/cpufeature.h>
198
+
199
+DECLARE_STATIC_KEY_FALSE(arch_scale_freq_key);
200
+
201
+#define arch_scale_freq_invariant() static_branch_likely(&arch_scale_freq_key)
202
+
203
+DECLARE_PER_CPU(unsigned long, arch_freq_scale);
204
+
205
+static inline long arch_scale_freq_capacity(int cpu)
206
+{
207
+ return per_cpu(arch_freq_scale, cpu);
208
+}
209
+#define arch_scale_freq_capacity arch_scale_freq_capacity
210
+
211
+extern void arch_scale_freq_tick(void);
212
+#define arch_scale_freq_tick arch_scale_freq_tick
213
+
214
+extern void arch_set_max_freq_ratio(bool turbo_disabled);
215
+#else
216
+static inline void arch_set_max_freq_ratio(bool turbo_disabled)
217
+{
218
+}
219
+#endif
220
+
179221 #endif /* _ASM_X86_TOPOLOGY_H */