LoongArch: Add atomic/locking headers
[platform/kernel/linux-starfive.git] / arch / loongarch / include / asm / percpu.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4  */
5 #ifndef __ASM_PERCPU_H
6 #define __ASM_PERCPU_H
7
8 /* Use r21 for fast access */
9 register unsigned long __my_cpu_offset __asm__("$r21");
10
11 static inline void set_my_cpu_offset(unsigned long off)
12 {
13         __my_cpu_offset = off;
14         csr_write64(off, PERCPU_BASE_KS);
15 }
16 #define __my_cpu_offset __my_cpu_offset
17
18 #include <asm-generic/percpu.h>
19
20 #endif /* __ASM_PERCPU_H */