David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 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 *); |
Scott Wood | 8fae845 | 2011-12-20 15:34:45 +0000 | [diff] [blame] | 20 | extern void load_up_fpu(void); |
David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 21 | extern void enable_kernel_fp(void); |
David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 22 | extern void enable_kernel_altivec(void); |
David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 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 | |
Kevin Hao | 037f0ee | 2013-07-14 17:02:05 +0800 | [diff] [blame^] | 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 | |
David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 45 | #ifdef CONFIG_ALTIVEC |
| 46 | extern void flush_altivec_to_thread(struct task_struct *); |
Anton Blanchard | 8cd3c23 | 2012-04-15 20:54:59 +0000 | [diff] [blame] | 47 | extern void giveup_altivec(struct task_struct *); |
Anton Blanchard | 3500087 | 2012-04-15 20:56:45 +0000 | [diff] [blame] | 48 | extern void giveup_altivec_notask(void); |
David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 49 | #else |
| 50 | static inline void flush_altivec_to_thread(struct task_struct *t) |
| 51 | { |
| 52 | } |
Anton Blanchard | 8cd3c23 | 2012-04-15 20:54:59 +0000 | [diff] [blame] | 53 | static inline void giveup_altivec(struct task_struct *t) |
| 54 | { |
| 55 | } |
David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 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 | |
Michael Ellerman | 330a1eb | 2013-06-28 18:15:16 +1000 | [diff] [blame] | 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 | |
David Howells | ae3a197 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 88 | #endif /* _ASM_POWERPC_SWITCH_TO_H */ |