Lines Matching +full:1 +full:- +full:cpu
1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/cpu.h>
10 #include <xen/hvc-console.h>
11 #include "xen-ops.h"
13 static DEFINE_PER_CPU(struct xen_common_irq, xen_resched_irq) = { .irq = -1 };
14 static DEFINE_PER_CPU(struct xen_common_irq, xen_callfunc_irq) = { .irq = -1 };
15 static DEFINE_PER_CPU(struct xen_common_irq, xen_callfuncsingle_irq) = { .irq = -1 };
16 static DEFINE_PER_CPU(struct xen_common_irq, xen_debug_irq) = { .irq = -1 };
32 void xen_smp_intr_free(unsigned int cpu) in xen_smp_intr_free() argument
34 kfree(per_cpu(xen_resched_irq, cpu).name); in xen_smp_intr_free()
35 per_cpu(xen_resched_irq, cpu).name = NULL; in xen_smp_intr_free()
36 if (per_cpu(xen_resched_irq, cpu).irq >= 0) { in xen_smp_intr_free()
37 unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu).irq, NULL); in xen_smp_intr_free()
38 per_cpu(xen_resched_irq, cpu).irq = -1; in xen_smp_intr_free()
40 kfree(per_cpu(xen_callfunc_irq, cpu).name); in xen_smp_intr_free()
41 per_cpu(xen_callfunc_irq, cpu).name = NULL; in xen_smp_intr_free()
42 if (per_cpu(xen_callfunc_irq, cpu).irq >= 0) { in xen_smp_intr_free()
43 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu).irq, NULL); in xen_smp_intr_free()
44 per_cpu(xen_callfunc_irq, cpu).irq = -1; in xen_smp_intr_free()
46 kfree(per_cpu(xen_debug_irq, cpu).name); in xen_smp_intr_free()
47 per_cpu(xen_debug_irq, cpu).name = NULL; in xen_smp_intr_free()
48 if (per_cpu(xen_debug_irq, cpu).irq >= 0) { in xen_smp_intr_free()
49 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu).irq, NULL); in xen_smp_intr_free()
50 per_cpu(xen_debug_irq, cpu).irq = -1; in xen_smp_intr_free()
52 kfree(per_cpu(xen_callfuncsingle_irq, cpu).name); in xen_smp_intr_free()
53 per_cpu(xen_callfuncsingle_irq, cpu).name = NULL; in xen_smp_intr_free()
54 if (per_cpu(xen_callfuncsingle_irq, cpu).irq >= 0) { in xen_smp_intr_free()
55 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu).irq, in xen_smp_intr_free()
57 per_cpu(xen_callfuncsingle_irq, cpu).irq = -1; in xen_smp_intr_free()
61 int xen_smp_intr_init(unsigned int cpu) in xen_smp_intr_init() argument
66 resched_name = kasprintf(GFP_KERNEL, "resched%d", cpu); in xen_smp_intr_init()
69 per_cpu(xen_resched_irq, cpu).name = resched_name; in xen_smp_intr_init()
71 cpu, in xen_smp_intr_init()
78 per_cpu(xen_resched_irq, cpu).irq = rc; in xen_smp_intr_init()
80 callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu); in xen_smp_intr_init()
83 per_cpu(xen_callfunc_irq, cpu).name = callfunc_name; in xen_smp_intr_init()
85 cpu, in xen_smp_intr_init()
92 per_cpu(xen_callfunc_irq, cpu).irq = rc; in xen_smp_intr_init()
95 debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); in xen_smp_intr_init()
99 per_cpu(xen_debug_irq, cpu).name = debug_name; in xen_smp_intr_init()
100 rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, in xen_smp_intr_init()
106 per_cpu(xen_debug_irq, cpu).irq = rc; in xen_smp_intr_init()
109 callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu); in xen_smp_intr_init()
113 per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name; in xen_smp_intr_init()
115 cpu, in xen_smp_intr_init()
122 per_cpu(xen_callfuncsingle_irq, cpu).irq = rc; in xen_smp_intr_init()
127 rc = -ENOMEM; in xen_smp_intr_init()
129 xen_smp_intr_free(cpu); in xen_smp_intr_init()
139 void xen_smp_send_reschedule(int cpu) in xen_smp_send_reschedule() argument
141 xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR); in xen_smp_send_reschedule()
147 unsigned cpu; in __xen_send_IPI_mask() local
149 for_each_cpu_and(cpu, mask, cpu_online_mask) in __xen_send_IPI_mask()
150 xen_send_IPI_one(cpu, vector); in __xen_send_IPI_mask()
155 int cpu; in xen_smp_send_call_function_ipi() local
160 for_each_cpu(cpu, mask) { in xen_smp_send_call_function_ipi()
161 if (xen_vcpu_stolen(cpu)) { in xen_smp_send_call_function_ipi()
168 void xen_smp_send_call_function_single_ipi(int cpu) in xen_smp_send_call_function_single_ipi() argument
170 __xen_send_IPI_mask(cpumask_of(cpu), in xen_smp_send_call_function_single_ipi()
198 xen_vector = -1; in xen_map_vector()
234 unsigned cpu; in xen_send_IPI_mask_allbutself() local
238 if (!(num_online_cpus() > 1) || (xen_vector < 0)) in xen_send_IPI_mask_allbutself()
241 for_each_cpu_and(cpu, mask, cpu_online_mask) { in xen_send_IPI_mask_allbutself()
242 if (this_cpu == cpu) in xen_send_IPI_mask_allbutself()
245 xen_send_IPI_one(cpu, xen_vector); in xen_send_IPI_mask_allbutself()