Lines Matching +full:per +full:- +full:cpu +full:- +full:cluster

1 // SPDX-License-Identifier: GPL-2.0
17 * Using per cpu variable would cost one cache line per cpu.
29 static void x2apic_send_IPI(int cpu, int vector) in x2apic_send_IPI() argument
31 u32 dest = x86_cpu_to_logical_apicid[cpu]; in x2apic_send_IPI()
41 unsigned int cpu, clustercpu; in __x2apic_send_IPI_mask() local
52 /* If IPI should not be sent to self, clear current CPU */ in __x2apic_send_IPI_mask()
56 /* Collapse cpus in a cluster so a single IPI per cluster is sent */ in __x2apic_send_IPI_mask()
57 for_each_cpu(cpu, tmpmsk) { in __x2apic_send_IPI_mask()
58 struct cpumask *cmsk = per_cpu(cluster_masks, cpu); in __x2apic_send_IPI_mask()
68 /* Remove cluster CPUs from tmpmask */ in __x2apic_send_IPI_mask()
86 static u32 x2apic_calc_apicid(unsigned int cpu) in x2apic_calc_apicid() argument
88 return x86_cpu_to_logical_apicid[cpu]; in x2apic_calc_apicid()
105 static void prefill_clustermask(struct cpumask *cmsk, unsigned int cpu, u32 cluster) in prefill_clustermask() argument
111 u32 apicid = apic->cpu_present_to_apicid(cpu_i); in prefill_clustermask()
113 if (apicid == BAD_APICID || cpu_i == cpu || apic_cluster(apicid) != cluster) in prefill_clustermask()
124 static int alloc_clustermask(unsigned int cpu, u32 cluster, int node) in alloc_clustermask() argument
130 * At boot time, the CPU present mask is stable. The cluster mask is in alloc_clustermask()
131 * allocated for the first CPU in the cluster and propagated to all in alloc_clustermask()
132 * present siblings in the cluster. If the cluster mask is already set in alloc_clustermask()
133 * on entry to this function for a given CPU, there is nothing to do. in alloc_clustermask()
135 if (per_cpu(cluster_masks, cpu)) in alloc_clustermask()
142 * On post boot hotplug for a CPU which was not present at boot time, in alloc_clustermask()
144 * any more) to find any existing cluster mask. in alloc_clustermask()
147 u32 apicid = apic->cpu_present_to_apicid(cpu_i); in alloc_clustermask()
149 if (apicid != BAD_APICID && apic_cluster(apicid) == cluster) { in alloc_clustermask()
152 * If the cluster is already initialized, just store in alloc_clustermask()
156 per_cpu(cluster_masks, cpu) = cmsk; in alloc_clustermask()
162 * No CPU in the cluster has ever been initialized, so fall through to in alloc_clustermask()
163 * the boot time code which will also populate the cluster mask for any in alloc_clustermask()
164 * other CPU in the cluster which is (now) present. in alloc_clustermask()
169 return -ENOMEM; in alloc_clustermask()
170 per_cpu(cluster_masks, cpu) = cmsk; in alloc_clustermask()
171 prefill_clustermask(cmsk, cpu, cluster); in alloc_clustermask()
176 static int x2apic_prepare_cpu(unsigned int cpu) in x2apic_prepare_cpu() argument
178 u32 phys_apicid = apic->cpu_present_to_apicid(cpu); in x2apic_prepare_cpu()
179 u32 cluster = apic_cluster(phys_apicid); in x2apic_prepare_cpu() local
180 u32 logical_apicid = (cluster << 16) | (1 << (phys_apicid & 0xf)); in x2apic_prepare_cpu()
181 int node = cpu_to_node(cpu); in x2apic_prepare_cpu()
183 x86_cpu_to_logical_apicid[cpu] = logical_apicid; in x2apic_prepare_cpu()
185 if (alloc_clustermask(cpu, cluster, node) < 0) in x2apic_prepare_cpu()
186 return -ENOMEM; in x2apic_prepare_cpu()
188 if (!zalloc_cpumask_var_node(&per_cpu(ipi_mask, cpu), GFP_KERNEL, node)) in x2apic_prepare_cpu()
189 return -ENOMEM; in x2apic_prepare_cpu()
229 .name = "cluster x2apic",