Skip to content

Commit 2ef174b

Browse files
seehearfeelchenhuacai
authored andcommitted
LoongArch: Handle fp, lsx, lasx and lbt assembly symbols
Like the other relevant symbols, export some fp, lsx, lasx and lbt assembly symbols and put the function declarations in header files rather than source files. While at it, use "asmlinkage" for the other existing C prototypes of assembly functions and also do not use the "extern" keyword with function declarations according to the document coding-style.rst. Cc: stable@vger.kernel.org # 6.6+ Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent cc73cc6 commit 2ef174b

File tree

5 files changed

+40
-40
lines changed

5 files changed

+40
-40
lines changed

arch/loongarch/include/asm/fpu.h

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,29 @@
2222
struct sigcontext;
2323

2424
#define kernel_fpu_available() cpu_has_fpu
25-
extern void kernel_fpu_begin(void);
26-
extern void kernel_fpu_end(void);
27-
28-
extern void _init_fpu(unsigned int);
29-
extern void _save_fp(struct loongarch_fpu *);
30-
extern void _restore_fp(struct loongarch_fpu *);
31-
32-
extern void _save_lsx(struct loongarch_fpu *fpu);
33-
extern void _restore_lsx(struct loongarch_fpu *fpu);
34-
extern void _init_lsx_upper(void);
35-
extern void _restore_lsx_upper(struct loongarch_fpu *fpu);
36-
37-
extern void _save_lasx(struct loongarch_fpu *fpu);
38-
extern void _restore_lasx(struct loongarch_fpu *fpu);
39-
extern void _init_lasx_upper(void);
40-
extern void _restore_lasx_upper(struct loongarch_fpu *fpu);
25+
26+
void kernel_fpu_begin(void);
27+
void kernel_fpu_end(void);
28+
29+
asmlinkage void _init_fpu(unsigned int);
30+
asmlinkage void _save_fp(struct loongarch_fpu *);
31+
asmlinkage void _restore_fp(struct loongarch_fpu *);
32+
asmlinkage int _save_fp_context(void __user *fpregs, void __user *fcc, void __user *csr);
33+
asmlinkage int _restore_fp_context(void __user *fpregs, void __user *fcc, void __user *csr);
34+
35+
asmlinkage void _save_lsx(struct loongarch_fpu *fpu);
36+
asmlinkage void _restore_lsx(struct loongarch_fpu *fpu);
37+
asmlinkage void _init_lsx_upper(void);
38+
asmlinkage void _restore_lsx_upper(struct loongarch_fpu *fpu);
39+
asmlinkage int _save_lsx_context(void __user *fpregs, void __user *fcc, void __user *fcsr);
40+
asmlinkage int _restore_lsx_context(void __user *fpregs, void __user *fcc, void __user *fcsr);
41+
42+
asmlinkage void _save_lasx(struct loongarch_fpu *fpu);
43+
asmlinkage void _restore_lasx(struct loongarch_fpu *fpu);
44+
asmlinkage void _init_lasx_upper(void);
45+
asmlinkage void _restore_lasx_upper(struct loongarch_fpu *fpu);
46+
asmlinkage int _save_lasx_context(void __user *fpregs, void __user *fcc, void __user *fcsr);
47+
asmlinkage int _restore_lasx_context(void __user *fpregs, void __user *fcc, void __user *fcsr);
4148

4249
static inline void enable_lsx(void);
4350
static inline void disable_lsx(void);

arch/loongarch/include/asm/lbt.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
#include <asm/loongarch.h>
1313
#include <asm/processor.h>
1414

15-
extern void _init_lbt(void);
16-
extern void _save_lbt(struct loongarch_lbt *);
17-
extern void _restore_lbt(struct loongarch_lbt *);
15+
asmlinkage void _init_lbt(void);
16+
asmlinkage void _save_lbt(struct loongarch_lbt *);
17+
asmlinkage void _restore_lbt(struct loongarch_lbt *);
18+
asmlinkage int _save_lbt_context(void __user *regs, void __user *eflags);
19+
asmlinkage int _restore_lbt_context(void __user *regs, void __user *eflags);
20+
asmlinkage int _save_ftop_context(void __user *ftop);
21+
asmlinkage int _restore_ftop_context(void __user *ftop);
1822

1923
static inline int is_lbt_enabled(void)
2024
{

arch/loongarch/kernel/fpu.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ SYM_FUNC_START(_save_fp_context)
458458
li.w a0, 0 # success
459459
jr ra
460460
SYM_FUNC_END(_save_fp_context)
461+
EXPORT_SYMBOL_GPL(_save_fp_context)
461462

462463
/*
463464
* a0: fpregs
@@ -471,6 +472,7 @@ SYM_FUNC_START(_restore_fp_context)
471472
li.w a0, 0 # success
472473
jr ra
473474
SYM_FUNC_END(_restore_fp_context)
475+
EXPORT_SYMBOL_GPL(_restore_fp_context)
474476

475477
/*
476478
* a0: fpregs
@@ -484,6 +486,7 @@ SYM_FUNC_START(_save_lsx_context)
484486
li.w a0, 0 # success
485487
jr ra
486488
SYM_FUNC_END(_save_lsx_context)
489+
EXPORT_SYMBOL_GPL(_save_lsx_context)
487490

488491
/*
489492
* a0: fpregs
@@ -497,6 +500,7 @@ SYM_FUNC_START(_restore_lsx_context)
497500
li.w a0, 0 # success
498501
jr ra
499502
SYM_FUNC_END(_restore_lsx_context)
503+
EXPORT_SYMBOL_GPL(_restore_lsx_context)
500504

501505
/*
502506
* a0: fpregs
@@ -510,6 +514,7 @@ SYM_FUNC_START(_save_lasx_context)
510514
li.w a0, 0 # success
511515
jr ra
512516
SYM_FUNC_END(_save_lasx_context)
517+
EXPORT_SYMBOL_GPL(_save_lasx_context)
513518

514519
/*
515520
* a0: fpregs
@@ -523,6 +528,7 @@ SYM_FUNC_START(_restore_lasx_context)
523528
li.w a0, 0 # success
524529
jr ra
525530
SYM_FUNC_END(_restore_lasx_context)
531+
EXPORT_SYMBOL_GPL(_restore_lasx_context)
526532

527533
.L_fpu_fault:
528534
li.w a0, -EFAULT # failure

arch/loongarch/kernel/lbt.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ SYM_FUNC_START(_save_lbt_context)
9090
li.w a0, 0 # success
9191
jr ra
9292
SYM_FUNC_END(_save_lbt_context)
93+
EXPORT_SYMBOL_GPL(_save_lbt_context)
9394

9495
/*
9596
* a0: scr
@@ -110,6 +111,7 @@ SYM_FUNC_START(_restore_lbt_context)
110111
li.w a0, 0 # success
111112
jr ra
112113
SYM_FUNC_END(_restore_lbt_context)
114+
EXPORT_SYMBOL_GPL(_restore_lbt_context)
113115

114116
/*
115117
* a0: ftop
@@ -120,6 +122,7 @@ SYM_FUNC_START(_save_ftop_context)
120122
li.w a0, 0 # success
121123
jr ra
122124
SYM_FUNC_END(_save_ftop_context)
125+
EXPORT_SYMBOL_GPL(_save_ftop_context)
123126

124127
/*
125128
* a0: ftop
@@ -150,6 +153,7 @@ SYM_FUNC_START(_restore_ftop_context)
150153
li.w a0, 0 # success
151154
jr ra
152155
SYM_FUNC_END(_restore_ftop_context)
156+
EXPORT_SYMBOL_GPL(_restore_ftop_context)
153157

154158
.L_lbt_fault:
155159
li.w a0, -EFAULT # failure

arch/loongarch/kernel/signal.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,6 @@
5151
#define lock_lbt_owner() ({ preempt_disable(); pagefault_disable(); })
5252
#define unlock_lbt_owner() ({ pagefault_enable(); preempt_enable(); })
5353

54-
/* Assembly functions to move context to/from the FPU */
55-
extern asmlinkage int
56-
_save_fp_context(void __user *fpregs, void __user *fcc, void __user *csr);
57-
extern asmlinkage int
58-
_restore_fp_context(void __user *fpregs, void __user *fcc, void __user *csr);
59-
extern asmlinkage int
60-
_save_lsx_context(void __user *fpregs, void __user *fcc, void __user *fcsr);
61-
extern asmlinkage int
62-
_restore_lsx_context(void __user *fpregs, void __user *fcc, void __user *fcsr);
63-
extern asmlinkage int
64-
_save_lasx_context(void __user *fpregs, void __user *fcc, void __user *fcsr);
65-
extern asmlinkage int
66-
_restore_lasx_context(void __user *fpregs, void __user *fcc, void __user *fcsr);
67-
68-
#ifdef CONFIG_CPU_HAS_LBT
69-
extern asmlinkage int _save_lbt_context(void __user *regs, void __user *eflags);
70-
extern asmlinkage int _restore_lbt_context(void __user *regs, void __user *eflags);
71-
extern asmlinkage int _save_ftop_context(void __user *ftop);
72-
extern asmlinkage int _restore_ftop_context(void __user *ftop);
73-
#endif
74-
7554
struct rt_sigframe {
7655
struct siginfo rs_info;
7756
struct ucontext rs_uctx;

0 commit comments

Comments
 (0)