linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] cpu/SMT: Move SMT prototypes into cpu_smt.h
@ 2023-05-24 15:56 Michael Ellerman
  2023-05-24 15:56 ` [PATCH 2/9] cpu/SMT: Move smt/control simple exit cases earlier Michael Ellerman
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Michael Ellerman @ 2023-05-24 15:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arch, x86, dave.hansen, mingo, bp, tglx, ldufour, linuxppc-dev

A subsequent patch would like to use the cpuhp_smt_control enum as part
of the interface between generic and arch code.

Currently that leads to circular header dependencies. So split the enum
and related declarations into a separate header.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/x86/include/asm/topology.h |  2 ++
 include/linux/cpu.h             | 25 +------------------------
 include/linux/cpu_smt.h         | 29 +++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 24 deletions(-)
 create mode 100644 include/linux/cpu_smt.h

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 458c891a8273..66927a59e822 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -136,6 +136,8 @@ static inline int topology_max_smt_threads(void)
 	return __max_smt_threads;
 }
 
+#include <linux/cpu_smt.h>
+
 int topology_update_package_map(unsigned int apicid, unsigned int cpu);
 int topology_update_die_map(unsigned int dieid, unsigned int cpu);
 int topology_phys_to_logical_pkg(unsigned int pkg);
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 8582a7142623..40548f3c201c 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -18,6 +18,7 @@
 #include <linux/compiler.h>
 #include <linux/cpumask.h>
 #include <linux/cpuhotplug.h>
+#include <linux/cpu_smt.h>
 
 struct device;
 struct device_node;
@@ -202,30 +203,6 @@ void cpuhp_report_idle_dead(void);
 static inline void cpuhp_report_idle_dead(void) { }
 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
 
-enum cpuhp_smt_control {
-	CPU_SMT_ENABLED,
-	CPU_SMT_DISABLED,
-	CPU_SMT_FORCE_DISABLED,
-	CPU_SMT_NOT_SUPPORTED,
-	CPU_SMT_NOT_IMPLEMENTED,
-};
-
-#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
-extern enum cpuhp_smt_control cpu_smt_control;
-extern void cpu_smt_disable(bool force);
-extern void cpu_smt_check_topology(void);
-extern bool cpu_smt_possible(void);
-extern int cpuhp_smt_enable(void);
-extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval);
-#else
-# define cpu_smt_control		(CPU_SMT_NOT_IMPLEMENTED)
-static inline void cpu_smt_disable(bool force) { }
-static inline void cpu_smt_check_topology(void) { }
-static inline bool cpu_smt_possible(void) { return false; }
-static inline int cpuhp_smt_enable(void) { return 0; }
-static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; }
-#endif
-
 extern bool cpu_mitigations_off(void);
 extern bool cpu_mitigations_auto_nosmt(void);
 
diff --git a/include/linux/cpu_smt.h b/include/linux/cpu_smt.h
new file mode 100644
index 000000000000..17e105b52d85
--- /dev/null
+++ b/include/linux/cpu_smt.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_CPU_SMT_H_
+#define _LINUX_CPU_SMT_H_
+
+enum cpuhp_smt_control {
+	CPU_SMT_ENABLED,
+	CPU_SMT_DISABLED,
+	CPU_SMT_FORCE_DISABLED,
+	CPU_SMT_NOT_SUPPORTED,
+	CPU_SMT_NOT_IMPLEMENTED,
+};
+
+#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
+extern enum cpuhp_smt_control cpu_smt_control;
+extern void cpu_smt_disable(bool force);
+extern void cpu_smt_check_topology(void);
+extern bool cpu_smt_possible(void);
+extern int cpuhp_smt_enable(void);
+extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval);
+#else
+# define cpu_smt_control		(CPU_SMT_NOT_IMPLEMENTED)
+static inline void cpu_smt_disable(bool force) { }
+static inline void cpu_smt_check_topology(void) { }
+static inline bool cpu_smt_possible(void) { return false; }
+static inline int cpuhp_smt_enable(void) { return 0; }
+static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; }
+#endif
+
+#endif /* _LINUX_CPU_SMT_H_ */
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-06-14 12:29 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24 15:56 [PATCH 1/9] cpu/SMT: Move SMT prototypes into cpu_smt.h Michael Ellerman
2023-05-24 15:56 ` [PATCH 2/9] cpu/SMT: Move smt/control simple exit cases earlier Michael Ellerman
2023-05-24 15:56 ` [PATCH 3/9] cpu/SMT: Store the current/max number of threads Michael Ellerman
2023-06-10 21:26   ` Thomas Gleixner
2023-06-10 22:08     ` Thomas Gleixner
2023-06-13 17:16     ` Laurent Dufour
2023-06-13 18:53       ` Thomas Gleixner
2023-06-14 12:27         ` Laurent Dufour
2023-05-24 15:56 ` [PATCH 4/9] cpu/SMT: Create topology_smt_threads_supported() Michael Ellerman
2023-06-10 22:15   ` Thomas Gleixner
2023-05-24 15:56 ` [PATCH 5/9] cpu/SMT: Create topology_smt_thread_allowed() Michael Ellerman
2023-06-10 22:35   ` Thomas Gleixner
2023-05-24 15:56 ` [PATCH 6/9] cpu/SMT: Allow enabling partial SMT states via sysfs Michael Ellerman
2023-06-10 20:09   ` Thomas Gleixner
2023-06-10 20:13     ` Thomas Gleixner
2023-05-24 15:56 ` [PATCH 7/9] powerpc/pseries: Initialise CPU hotplug callbacks earlier Michael Ellerman
2023-05-24 15:56 ` [PATCH 8/9] powerpc: Add HOTPLUG_SMT support Michael Ellerman
2023-06-01 13:27   ` Laurent Dufour
2023-06-01 16:19     ` Laurent Dufour
2023-06-10 21:10       ` Thomas Gleixner
2023-06-12 15:20         ` Laurent Dufour
2023-06-12 16:34           ` Thomas Gleixner
2023-05-24 15:56 ` [PATCH 9/9] powerpc/pseries: Honour current SMT state when DLPAR onlining CPUs Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).