1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 27f30491cSTony Luck /* 37f30491cSTony Luck * SMP Support 47f30491cSTony Luck * 57f30491cSTony Luck * Copyright (C) 1999 VA Linux Systems 67f30491cSTony Luck * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> 77f30491cSTony Luck * (c) Copyright 2001-2003, 2005 Hewlett-Packard Development Company, L.P. 87f30491cSTony Luck * David Mosberger-Tang <davidm@hpl.hp.com> 97f30491cSTony Luck * Bjorn Helgaas <bjorn.helgaas@hp.com> 107f30491cSTony Luck */ 117f30491cSTony Luck #ifndef _ASM_IA64_SMP_H 127f30491cSTony Luck #define _ASM_IA64_SMP_H 137f30491cSTony Luck 147f30491cSTony Luck #include <linux/init.h> 157f30491cSTony Luck #include <linux/threads.h> 167f30491cSTony Luck #include <linux/kernel.h> 177f30491cSTony Luck #include <linux/cpumask.h> 187f30491cSTony Luck #include <linux/bitops.h> 197f30491cSTony Luck #include <linux/irqreturn.h> 207f30491cSTony Luck 217f30491cSTony Luck #include <asm/param.h> 227f30491cSTony Luck #include <asm/processor.h> 237f30491cSTony Luck #include <asm/ptrace.h> 247f30491cSTony Luck 257f30491cSTony Luck static inline unsigned int ia64_get_lid(void)267f30491cSTony Luckia64_get_lid (void) 277f30491cSTony Luck { 287f30491cSTony Luck union { 297f30491cSTony Luck struct { 307f30491cSTony Luck unsigned long reserved : 16; 317f30491cSTony Luck unsigned long eid : 8; 327f30491cSTony Luck unsigned long id : 8; 337f30491cSTony Luck unsigned long ignored : 32; 347f30491cSTony Luck } f; 357f30491cSTony Luck unsigned long bits; 367f30491cSTony Luck } lid; 377f30491cSTony Luck 387f30491cSTony Luck lid.bits = ia64_getreg(_IA64_REG_CR_LID); 397f30491cSTony Luck return lid.f.id << 8 | lid.f.eid; 407f30491cSTony Luck } 417f30491cSTony Luck 427f30491cSTony Luck #define hard_smp_processor_id() ia64_get_lid() 437f30491cSTony Luck 447f30491cSTony Luck #ifdef CONFIG_SMP 457f30491cSTony Luck 467f30491cSTony Luck #define raw_smp_processor_id() (current_thread_info()->cpu) 477f30491cSTony Luck 487f30491cSTony Luck extern struct smp_boot_data { 497f30491cSTony Luck int cpu_count; 507f30491cSTony Luck int cpu_phys_id[NR_CPUS]; 517f30491cSTony Luck } smp_boot_data __initdata; 527f30491cSTony Luck 535b5e76e9SGreg Kroah-Hartman extern char no_int_routing; 547f30491cSTony Luck 557f30491cSTony Luck extern cpumask_t cpu_core_map[NR_CPUS]; 569b8de747SDavid Howells DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map); 577f30491cSTony Luck extern int smp_num_siblings; 587f30491cSTony Luck extern void __iomem *ipi_base_addr; 597f30491cSTony Luck 607f30491cSTony Luck extern volatile int ia64_cpu_to_sapicid[]; 617f30491cSTony Luck #define cpu_physical_id(i) ia64_cpu_to_sapicid[i] 627f30491cSTony Luck 637f30491cSTony Luck extern unsigned long ap_wakeup_vector; 647f30491cSTony Luck 657f30491cSTony Luck /* 667f30491cSTony Luck * Function to map hard smp processor id to logical id. Slow, so don't use this in 677f30491cSTony Luck * performance-critical code. 687f30491cSTony Luck */ 697f30491cSTony Luck static inline int cpu_logical_id(int cpuid)707f30491cSTony Luckcpu_logical_id (int cpuid) 717f30491cSTony Luck { 727f30491cSTony Luck int i; 737f30491cSTony Luck 747f30491cSTony Luck for (i = 0; i < NR_CPUS; ++i) 757f30491cSTony Luck if (cpu_physical_id(i) == cpuid) 767f30491cSTony Luck break; 777f30491cSTony Luck return i; 787f30491cSTony Luck } 797f30491cSTony Luck 807f30491cSTony Luck /* Upping and downing of CPUs */ 817f30491cSTony Luck extern int __cpu_disable (void); 827f30491cSTony Luck extern void __cpu_die (unsigned int cpu); 837f30491cSTony Luck extern void cpu_die (void) __attribute__ ((noreturn)); 847f30491cSTony Luck extern void __init smp_build_cpu_map(void); 857f30491cSTony Luck 867f30491cSTony Luck extern void __init init_smp_config (void); 877f30491cSTony Luck extern void smp_do_timer (struct pt_regs *regs); 887f30491cSTony Luck 897f30491cSTony Luck extern irqreturn_t handle_IPI(int irq, void *dev_id); 907f30491cSTony Luck extern void smp_send_reschedule (int cpu); 917f30491cSTony Luck extern void identify_siblings (struct cpuinfo_ia64 *); 927f30491cSTony Luck extern int is_multithreading_enabled(void); 937f30491cSTony Luck 947f30491cSTony Luck extern void arch_send_call_function_single_ipi(int cpu); 9540fe697aSRusty Russell extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 967f30491cSTony Luck 977f30491cSTony Luck #else /* CONFIG_SMP */ 987f30491cSTony Luck 997f30491cSTony Luck #define cpu_logical_id(i) 0 1007f30491cSTony Luck #define cpu_physical_id(i) ia64_get_lid() 1017f30491cSTony Luck 1027f30491cSTony Luck #endif /* CONFIG_SMP */ 1037f30491cSTony Luck #endif /* _ASM_IA64_SMP_H */ 104