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 void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest); 18 u32 x2apic_get_apic_id(u32 id); 19 u32 x2apic_set_apic_id(u32 id); 20 u32 x2apic_phys_pkg_id(u32 initial_apicid, int index_msb); 21 22 void x2apic_send_IPI_all(int vector); 23 void x2apic_send_IPI_allbutself(int vector); 24 void x2apic_send_IPI_self(int vector); 25 extern u32 x2apic_max_apicid; 26 27 /* IPI */ 28 29 DECLARE_STATIC_KEY_FALSE(apic_use_ipi_shorthand); 30 31 static inline unsigned int __prepare_ICR(unsigned int shortcut, int vector, 32 unsigned int dest) 33 { 34 unsigned int icr = shortcut | dest; 35 36 switch (vector) { 37 default: 38 icr |= APIC_DM_FIXED | vector; 39 break; 40 case NMI_VECTOR: 41 icr |= APIC_DM_NMI; 42 break; 43 } 44 return icr; 45 } 46 47 void default_init_apic_ldr(void); 48 49 void apic_mem_wait_icr_idle(void); 50 u32 apic_mem_wait_icr_idle_timeout(void); 51 52 /* 53 * This is used to send an IPI with no shorthand notation (the destination is 54 * specified in bits 56 to 63 of the ICR). 55 */ 56 void __default_send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest); 57 58 void default_send_IPI_single(int cpu, int vector); 59 void default_send_IPI_single_phys(int cpu, int vector); 60 void default_send_IPI_mask_sequence_phys(const struct cpumask *mask, int vector); 61 void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, int vector); 62 void default_send_IPI_allbutself(int vector); 63 void default_send_IPI_all(int vector); 64 void default_send_IPI_self(int vector); 65 66 bool default_apic_id_registered(void); 67 bool default_check_apicid_used(physid_mask_t *map, u32 apicid); 68 69 #ifdef CONFIG_X86_32 70 void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, int vector); 71 void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, int vector); 72 void default_send_IPI_mask_logical(const struct cpumask *mask, int vector); 73 void x86_32_probe_bigsmp_early(void); 74 void x86_32_install_bigsmp(void); 75 #else 76 static inline void x86_32_probe_bigsmp_early(void) { } 77 static inline void x86_32_install_bigsmp(void) { } 78 #endif 79 80 #ifdef CONFIG_X86_BIGSMP 81 bool apic_bigsmp_possible(bool cmdline_selected); 82 void apic_bigsmp_force(void); 83 #else 84 static inline bool apic_bigsmp_possible(bool cmdline_selected) { return false; }; 85 static inline void apic_bigsmp_force(void) { } 86 #endif 87