[PATCH] xmon dabr support for LPAR

Jake Moilanen moilanen at austin.ibm.com
Thu Jan 6 01:52:19 EST 2005


Here's xmon DABR support for LPAR.  

I added SETCTRLREG which is a wrapper for setting a controlled register
that will choose to use either an hcall or mtspr depending on what mode
the machine is in.

Thanks,
Jake

Signed-off-by: Jake Moilanen <moilanen at austin.ibm.com>

---


diff -puN arch/ppc64/xmon/xmon.c~xmon-lpar-dabr arch/ppc64/xmon/xmon.c
--- linux-2.6-bk/arch/ppc64/xmon/xmon.c~xmon-lpar-dabr	Wed Jan  5 08:17:07 2005
+++ linux-2.6-bk-moilanen/arch/ppc64/xmon/xmon.c	Wed Jan  5 08:23:50 2005
@@ -712,7 +712,7 @@ static void insert_bpts(void)
 static void insert_cpu_bpts(void)
 {
 	if (dabr.enabled)
-		set_dabr(dabr.address | (dabr.enabled & 7));
+		set_controlled_dabr(dabr.address | (dabr.enabled & 7));
 	if (iabr && (cur_cpu_spec->cpu_features & CPU_FTR_IABR))
 		set_iabr(iabr->address
 			 | (iabr->enabled & (BP_IABR|BP_IABR_TE)));
@@ -740,7 +740,7 @@ static void remove_bpts(void)
 
 static void remove_cpu_bpts(void)
 {
-	set_dabr(0);
+	set_controlled_dabr(0);
 	if ((cur_cpu_spec->cpu_features & CPU_FTR_IABR))
 		set_iabr(0);
 }
@@ -1051,7 +1051,7 @@ static char *breakpoint_help_string = 
     "bc               clear all breakpoints\n"
     "bc <n/addr>      clear breakpoint number n or at addr\n"
     "bi <addr> [cnt]  set hardware instr breakpoint\n"
-    "bd <addr> [cnt]  set hardware data breakpoint (broken?)\n"
+    "bd <addr> [cnt]  set hardware data breakpoint\n"
     "";
 
 static void
diff -puN arch/ppc64/xmon/privinst.h~xmon-lpar-dabr arch/ppc64/xmon/privinst.h
--- linux-2.6-bk/arch/ppc64/xmon/privinst.h~xmon-lpar-dabr	Wed Jan  5 08:17:22 2005
+++ linux-2.6-bk-moilanen/arch/ppc64/xmon/privinst.h	Wed Jan  5 08:20:02 2005
@@ -25,6 +25,16 @@ GETREG(cr)
     static inline void set_ ## name (long val) \
 	{ asm volatile ("mtspr " #n ",%0" : : "r" (val)); }
 
+/*
+ * If a register is a controlled resource protected when there
+ * is a hypervisor, then use this command.
+ */
+#define SETCTRLREG(name)	\
+	extern inline void set_lpar_ ##name(long val); \
+	extern inline void set_controlled_ ## name (long val) \
+	{ (systemcfg->platform == PLATFORM_PSERIES_LPAR) ? \
+	  set_lpar_ ##name (val) : set_ ##name (val); }
+
 GSETSPR(0, mq)
 GSETSPR(1, xer)
 GSETSPR(4, rtcu)
@@ -48,6 +58,8 @@ GSETSPR(1009, hid1)
 GSETSPR(1010, iabr)
 GSETSPR(1013, dabr)
 GSETSPR(1023, pir)
+
+SETCTRLREG(dabr)
 
 static inline void store_inst(void *p)
 {
diff -puN arch/ppc64/xmon/start.c~xmon-lpar-dabr arch/ppc64/xmon/start.c
--- linux-2.6-bk/arch/ppc64/xmon/start.c~xmon-lpar-dabr	Wed Jan  5 08:17:49 2005
+++ linux-2.6-bk-moilanen/arch/ppc64/xmon/start.c	Wed Jan  5 08:20:49 2005
@@ -46,6 +46,16 @@ static int __init setup_xmon_sysrq(void)
 __initcall(setup_xmon_sysrq);
 #endif /* CONFIG_MAGIC_SYSRQ */
 
+inline void set_lpar_dabr(long val)
+{
+	int rc;
+	
+	rc = plpar_hcall_norets(H_SET_DABR, val);
+
+	if (rc != H_Success)
+		xmon_printf("Warning: setting DABR failed. rc = %d\n", rc);
+}
+
 int
 xmon_write(void *handle, void *ptr, int nb)
 {

_



More information about the Linuxppc64-dev mailing list