^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) * SMP Support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 1999 VA Linux Systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * (c) Copyright 2001-2003, 2005 Hewlett-Packard Development Company, L.P.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * David Mosberger-Tang <davidm@hpl.hp.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Bjorn Helgaas <bjorn.helgaas@hp.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #ifndef _ASM_IA64_SMP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define _ASM_IA64_SMP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/threads.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/cpumask.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/bitops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/irqreturn.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/processor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <asm/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static inline unsigned int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) ia64_get_lid (void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned long reserved : 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned long eid : 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) unsigned long id : 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) unsigned long ignored : 32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) } f;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) unsigned long bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) } lid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) lid.bits = ia64_getreg(_IA64_REG_CR_LID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) return lid.f.id << 8 | lid.f.eid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define hard_smp_processor_id() ia64_get_lid()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define raw_smp_processor_id() (current_thread_info()->cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) extern struct smp_boot_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int cpu_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int cpu_phys_id[NR_CPUS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) } smp_boot_data __initdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) extern char no_int_routing;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) extern cpumask_t cpu_core_map[NR_CPUS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) extern int smp_num_siblings;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) extern void __iomem *ipi_base_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern volatile int ia64_cpu_to_sapicid[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define cpu_physical_id(i) ia64_cpu_to_sapicid[i]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) extern unsigned long ap_wakeup_vector;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * Function to map hard smp processor id to logical id. Slow, so don't use this in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * performance-critical code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) cpu_logical_id (int cpuid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) for (i = 0; i < NR_CPUS; ++i)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) if (cpu_physical_id(i) == cpuid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) return i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /* Upping and downing of CPUs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) extern int __cpu_disable (void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) extern void __cpu_die (unsigned int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) extern void cpu_die (void) __attribute__ ((noreturn));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) extern void __init smp_build_cpu_map(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) extern void __init init_smp_config (void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) extern void smp_do_timer (struct pt_regs *regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) extern irqreturn_t handle_IPI(int irq, void *dev_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) extern void smp_send_reschedule (int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) extern void identify_siblings (struct cpuinfo_ia64 *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) extern int is_multithreading_enabled(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) extern void arch_send_call_function_single_ipi(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #else /* CONFIG_SMP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define cpu_logical_id(i) 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define cpu_physical_id(i) ia64_get_lid()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #endif /* CONFIG_SMP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #endif /* _ASM_IA64_SMP_H */