Linux Audio

Check our new training course

Loading...
v6.9.4
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef _ASM_POWERPC_TOPOLOGY_H
  3#define _ASM_POWERPC_TOPOLOGY_H
  4#ifdef __KERNEL__
  5
  6
  7struct device;
  8struct device_node;
  9struct drmem_lmb;
 10
 11#ifdef CONFIG_NUMA
 12
 13/*
 14 * If zone_reclaim_mode is enabled, a RECLAIM_DISTANCE of 10 will mean that
 15 * all zones on all nodes will be eligible for zone_reclaim().
 16 */
 17#define RECLAIM_DISTANCE 10
 18
 19#include <asm/mmzone.h>
 20
 
 
 21#define cpumask_of_node(node) ((node) == -1 ?				\
 22			       cpu_all_mask :				\
 23			       node_to_cpumask_map[node])
 24
 25struct pci_bus;
 26#ifdef CONFIG_PCI
 27extern int pcibus_to_node(struct pci_bus *bus);
 28#else
 29static inline int pcibus_to_node(struct pci_bus *bus)
 30{
 31	return -1;
 32}
 33#endif
 34
 35#define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
 36				 cpu_all_mask :				\
 37				 cpumask_of_node(pcibus_to_node(bus)))
 38
 39int cpu_relative_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc);
 40extern int __node_distance(int, int);
 41#define node_distance(a, b) __node_distance(a, b)
 42
 43extern void __init dump_numa_cpu_topology(void);
 44
 45extern int sysfs_add_device_to_node(struct device *dev, int nid);
 46extern void sysfs_remove_device_from_node(struct device *dev, int nid);
 47
 48static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node)
 49{
 50	numa_cpu_lookup_table[cpu] = node;
 51}
 52
 53static inline int early_cpu_to_node(int cpu)
 54{
 55	int nid;
 56
 57	nid = numa_cpu_lookup_table[cpu];
 58
 59	/*
 60	 * Fall back to node 0 if nid is unset (it should be, except bugs).
 61	 * This allows callers to safely do NODE_DATA(early_cpu_to_node(cpu)).
 62	 */
 63	return (nid < 0) ? 0 : nid;
 64}
 65
 66int of_drconf_to_nid_single(struct drmem_lmb *lmb);
 67void update_numa_distance(struct device_node *node);
 68
 69extern void map_cpu_to_node(int cpu, int node);
 70#ifdef CONFIG_HOTPLUG_CPU
 71extern void unmap_cpu_from_node(unsigned long cpu);
 72#endif /* CONFIG_HOTPLUG_CPU */
 73
 74#else
 75
 76static inline int early_cpu_to_node(int cpu) { return 0; }
 77
 78static inline void dump_numa_cpu_topology(void) {}
 79
 80static inline int sysfs_add_device_to_node(struct device *dev, int nid)
 81{
 82	return 0;
 83}
 84
 85static inline void sysfs_remove_device_from_node(struct device *dev,
 86						int nid)
 87{
 88}
 
 89
 90static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node) {}
 91
 92static inline int cpu_relative_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
 
 
 
 93{
 94	return 0;
 95}
 96
 97static inline int of_drconf_to_nid_single(struct drmem_lmb *lmb)
 98{
 99	return first_online_node;
100}
101
102static inline void update_numa_distance(struct device_node *node) {}
103
104#ifdef CONFIG_SMP
105static inline void map_cpu_to_node(int cpu, int node) {}
106#ifdef CONFIG_HOTPLUG_CPU
107static inline void unmap_cpu_from_node(unsigned long cpu) {}
108#endif /* CONFIG_HOTPLUG_CPU */
109#endif /* CONFIG_SMP */
110
111#endif /* CONFIG_NUMA */
112
113#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
114void find_and_update_cpu_nid(int cpu);
115extern int cpu_to_coregroup_id(int cpu);
116#else
117static inline void find_and_update_cpu_nid(int cpu) {}
118static inline int cpu_to_coregroup_id(int cpu)
119{
120#ifdef CONFIG_SMP
121	return cpu_to_core_id(cpu);
122#else
123	return 0;
124#endif
125}
126
127#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
128
129#include <asm-generic/topology.h>
130
131#ifdef CONFIG_SMP
132#include <asm/cputable.h>
133
134#ifdef CONFIG_PPC64
135#include <asm/smp.h>
136
137#define topology_physical_package_id(cpu)	(cpu_to_chip_id(cpu))
138
139#define topology_sibling_cpumask(cpu)	(per_cpu(cpu_sibling_map, cpu))
140#define topology_core_cpumask(cpu)	(per_cpu(cpu_core_map, cpu))
141#define topology_core_id(cpu)		(cpu_to_core_id(cpu))
142
143#endif
144#endif
145
146#ifdef CONFIG_HOTPLUG_SMT
147#include <linux/cpu_smt.h>
148#include <asm/cputhreads.h>
149
150static inline bool topology_is_primary_thread(unsigned int cpu)
151{
152	return cpu == cpu_first_thread_sibling(cpu);
153}
154
155static inline bool topology_smt_thread_allowed(unsigned int cpu)
156{
157	return cpu_thread_in_core(cpu) < cpu_smt_num_threads;
158}
159#endif
160
161#endif /* __KERNEL__ */
162#endif	/* _ASM_POWERPC_TOPOLOGY_H */
v4.10.11
 
 1#ifndef _ASM_POWERPC_TOPOLOGY_H
 2#define _ASM_POWERPC_TOPOLOGY_H
 3#ifdef __KERNEL__
 4
 5
 6struct device;
 7struct device_node;
 
 8
 9#ifdef CONFIG_NUMA
10
11/*
12 * If zone_reclaim_mode is enabled, a RECLAIM_DISTANCE of 10 will mean that
13 * all zones on all nodes will be eligible for zone_reclaim().
14 */
15#define RECLAIM_DISTANCE 10
16
17#include <asm/mmzone.h>
18
19#define parent_node(node)	(node)
20
21#define cpumask_of_node(node) ((node) == -1 ?				\
22			       cpu_all_mask :				\
23			       node_to_cpumask_map[node])
24
25struct pci_bus;
26#ifdef CONFIG_PCI
27extern int pcibus_to_node(struct pci_bus *bus);
28#else
29static inline int pcibus_to_node(struct pci_bus *bus)
30{
31	return -1;
32}
33#endif
34
35#define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
36				 cpu_all_mask :				\
37				 cpumask_of_node(pcibus_to_node(bus)))
38
 
39extern int __node_distance(int, int);
40#define node_distance(a, b) __node_distance(a, b)
41
42extern void __init dump_numa_cpu_topology(void);
43
44extern int sysfs_add_device_to_node(struct device *dev, int nid);
45extern void sysfs_remove_device_from_node(struct device *dev, int nid);
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47#else
48
 
 
49static inline void dump_numa_cpu_topology(void) {}
50
51static inline int sysfs_add_device_to_node(struct device *dev, int nid)
52{
53	return 0;
54}
55
56static inline void sysfs_remove_device_from_node(struct device *dev,
57						int nid)
58{
59}
60#endif /* CONFIG_NUMA */
61
62#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
63extern int start_topology_update(void);
64extern int stop_topology_update(void);
65extern int prrn_is_enabled(void);
66#else
67static inline int start_topology_update(void)
68{
69	return 0;
70}
71static inline int stop_topology_update(void)
 
72{
73	return 0;
74}
75static inline int prrn_is_enabled(void)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76{
 
 
 
77	return 0;
 
78}
 
79#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
80
81#include <asm-generic/topology.h>
82
83#ifdef CONFIG_SMP
84#include <asm/cputable.h>
85
86#ifdef CONFIG_PPC64
87#include <asm/smp.h>
88
89#define topology_physical_package_id(cpu)	(cpu_to_chip_id(cpu))
 
90#define topology_sibling_cpumask(cpu)	(per_cpu(cpu_sibling_map, cpu))
91#define topology_core_cpumask(cpu)	(per_cpu(cpu_core_map, cpu))
92#define topology_core_id(cpu)		(cpu_to_core_id(cpu))
 
 
93#endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94#endif
95
96#endif /* __KERNEL__ */
97#endif	/* _ASM_POWERPC_TOPOLOGY_H */