Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_S390_TOPOLOGY_H
0003 #define _ASM_S390_TOPOLOGY_H
0004 
0005 #include <linux/cpumask.h>
0006 #include <asm/numa.h>
0007 
0008 struct sysinfo_15_1_x;
0009 struct cpu;
0010 
0011 #ifdef CONFIG_SCHED_TOPOLOGY
0012 
0013 struct cpu_topology_s390 {
0014     unsigned short thread_id;
0015     unsigned short core_id;
0016     unsigned short socket_id;
0017     unsigned short book_id;
0018     unsigned short drawer_id;
0019     unsigned short dedicated : 1;
0020     int booted_cores;
0021     cpumask_t thread_mask;
0022     cpumask_t core_mask;
0023     cpumask_t book_mask;
0024     cpumask_t drawer_mask;
0025 };
0026 
0027 extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
0028 
0029 #define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id)
0030 #define topology_thread_id(cpu)       (cpu_topology[cpu].thread_id)
0031 #define topology_sibling_cpumask(cpu)     (&cpu_topology[cpu].thread_mask)
0032 #define topology_core_id(cpu)         (cpu_topology[cpu].core_id)
0033 #define topology_core_cpumask(cpu)    (&cpu_topology[cpu].core_mask)
0034 #define topology_book_id(cpu)         (cpu_topology[cpu].book_id)
0035 #define topology_book_cpumask(cpu)    (&cpu_topology[cpu].book_mask)
0036 #define topology_drawer_id(cpu)       (cpu_topology[cpu].drawer_id)
0037 #define topology_drawer_cpumask(cpu)      (&cpu_topology[cpu].drawer_mask)
0038 #define topology_cpu_dedicated(cpu)   (cpu_topology[cpu].dedicated)
0039 #define topology_booted_cores(cpu)    (cpu_topology[cpu].booted_cores)
0040 
0041 #define mc_capable() 1
0042 
0043 void topology_init_early(void);
0044 int topology_cpu_init(struct cpu *);
0045 int topology_set_cpu_management(int fc);
0046 void topology_schedule_update(void);
0047 void store_topology(struct sysinfo_15_1_x *info);
0048 void update_cpu_masks(void);
0049 void topology_expect_change(void);
0050 const struct cpumask *cpu_coregroup_mask(int cpu);
0051 
0052 #else /* CONFIG_SCHED_TOPOLOGY */
0053 
0054 static inline void topology_init_early(void) { }
0055 static inline void topology_schedule_update(void) { }
0056 static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
0057 static inline int topology_cpu_dedicated(int cpu_nr) { return 0; }
0058 static inline int topology_booted_cores(int cpu_nr) { return 1; }
0059 static inline void update_cpu_masks(void) { }
0060 static inline void topology_expect_change(void) { }
0061 
0062 #endif /* CONFIG_SCHED_TOPOLOGY */
0063 
0064 #define POLARIZATION_UNKNOWN    (-1)
0065 #define POLARIZATION_HRZ    (0)
0066 #define POLARIZATION_VL     (1)
0067 #define POLARIZATION_VM     (2)
0068 #define POLARIZATION_VH     (3)
0069 
0070 #define SD_BOOK_INIT    SD_CPU_INIT
0071 
0072 #ifdef CONFIG_NUMA
0073 
0074 #define cpu_to_node cpu_to_node
0075 static inline int cpu_to_node(int cpu)
0076 {
0077     return 0;
0078 }
0079 
0080 /* Returns a pointer to the cpumask of CPUs on node 'node'. */
0081 #define cpumask_of_node cpumask_of_node
0082 static inline const struct cpumask *cpumask_of_node(int node)
0083 {
0084     return cpu_possible_mask;
0085 }
0086 
0087 #define pcibus_to_node(bus) __pcibus_to_node(bus)
0088 
0089 #else /* !CONFIG_NUMA */
0090 
0091 #define numa_node_id numa_node_id
0092 static inline int numa_node_id(void)
0093 {
0094     return 0;
0095 }
0096 
0097 #endif /* CONFIG_NUMA */
0098 
0099 #include <asm-generic/topology.h>
0100 
0101 #endif /* _ASM_S390_TOPOLOGY_H */