diff options
| author | Catalin Marinas <catalin.marinas@arm.com> | 2011-04-06 11:16:29 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-04-10 16:13:36 -0400 |
| commit | 2e82669acf03e5bf2080f5d3ef005168e67d8a51 (patch) | |
| tree | 996ff5ce7127725a0b8ddeeb74731d6bb7288cdc /arch | |
| parent | 974508262e94b567f9d5b7ba1eef9fc493561f63 (diff) | |
ARM: 6867/1: Introduce THREAD_NOTIFY_COPY for copy_thread() hooks
This patch adds THREAD_NOTIFY_COPY for calling registered handlers
during the copy_thread() function call. It also changes the VFP handler
to use a switch statement rather than if..else and ignore this event.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/arm/include/asm/thread_notify.h | 1 | ||||
| -rw-r--r-- | arch/arm/kernel/process.c | 2 | ||||
| -rw-r--r-- | arch/arm/vfp/vfpmodule.c | 22 |
3 files changed, 18 insertions, 7 deletions
diff --git a/arch/arm/include/asm/thread_notify.h b/arch/arm/include/asm/thread_notify.h index c4391ba20350..1dc980675894 100644 --- a/arch/arm/include/asm/thread_notify.h +++ b/arch/arm/include/asm/thread_notify.h | |||
| @@ -43,6 +43,7 @@ static inline void thread_notify(unsigned long rc, struct thread_info *thread) | |||
| 43 | #define THREAD_NOTIFY_FLUSH 0 | 43 | #define THREAD_NOTIFY_FLUSH 0 |
| 44 | #define THREAD_NOTIFY_EXIT 1 | 44 | #define THREAD_NOTIFY_EXIT 1 |
| 45 | #define THREAD_NOTIFY_SWITCH 2 | 45 | #define THREAD_NOTIFY_SWITCH 2 |
| 46 | #define THREAD_NOTIFY_COPY 3 | ||
| 46 | 47 | ||
| 47 | #endif | 48 | #endif |
| 48 | #endif | 49 | #endif |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 94bbedbed639..5e1e54197227 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
| @@ -372,6 +372,8 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, | |||
| 372 | if (clone_flags & CLONE_SETTLS) | 372 | if (clone_flags & CLONE_SETTLS) |
| 373 | thread->tp_value = regs->ARM_r3; | 373 | thread->tp_value = regs->ARM_r3; |
| 374 | 374 | ||
| 375 | thread_notify(THREAD_NOTIFY_COPY, thread); | ||
| 376 | |||
| 375 | return 0; | 377 | return 0; |
| 376 | } | 378 | } |
| 377 | 379 | ||
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index bbf3da012afd..1c88bbdfd34d 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
| @@ -104,12 +104,17 @@ static void vfp_thread_exit(struct thread_info *thread) | |||
| 104 | static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) | 104 | static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) |
| 105 | { | 105 | { |
| 106 | struct thread_info *thread = v; | 106 | struct thread_info *thread = v; |
| 107 | u32 fpexc; | ||
| 108 | #ifdef CONFIG_SMP | ||
| 109 | unsigned int cpu; | ||
| 110 | #endif | ||
| 107 | 111 | ||
| 108 | if (likely(cmd == THREAD_NOTIFY_SWITCH)) { | 112 | switch (cmd) { |
| 109 | u32 fpexc = fmrx(FPEXC); | 113 | case THREAD_NOTIFY_SWITCH: |
| 114 | fpexc = fmrx(FPEXC); | ||
| 110 | 115 | ||
| 111 | #ifdef CONFIG_SMP | 116 | #ifdef CONFIG_SMP |
| 112 | unsigned int cpu = thread->cpu; | 117 | cpu = thread->cpu; |
| 113 | 118 | ||
| 114 | /* | 119 | /* |
| 115 | * On SMP, if VFP is enabled, save the old state in | 120 | * On SMP, if VFP is enabled, save the old state in |
| @@ -134,13 +139,16 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) | |||
| 134 | * old state. | 139 | * old state. |
| 135 | */ | 140 | */ |
| 136 | fmxr(FPEXC, fpexc & ~FPEXC_EN); | 141 | fmxr(FPEXC, fpexc & ~FPEXC_EN); |
| 137 | return NOTIFY_DONE; | 142 | break; |
| 138 | } | ||
| 139 | 143 | ||
| 140 | if (cmd == THREAD_NOTIFY_FLUSH) | 144 | case THREAD_NOTIFY_FLUSH: |
| 141 | vfp_thread_flush(thread); | 145 | vfp_thread_flush(thread); |
| 142 | else | 146 | break; |
| 147 | |||
| 148 | case THREAD_NOTIFY_EXIT: | ||
| 143 | vfp_thread_exit(thread); | 149 | vfp_thread_exit(thread); |
| 150 | break; | ||
| 151 | } | ||
| 144 | 152 | ||
| 145 | return NOTIFY_DONE; | 153 | return NOTIFY_DONE; |
| 146 | } | 154 | } |
