1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 24baa9922SRussell King /* 34baa9922SRussell King * arch/arm/include/asm/smp.h 44baa9922SRussell King * 54baa9922SRussell King * Copyright (C) 2004-2005 ARM Ltd. 64baa9922SRussell King */ 74baa9922SRussell King #ifndef __ASM_ARM_SMP_H 84baa9922SRussell King #define __ASM_ARM_SMP_H 94baa9922SRussell King 104baa9922SRussell King #include <linux/threads.h> 114baa9922SRussell King #include <linux/cpumask.h> 124baa9922SRussell King #include <linux/thread_info.h> 134baa9922SRussell King 144baa9922SRussell King #ifndef CONFIG_SMP 154baa9922SRussell King # error "<asm/smp.h> included in non-SMP build" 164baa9922SRussell King #endif 174baa9922SRussell King 184baa9922SRussell King #define raw_smp_processor_id() (current_thread_info()->cpu) 194baa9922SRussell King 204baa9922SRussell King struct seq_file; 214baa9922SRussell King 224baa9922SRussell King /* 234baa9922SRussell King * generate IPI list text 244baa9922SRussell King */ 25f13cd417SRussell King extern void show_ipi_list(struct seq_file *, int); 264baa9922SRussell King 274baa9922SRussell King /* 284baa9922SRussell King * Called from assembly code, this handles an IPI. 294baa9922SRussell King */ 30ad3b6993SRussell King asmlinkage void do_IPI(int ipinr, struct pt_regs *regs); 314baa9922SRussell King 324baa9922SRussell King /* 330b5a1b95SShawn Guo * Called from C code, this handles an IPI. 340b5a1b95SShawn Guo */ 350b5a1b95SShawn Guo void handle_IPI(int ipinr, struct pt_regs *regs); 360b5a1b95SShawn Guo 370b5a1b95SShawn Guo /* 38e03cdadeSRussell King * Setup the set of possible CPUs (via set_cpu_possible) 394baa9922SRussell King */ 404baa9922SRussell King extern void smp_init_cpus(void); 414baa9922SRussell King 424baa9922SRussell King /* 4356afcd3dSMarc Zyngier * Register IPI interrupts with the arch SMP code 4456afcd3dSMarc Zyngier */ 4556afcd3dSMarc Zyngier extern void set_smp_ipi_range(int ipi_base, int nr_ipi); 4656afcd3dSMarc Zyngier 4756afcd3dSMarc Zyngier /* 484baa9922SRussell King * Called from platform specific assembly code, this is the 494baa9922SRussell King * secondary CPU entry point. 504baa9922SRussell King */ 51*19f29aebSKeith Packard asmlinkage void secondary_start_kernel(struct task_struct *task); 524baa9922SRussell King 5305c74a6cSRussell King 5405c74a6cSRussell King /* 554baa9922SRussell King * Initial data for bringing up a secondary CPU. 564baa9922SRussell King */ 574baa9922SRussell King struct secondary_data { 58eb08375eSJonathan Austin union { 59a0995c08SVladimir Murzin struct mpu_rgn_info *mpu_rgn_info; 60b2c3e38aSRussell King u64 pgdir; 61eb08375eSJonathan Austin }; 62d427958aSCatalin Marinas unsigned long swapper_pg_dir; 634baa9922SRussell King void *stack; 64*19f29aebSKeith Packard struct task_struct *task; 654baa9922SRussell King }; 664baa9922SRussell King extern struct secondary_data secondary_data; 671146b600SArnd Bergmann extern void secondary_startup(void); 6829d2e563SYingjoe Chen extern void secondary_startup_arm(void); 694baa9922SRussell King 704baa9922SRussell King extern int __cpu_disable(void); 714baa9922SRussell King 724baa9922SRussell King extern void __cpu_die(unsigned int cpu); 734baa9922SRussell King 744baa9922SRussell King extern void arch_send_call_function_single_ipi(int cpu); 7582668104SRussell King extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 76b62655f4SShawn Guo extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask); 774baa9922SRussell King 785135d875SNicolas Pitre extern int register_ipi_completion(struct completion *completion, int cpu); 795135d875SNicolas Pitre 80abcee5fbSMarc Zyngier struct smp_operations { 81abcee5fbSMarc Zyngier #ifdef CONFIG_SMP 82abcee5fbSMarc Zyngier /* 83abcee5fbSMarc Zyngier * Setup the set of possible CPUs (via set_cpu_possible) 84abcee5fbSMarc Zyngier */ 85abcee5fbSMarc Zyngier void (*smp_init_cpus)(void); 86abcee5fbSMarc Zyngier /* 87abcee5fbSMarc Zyngier * Initialize cpu_possible map, and enable coherency 88abcee5fbSMarc Zyngier */ 89abcee5fbSMarc Zyngier void (*smp_prepare_cpus)(unsigned int max_cpus); 90abcee5fbSMarc Zyngier 91abcee5fbSMarc Zyngier /* 92abcee5fbSMarc Zyngier * Perform platform specific initialisation of the specified CPU. 93abcee5fbSMarc Zyngier */ 94abcee5fbSMarc Zyngier void (*smp_secondary_init)(unsigned int cpu); 95abcee5fbSMarc Zyngier /* 96abcee5fbSMarc Zyngier * Boot a secondary CPU, and assign it the specified idle task. 97abcee5fbSMarc Zyngier * This also gives us the initial stack to use for this CPU. 98abcee5fbSMarc Zyngier */ 99abcee5fbSMarc Zyngier int (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle); 100abcee5fbSMarc Zyngier #ifdef CONFIG_HOTPLUG_CPU 101abcee5fbSMarc Zyngier int (*cpu_kill)(unsigned int cpu); 102abcee5fbSMarc Zyngier void (*cpu_die)(unsigned int cpu); 103787047eeSStephen Boyd bool (*cpu_can_disable)(unsigned int cpu); 104abcee5fbSMarc Zyngier int (*cpu_disable)(unsigned int cpu); 105abcee5fbSMarc Zyngier #endif 106abcee5fbSMarc Zyngier #endif 107abcee5fbSMarc Zyngier }; 108abcee5fbSMarc Zyngier 1096c3ff8b1SStephen Boyd struct of_cpu_method { 1106c3ff8b1SStephen Boyd const char *method; 111f460b6abSMasahiro Yamada const struct smp_operations *ops; 1126c3ff8b1SStephen Boyd }; 1136c3ff8b1SStephen Boyd 1146c3ff8b1SStephen Boyd #define CPU_METHOD_OF_DECLARE(name, _method, _ops) \ 1156c3ff8b1SStephen Boyd static const struct of_cpu_method __cpu_method_of_table_##name \ 11633def849SJoe Perches __used __section("__cpu_method_of_table") \ 1176c3ff8b1SStephen Boyd = { .method = _method, .ops = _ops } 118abcee5fbSMarc Zyngier /* 119abcee5fbSMarc Zyngier * set platform specific SMP operations 120abcee5fbSMarc Zyngier */ 1214caa9ddaSMasahiro Yamada extern void smp_set_ops(const struct smp_operations *); 122abcee5fbSMarc Zyngier 1234baa9922SRussell King #endif /* ifndef __ASM_ARM_SMP_H */ 124