~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/loongarch/include/asm/smp.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Author: Huacai Chen <chenhuacai@loongson.cn>
  4  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  5  */
  6 #ifndef __ASM_SMP_H
  7 #define __ASM_SMP_H
  8 
  9 #ifdef CONFIG_SMP
 10 
 11 #include <linux/atomic.h>
 12 #include <linux/bitops.h>
 13 #include <linux/linkage.h>
 14 #include <linux/threads.h>
 15 #include <linux/cpumask.h>
 16 
 17 struct smp_ops {
 18         void (*init_ipi)(void);
 19         void (*send_ipi_single)(int cpu, unsigned int action);
 20         void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action);
 21 };
 22 extern struct smp_ops mp_ops;
 23 
 24 extern int smp_num_siblings;
 25 extern int num_processors;
 26 extern int disabled_cpus;
 27 extern cpumask_t cpu_sibling_map[];
 28 extern cpumask_t cpu_core_map[];
 29 extern cpumask_t cpu_foreign_map[];
 30 
 31 void loongson_smp_setup(void);
 32 void loongson_prepare_cpus(unsigned int max_cpus);
 33 void loongson_boot_secondary(int cpu, struct task_struct *idle);
 34 void loongson_init_secondary(void);
 35 void loongson_smp_finish(void);
 36 #ifdef CONFIG_HOTPLUG_CPU
 37 int loongson_cpu_disable(void);
 38 void loongson_cpu_die(unsigned int cpu);
 39 #endif
 40 
 41 static inline void plat_smp_setup(void)
 42 {
 43         loongson_smp_setup();
 44 }
 45 
 46 static inline int raw_smp_processor_id(void)
 47 {
 48 #if defined(__VDSO__)
 49         extern int vdso_smp_processor_id(void)
 50                 __compiletime_error("VDSO should not call smp_processor_id()");
 51         return vdso_smp_processor_id();
 52 #else
 53         return current_thread_info()->cpu;
 54 #endif
 55 }
 56 #define raw_smp_processor_id raw_smp_processor_id
 57 
 58 /* Map from cpu id to sequential logical cpu number.  This will only
 59  * not be idempotent when cpus failed to come on-line.  */
 60 extern int __cpu_number_map[NR_CPUS];
 61 #define cpu_number_map(cpu)  __cpu_number_map[cpu]
 62 
 63 /* The reverse map from sequential logical cpu number to cpu id.  */
 64 extern int __cpu_logical_map[NR_CPUS];
 65 #define cpu_logical_map(cpu)  __cpu_logical_map[cpu]
 66 
 67 #define cpu_physical_id(cpu)    cpu_logical_map(cpu)
 68 
 69 #define ACTION_BOOT_CPU 0
 70 #define ACTION_RESCHEDULE       1
 71 #define ACTION_CALL_FUNCTION    2
 72 #define ACTION_IRQ_WORK         3
 73 #define SMP_BOOT_CPU            BIT(ACTION_BOOT_CPU)
 74 #define SMP_RESCHEDULE          BIT(ACTION_RESCHEDULE)
 75 #define SMP_CALL_FUNCTION       BIT(ACTION_CALL_FUNCTION)
 76 #define SMP_IRQ_WORK            BIT(ACTION_IRQ_WORK)
 77 
 78 struct secondary_data {
 79         unsigned long stack;
 80         unsigned long thread_info;
 81 };
 82 extern struct secondary_data cpuboot_data;
 83 
 84 extern asmlinkage void smpboot_entry(void);
 85 extern asmlinkage void start_secondary(void);
 86 
 87 extern void calculate_cpu_foreign_map(void);
 88 
 89 /*
 90  * Generate IPI list text
 91  */
 92 extern void show_ipi_list(struct seq_file *p, int prec);
 93 
 94 static inline void arch_send_call_function_single_ipi(int cpu)
 95 {
 96         mp_ops.send_ipi_single(cpu, ACTION_CALL_FUNCTION);
 97 }
 98 
 99 static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
100 {
101         mp_ops.send_ipi_mask(mask, ACTION_CALL_FUNCTION);
102 }
103 
104 #ifdef CONFIG_HOTPLUG_CPU
105 static inline int __cpu_disable(void)
106 {
107         return loongson_cpu_disable();
108 }
109 
110 static inline void __cpu_die(unsigned int cpu)
111 {
112         loongson_cpu_die(cpu);
113 }
114 #endif
115 
116 #else /* !CONFIG_SMP */
117 #define cpu_logical_map(cpu)    0
118 #endif /* CONFIG_SMP */
119 
120 #endif /* __ASM_SMP_H */
121 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php