aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorK.Prasad <prasad@linux.vnet.ibm.com>2009-06-01 14:14:26 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-06-02 16:46:59 -0400
commit1e3500666f7c5daaadadb8431a2927cdbbdb7dd4 (patch)
treeb825e40b508818673ccbab079351d9140bbd48f7
parent08d68323d1f0c34452e614263b212ca556dae47f (diff)
hw-breakpoints: use wrapper routines around debug registers in processor related functions
This patch enables the use of wrapper routines to access the debug/breakpoint registers on cpu management. The hardcoded debug registers save and restore operations for threads breakpoints are replaced by wrappers. And now that we handle the kernel breakpoints too, we also need to handle them on cpu hotplug operations. [ Impact: adapt new hardware breakpoint api to cpu hotplug ] Original-patch-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com> Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
-rw-r--r--arch/x86/kernel/smpboot.c3
-rw-r--r--arch/x86/power/cpu_32.c13
-rw-r--r--arch/x86/power/cpu_64.c12
3 files changed, 9 insertions, 19 deletions
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 58d24ef917d8..2b2652d205c0 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -63,6 +63,7 @@
63#include <asm/apic.h> 63#include <asm/apic.h>
64#include <asm/setup.h> 64#include <asm/setup.h>
65#include <asm/uv/uv.h> 65#include <asm/uv/uv.h>
66#include <asm/debugreg.h>
66#include <linux/mc146818rtc.h> 67#include <linux/mc146818rtc.h>
67 68
68#include <asm/smpboot_hooks.h> 69#include <asm/smpboot_hooks.h>
@@ -326,6 +327,7 @@ notrace static void __cpuinit start_secondary(void *unused)
326 setup_secondary_clock(); 327 setup_secondary_clock();
327 328
328 wmb(); 329 wmb();
330 load_debug_registers();
329 cpu_idle(); 331 cpu_idle();
330} 332}
331 333
@@ -1250,6 +1252,7 @@ void cpu_disable_common(void)
1250 remove_cpu_from_maps(cpu); 1252 remove_cpu_from_maps(cpu);
1251 unlock_vector_lock(); 1253 unlock_vector_lock();
1252 fixup_irqs(); 1254 fixup_irqs();
1255 hw_breakpoint_disable();
1253} 1256}
1254 1257
1255int native_cpu_disable(void) 1258int native_cpu_disable(void)
diff --git a/arch/x86/power/cpu_32.c b/arch/x86/power/cpu_32.c
index 519913948003..2bc3b016de90 100644
--- a/arch/x86/power/cpu_32.c
+++ b/arch/x86/power/cpu_32.c
@@ -13,6 +13,7 @@
13#include <asm/mce.h> 13#include <asm/mce.h>
14#include <asm/xcr.h> 14#include <asm/xcr.h>
15#include <asm/suspend.h> 15#include <asm/suspend.h>
16#include <asm/debugreg.h>
16 17
17static struct saved_context saved_context; 18static struct saved_context saved_context;
18 19
@@ -48,6 +49,7 @@ static void __save_processor_state(struct saved_context *ctxt)
48 ctxt->cr2 = read_cr2(); 49 ctxt->cr2 = read_cr2();
49 ctxt->cr3 = read_cr3(); 50 ctxt->cr3 = read_cr3();
50 ctxt->cr4 = read_cr4_safe(); 51 ctxt->cr4 = read_cr4_safe();
52 hw_breakpoint_disable();
51} 53}
52 54
53/* Needed by apm.c */ 55/* Needed by apm.c */
@@ -83,16 +85,7 @@ static void fix_processor_context(void)
83 /* 85 /*
84 * Now maybe reload the debug registers 86 * Now maybe reload the debug registers
85 */ 87 */
86 if (current->thread.debugreg7) { 88 load_debug_registers();
87 set_debugreg(current->thread.debugreg[0], 0);
88 set_debugreg(current->thread.debugreg[1], 1);
89 set_debugreg(current->thread.debugreg[2], 2);
90 set_debugreg(current->thread.debugreg[3], 3);
91 /* no 4 and 5 */
92 set_debugreg(current->thread.debugreg6, 6);
93 set_debugreg(current->thread.debugreg7, 7);
94 }
95
96} 89}
97 90
98static void __restore_processor_state(struct saved_context *ctxt) 91static void __restore_processor_state(struct saved_context *ctxt)
diff --git a/arch/x86/power/cpu_64.c b/arch/x86/power/cpu_64.c
index 1e3bdcc959ff..46866a13a93a 100644
--- a/arch/x86/power/cpu_64.c
+++ b/arch/x86/power/cpu_64.c
@@ -16,6 +16,7 @@
16#include <asm/mtrr.h> 16#include <asm/mtrr.h>
17#include <asm/xcr.h> 17#include <asm/xcr.h>
18#include <asm/suspend.h> 18#include <asm/suspend.h>
19#include <asm/debugreg.h>
19 20
20static void fix_processor_context(void); 21static void fix_processor_context(void);
21 22
@@ -71,6 +72,7 @@ static void __save_processor_state(struct saved_context *ctxt)
71 ctxt->cr3 = read_cr3(); 72 ctxt->cr3 = read_cr3();
72 ctxt->cr4 = read_cr4(); 73 ctxt->cr4 = read_cr4();
73 ctxt->cr8 = read_cr8(); 74 ctxt->cr8 = read_cr8();
75 hw_breakpoint_disable();
74} 76}
75 77
76void save_processor_state(void) 78void save_processor_state(void)
@@ -162,13 +164,5 @@ static void fix_processor_context(void)
162 /* 164 /*
163 * Now maybe reload the debug registers 165 * Now maybe reload the debug registers
164 */ 166 */
165 if (current->thread.debugreg7){ 167 load_debug_registers();
166 set_debugreg(current->thread.debugreg[0], 0);
167 set_debugreg(current->thread.debugreg[1], 1);
168 set_debugreg(current->thread.debugreg[2], 2);
169 set_debugreg(current->thread.debugreg[3], 3);
170 /* no 4 and 5 */
171 loaddebug(&current->thread, 6);
172 loaddebug(&current->thread, 7);
173 }
174} 168}