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