xref: /linux/arch/x86/kernel/apic/local.h (revision 6f7e6393d1ce636bb7ec77a7fe7b77458fddf701)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Historical copyright notices:
4  *
5  * Copyright 2004 James Cleverdon, IBM.
6  * (c) 1995 Alan Cox, Building #3 <alan@redhat.com>
7  * (c) 1998-99, 2000 Ingo Molnar <mingo@redhat.com>
8  * (c) 2002,2003 Andi Kleen, SuSE Labs.
9  */
10 
11 #include <linux/jump_label.h>
12 
13 #include <asm/irq_vectors.h>
14 #include <asm/apic.h>
15 
16 /* X2APIC */
17 u32 x2apic_get_apic_id(u32 id);
18 
19 void x2apic_send_IPI_all(int vector);
20 void x2apic_send_IPI_allbutself(int vector);
21 void x2apic_send_IPI_self(int vector);
22 extern u32 x2apic_max_apicid;
23 
24 /* IPI */
25 
26 DECLARE_STATIC_KEY_FALSE(apic_use_ipi_shorthand);
27 
28 static inline unsigned int __prepare_ICR(unsigned int shortcut, int vector,
29 					 unsigned int dest)
30 {
31 	unsigned int icr = shortcut | dest;
32 
33 	switch (vector) {
34 	default:
35 		icr |= APIC_DM_FIXED | vector;
36 		break;
37 	case NMI_VECTOR:
38 		icr |= APIC_DM_NMI;
39 		break;
40 	}
41 	return icr;
42 }
43 
44 #ifdef CONFIG_X86_X2APIC
45 static inline void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest)
46 {
47 	unsigned long cfg = __prepare_ICR(0, vector, dest);
48 
49 	native_x2apic_icr_write(cfg, apicid);
50 }
51 #endif
52 
53 void default_init_apic_ldr(void);
54 
55 void apic_mem_wait_icr_idle(void);
56 u32 apic_mem_wait_icr_idle_timeout(void);
57 
58 /*
59  * This is used to send an IPI with no shorthand notation (the destination is
60  * specified in bits 56 to 63 of the ICR).
61  */
62 void __default_send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest);
63 
64 void default_send_IPI_single(int cpu, int vector);
65 void default_send_IPI_single_phys(int cpu, int vector);
66 void default_send_IPI_mask_sequence_phys(const struct cpumask *mask, int vector);
67 void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, int vector);
68 void default_send_IPI_allbutself(int vector);
69 void default_send_IPI_all(int vector);
70 void default_send_IPI_self(int vector);
71 
72 #ifdef CONFIG_X86_32
73 void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, int vector);
74 void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, int vector);
75 void default_send_IPI_mask_logical(const struct cpumask *mask, int vector);
76 #endif
77