blob: 4990f6c66288582b21ad01295b032cb13da9ee31 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_S390_TOPOLOGY_H
2#define _ASM_S390_TOPOLOGY_H
3
Heiko Carstensdbd70fb2008-04-17 07:46:12 +02004#include <linux/cpumask.h>
5
Heiko Carstens78609132012-09-03 14:11:32 +02006struct sysinfo_15_1_x;
Heiko Carstens83a24e32011-12-27 11:27:09 +01007struct cpu;
8
9#ifdef CONFIG_SCHED_BOOK
10
Heiko Carstensd1e575082012-11-12 10:03:25 +010011struct cpu_topology_s390 {
Martin Schwidefsky10ad34b2015-01-14 17:52:10 +010012 unsigned short thread_id;
Heiko Carstensd1e575082012-11-12 10:03:25 +010013 unsigned short core_id;
14 unsigned short socket_id;
15 unsigned short book_id;
Martin Schwidefsky10ad34b2015-01-14 17:52:10 +010016 cpumask_t thread_mask;
Heiko Carstensd1e575082012-11-12 10:03:25 +010017 cpumask_t core_mask;
18 cpumask_t book_mask;
19};
Heiko Carstens658e5ce2012-11-10 11:04:27 +010020
Heiko Carstensda0c6362015-02-04 14:48:25 +010021DECLARE_PER_CPU(struct cpu_topology_s390, cpu_topology);
Heiko Carstensd1e575082012-11-12 10:03:25 +010022
Heiko Carstensda0c6362015-02-04 14:48:25 +010023#define topology_physical_package_id(cpu) (per_cpu(cpu_topology, cpu).socket_id)
24#define topology_thread_id(cpu) (per_cpu(cpu_topology, cpu).thread_id)
Bartosz Golaszewski06931e62015-05-26 15:11:28 +020025#define topology_sibling_cpumask(cpu) \
26 (&per_cpu(cpu_topology, cpu).thread_mask)
Heiko Carstensda0c6362015-02-04 14:48:25 +010027#define topology_core_id(cpu) (per_cpu(cpu_topology, cpu).core_id)
28#define topology_core_cpumask(cpu) (&per_cpu(cpu_topology, cpu).core_mask)
29#define topology_book_id(cpu) (per_cpu(cpu_topology, cpu).book_id)
30#define topology_book_cpumask(cpu) (&per_cpu(cpu_topology, cpu).book_mask)
Heiko Carstensd1e575082012-11-12 10:03:25 +010031
32#define mc_capable() 1
Heiko Carstensd00aa4e2008-04-30 13:38:40 +020033
Heiko Carstens83a24e32011-12-27 11:27:09 +010034int topology_cpu_init(struct cpu *);
Heiko Carstensc10fde02008-04-17 07:46:13 +020035int topology_set_cpu_management(int fc);
36void topology_schedule_update(void);
Heiko Carstens96f4a702010-10-25 16:10:54 +020037void store_topology(struct sysinfo_15_1_x *info);
Heiko Carstensd68bddb2011-12-27 11:27:16 +010038void topology_expect_change(void);
Vincent Guittot2dfd7472014-04-11 11:44:38 +020039const struct cpumask *cpu_coregroup_mask(int cpu);
Heiko Carstensc10fde02008-04-17 07:46:13 +020040
Heiko Carstens83a24e32011-12-27 11:27:09 +010041#else /* CONFIG_SCHED_BOOK */
42
43static inline void topology_schedule_update(void) { }
44static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
Heiko Carstensd68bddb2011-12-27 11:27:16 +010045static inline void topology_expect_change(void) { }
Heiko Carstens83a24e32011-12-27 11:27:09 +010046
47#endif /* CONFIG_SCHED_BOOK */
48
49#define POLARIZATION_UNKNOWN (-1)
Heiko Carstensc10fde02008-04-17 07:46:13 +020050#define POLARIZATION_HRZ (0)
51#define POLARIZATION_VL (1)
52#define POLARIZATION_VM (2)
53#define POLARIZATION_VH (3)
54
Linus Torvalds1da177e2005-04-16 15:20:36 -070055#include <asm-generic/topology.h>
56
57#endif /* _ASM_S390_TOPOLOGY_H */