^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _ASM_S390_TOPOLOGY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _ASM_S390_TOPOLOGY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/cpumask.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <asm/numa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) struct sysinfo_15_1_x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct cpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #ifdef CONFIG_SCHED_TOPOLOGY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct cpu_topology_s390 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) unsigned short thread_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) unsigned short core_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) unsigned short socket_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned short book_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) unsigned short drawer_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned short dedicated : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) int booted_cores;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) cpumask_t thread_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) cpumask_t core_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) cpumask_t book_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) cpumask_t drawer_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define topology_thread_id(cpu) (cpu_topology[cpu].thread_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define topology_core_id(cpu) (cpu_topology[cpu].core_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define topology_book_id(cpu) (cpu_topology[cpu].book_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define topology_book_cpumask(cpu) (&cpu_topology[cpu].book_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define topology_drawer_id(cpu) (cpu_topology[cpu].drawer_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define topology_drawer_cpumask(cpu) (&cpu_topology[cpu].drawer_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define topology_cpu_dedicated(cpu) (cpu_topology[cpu].dedicated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define topology_booted_cores(cpu) (cpu_topology[cpu].booted_cores)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define mc_capable() 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void topology_init_early(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int topology_cpu_init(struct cpu *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int topology_set_cpu_management(int fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void topology_schedule_update(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void store_topology(struct sysinfo_15_1_x *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) void update_cpu_masks(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void topology_expect_change(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) const struct cpumask *cpu_coregroup_mask(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #else /* CONFIG_SCHED_TOPOLOGY */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static inline void topology_init_early(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static inline void topology_schedule_update(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static inline int topology_cpu_dedicated(int cpu_nr) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) static inline int topology_booted_cores(int cpu_nr) { return 1; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static inline void update_cpu_masks(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static inline void topology_expect_change(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #endif /* CONFIG_SCHED_TOPOLOGY */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define POLARIZATION_UNKNOWN (-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define POLARIZATION_HRZ (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define POLARIZATION_VL (1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define POLARIZATION_VM (2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define POLARIZATION_VH (3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define SD_BOOK_INIT SD_CPU_INIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #ifdef CONFIG_NUMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define cpu_to_node cpu_to_node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) static inline int cpu_to_node(int cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /* Returns a pointer to the cpumask of CPUs on node 'node'. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define cpumask_of_node cpumask_of_node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) static inline const struct cpumask *cpumask_of_node(int node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) return cpu_possible_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define pcibus_to_node(bus) __pcibus_to_node(bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #else /* !CONFIG_NUMA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define numa_node_id numa_node_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) static inline int numa_node_id(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #endif /* CONFIG_NUMA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #include <asm-generic/topology.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #endif /* _ASM_S390_TOPOLOGY_H */