powerpc: Make flush_fp_to_thread() nop when CONFIG_PPC_FPU is disabled
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / powerpc / include / asm / switch_to.h
1 /*
2  * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
3  */
4 #ifndef _ASM_POWERPC_SWITCH_TO_H
5 #define _ASM_POWERPC_SWITCH_TO_H
6
7 struct thread_struct;
8 struct task_struct;
9 struct pt_regs;
10
11 extern struct task_struct *__switch_to(struct task_struct *,
12         struct task_struct *);
13 #define switch_to(prev, next, last)     ((last) = __switch_to((prev), (next)))
14
15 struct thread_struct;
16 extern struct task_struct *_switch(struct thread_struct *prev,
17                                    struct thread_struct *next);
18
19 extern void giveup_fpu(struct task_struct *);
20 extern void load_up_fpu(void);
21 extern void enable_kernel_fp(void);
22 extern void enable_kernel_altivec(void);
23 extern void load_up_altivec(struct task_struct *);
24 extern int emulate_altivec(struct pt_regs *);
25 extern void __giveup_vsx(struct task_struct *);
26 extern void giveup_vsx(struct task_struct *);
27 extern void enable_kernel_spe(void);
28 extern void giveup_spe(struct task_struct *);
29 extern void load_up_spe(struct task_struct *);
30
31 #ifndef CONFIG_SMP
32 extern void discard_lazy_cpu_state(void);
33 #else
34 static inline void discard_lazy_cpu_state(void)
35 {
36 }
37 #endif
38
39 #ifdef CONFIG_PPC_FPU
40 extern void flush_fp_to_thread(struct task_struct *);
41 #else
42 static inline void flush_fp_to_thread(struct task_struct *t) { }
43 #endif
44
45 #ifdef CONFIG_ALTIVEC
46 extern void flush_altivec_to_thread(struct task_struct *);
47 extern void giveup_altivec(struct task_struct *);
48 extern void giveup_altivec_notask(void);
49 #else
50 static inline void flush_altivec_to_thread(struct task_struct *t)
51 {
52 }
53 static inline void giveup_altivec(struct task_struct *t)
54 {
55 }
56 #endif
57
58 #ifdef CONFIG_VSX
59 extern void flush_vsx_to_thread(struct task_struct *);
60 #else
61 static inline void flush_vsx_to_thread(struct task_struct *t)
62 {
63 }
64 #endif
65
66 #ifdef CONFIG_SPE
67 extern void flush_spe_to_thread(struct task_struct *);
68 #else
69 static inline void flush_spe_to_thread(struct task_struct *t)
70 {
71 }
72 #endif
73
74 static inline void clear_task_ebb(struct task_struct *t)
75 {
76 #ifdef CONFIG_PPC_BOOK3S_64
77     /* EBB perf events are not inherited, so clear all EBB state. */
78     t->thread.bescr = 0;
79     t->thread.mmcr2 = 0;
80     t->thread.mmcr0 = 0;
81     t->thread.siar = 0;
82     t->thread.sdar = 0;
83     t->thread.sier = 0;
84     t->thread.used_ebb = 0;
85 #endif
86 }
87
88 #endif /* _ASM_POWERPC_SWITCH_TO_H */