Thomas Gleixner | c94f071 | 2019-07-22 20:47:14 +0200 | [diff] [blame] | 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 | */ |
Thomas Gleixner | 6a1cb5f | 2019-07-22 20:47:22 +0200 | [diff] [blame] | 10 | |
| 11 | #include <linux/jump_label.h> |
| 12 | |
Ingo Molnar | 13c0113 | 2020-08-06 14:34:32 +0200 | [diff] [blame] | 13 | #include <asm/irq_vectors.h> |
Thomas Gleixner | c94f071 | 2019-07-22 20:47:14 +0200 | [diff] [blame] | 14 | #include <asm/apic.h> |
| 15 | |
| 16 | /* APIC flat 64 */ |
| 17 | void flat_init_apic_ldr(void); |
| 18 | |
| 19 | /* X2APIC */ |
| 20 | int x2apic_apic_id_valid(u32 apicid); |
| 21 | int x2apic_apic_id_registered(void); |
| 22 | void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest); |
| 23 | unsigned int x2apic_get_apic_id(unsigned long id); |
| 24 | u32 x2apic_set_apic_id(unsigned int id); |
| 25 | int x2apic_phys_pkg_id(int initial_apicid, int index_msb); |
| 26 | void x2apic_send_IPI_self(int vector); |
Thomas Gleixner | 43931d3 | 2019-07-22 20:47:30 +0200 | [diff] [blame] | 27 | void __x2apic_send_IPI_shorthand(int vector, u32 which); |
Thomas Gleixner | c94f071 | 2019-07-22 20:47:14 +0200 | [diff] [blame] | 28 | |
| 29 | /* IPI */ |
Thomas Gleixner | 6a1cb5f | 2019-07-22 20:47:22 +0200 | [diff] [blame] | 30 | |
| 31 | DECLARE_STATIC_KEY_FALSE(apic_use_ipi_shorthand); |
| 32 | |
Thomas Gleixner | c94f071 | 2019-07-22 20:47:14 +0200 | [diff] [blame] | 33 | static inline unsigned int __prepare_ICR(unsigned int shortcut, int vector, |
| 34 | unsigned int dest) |
| 35 | { |
| 36 | unsigned int icr = shortcut | dest; |
| 37 | |
| 38 | switch (vector) { |
| 39 | default: |
| 40 | icr |= APIC_DM_FIXED | vector; |
| 41 | break; |
| 42 | case NMI_VECTOR: |
| 43 | icr |= APIC_DM_NMI; |
| 44 | break; |
| 45 | } |
| 46 | return icr; |
| 47 | } |
| 48 | |
Thomas Gleixner | 3994ff9 | 2019-07-22 20:47:19 +0200 | [diff] [blame] | 49 | void __default_send_IPI_shortcut(unsigned int shortcut, int vector); |
Thomas Gleixner | c94f071 | 2019-07-22 20:47:14 +0200 | [diff] [blame] | 50 | |
| 51 | /* |
| 52 | * This is used to send an IPI with no shorthand notation (the destination is |
| 53 | * specified in bits 56 to 63 of the ICR). |
| 54 | */ |
| 55 | void __default_send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest); |
| 56 | |
| 57 | void default_send_IPI_single(int cpu, int vector); |
| 58 | void default_send_IPI_single_phys(int cpu, int vector); |
| 59 | void default_send_IPI_mask_sequence_phys(const struct cpumask *mask, int vector); |
| 60 | void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, int vector); |
Thomas Gleixner | dea9786 | 2019-07-22 20:47:28 +0200 | [diff] [blame] | 61 | void default_send_IPI_allbutself(int vector); |
| 62 | void default_send_IPI_all(int vector); |
| 63 | void default_send_IPI_self(int vector); |
Thomas Gleixner | c94f071 | 2019-07-22 20:47:14 +0200 | [diff] [blame] | 64 | |
Thomas Gleixner | c94f071 | 2019-07-22 20:47:14 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_X86_32 |
| 66 | void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, int vector); |
| 67 | void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, int vector); |
| 68 | void default_send_IPI_mask_logical(const struct cpumask *mask, int vector); |
Thomas Gleixner | c94f071 | 2019-07-22 20:47:14 +0200 | [diff] [blame] | 69 | #endif |