Skip to contentSkip to conversation

powerpc/xive: Remove incorrect debug code

PATCH Applied Benjamin Herrenschmidt 3 participants 9 messages Jan 12, 2018 – Jan 17, 2018 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 powerpc/xive: Remove incorrect debug code

WORD2 if the TIMA isn't byte accessible and
isn't that useful to know about, take out the
pr_devel statement.

---
 arch/powerpc/sysdev/xive/common.c | 5 -----
 1 file changed, 5 deletions(-)
arch/powerpc/sysdev/xive/common.c +0 -5
index a3b8d7d1316e..838ebdbfe4c5 100644
@@ -1269,11 +1269,6 @@ static void xive_setup_cpu(void)
 {
 	struct xive_cpu *xc = __this_cpu_read(xive_cpu);
 
-	/* Debug: Dump the TM state */
-	pr_devel("CPU %d [HW 0x%02x] VT=%02x\n",
-	    smp_processor_id(), hard_smp_processor_id(),
-	    in_8(xive_tima + xive_tima_offset + TM_WORD2));
-
 	/* The backend might have additional things to do */
 	if (xive_ops->setup_cpu)
 		xive_ops->setup_cpu(smp_processor_id(), xc);
Signature · 1 line
2.14.3
#6 lore raw

PATCH 5/5 powerpc: Use the TRAP macro whenever comparing a trap number

Trap numbers can have extra bits at the bottom that need to be filtered out. There are a few cases where we don't do that.

It's possible that we got lucky but better safe than sorry.

---
 arch/powerpc/kernel/process.c | 2 +-
 arch/powerpc/kernel/traps.c   | 2 +-
 arch/powerpc/mm/fault.c       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/process.c +1 -1
index 72be0c32e902..397d6e64e3df 100644
@@ -1409,7 +1409,7 @@ void show_regs(struct pt_regs * regs)
 	print_msr_bits(regs->msr);
 	pr_cont("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
 	trap = TRAP(regs);
-	if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
+	if ((TRAP(regs) != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
 		pr_cont("CFAR: "REG" ", regs->orig_gpr3);
 	if (trap == 0x200 || trap == 0x300 || trap == 0x600)
 #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
arch/powerpc/kernel/traps.c +1 -1
index f3eb61be0d30..d61989be28e1 100644
@@ -1564,7 +1564,7 @@ void facility_unavailable_exception(struct pt_regs *regs)
 	u8 status;
 	bool hv;
 
-	hv = (regs->trap == 0xf80);
+	hv = (TRAP(regs) == 0xf80);
 	if (hv)
 		value = mfspr(SPRN_HFSCR);
 	else
arch/powerpc/mm/fault.c +1 -1
index 6e1e39035380..7b15fe2ac986 100644
@@ -576,7 +576,7 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
 
 	/* kernel has accessed a bad area */
 
-	switch (regs->trap) {
+	switch (TRAP(regs)) {
 	case 0x300:
 	case 0x380:
 		printk(KERN_ALERT "Unable to handle kernel paging request for "
Signature · 1 line
2.14.3
#1 lore raw

PATCH 2/5 powerpc: Remove DEBUG define in 64-bit early setup code

In reply to Benjamin Herrenschmidt

This statement causes some not very useful messages to always be printed on the serial port at boot, even on quiet boots.

---
 arch/powerpc/kernel/setup_64.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/kernel/setup_64.c +0 -2
index 8956a9856604..d3124c302146 100644
@@ -10,8 +10,6 @@
  *      2 of the License, or (at your option) any later version.
  */
 
-#define DEBUG
-
 #include <linux/export.h>
 #include <linux/string.h>
 #include <linux/sched.h>
Signature · 1 line
2.14.3
#4 lore raw

PATCH 4/5 powerpc: Remove useless EXC_COMMON_HV

In reply to Benjamin Herrenschmidt

The only difference between EXC_COMMON_HV and EXC_COMMON is that the former adds "2" to the trap number which is supposed to represent the fact that this is an "HV" interrupt which uses HSRR0/1.

However KVM is the only one who cares and it has its own separate macros.

In fact, we only have one user of EXC_COMMON_HV and it's for an unknown interrupt case. All the other ones already using EXC_COMMON.

---
 arch/powerpc/include/asm/head-64.h   | 7 +------
 arch/powerpc/kernel/exceptions-64s.S | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/head-64.h +1 -6
index fdcff76e9a25..0a663dfc28b5 100644
@@ -178,7 +178,7 @@ end_##sname:
  * TRAMP_REAL_*   - real, unrelocated helpers (virt can call these)
  * TRAMP_VIRT_*   - virt, unreloc helpers (in practice, real can use)
  * TRAMP_KVM      - KVM handlers that get put into real, unrelocated
- * EXC_COMMON_*   - virt, relocated common handlers
+ * EXC_COMMON     - virt, relocated common handlers
  *
  * The EXC handlers are given a name, and branch to name_common, or the
  * appropriate KVM or masking function. Vector handler verieties are as
@@ -211,7 +211,6 @@ end_##sname:
  * EXC_COMMON_BEGIN/END - used to open-code the handler
  * EXC_COMMON
  * EXC_COMMON_ASYNC
- * EXC_COMMON_HV
  *
  * TRAMP_REAL and TRAMP_VIRT can be used with BEGIN/END. KVM
  * and OOL handlers are implemented as types of TRAMP and TRAMP_VIRT handlers.
@@ -413,10 +412,6 @@ end_##sname:
 	EXC_COMMON_BEGIN(name);						\
 	STD_EXCEPTION_COMMON_ASYNC(realvec, name, hdlr);		\
 
-#define EXC_COMMON_HV(name, realvec, hdlr)				\
-	EXC_COMMON_BEGIN(name);						\
-	STD_EXCEPTION_COMMON(realvec + 0x2, name, hdlr);		\
-
 #endif /* __ASSEMBLY__ */
 
 #endif	/* _ASM_POWERPC_HEAD_64_H */
arch/powerpc/kernel/exceptions-64s.S +1 -1
index e441b469dc8f..175891c6909c 100644
@@ -1318,7 +1318,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
 	b	.
 #endif
 
-EXC_COMMON_HV(denorm_common, 0x1500, unknown_exception)
+EXC_COMMON(denorm_common, 0x1500, unknown_exception)
 
 
 #ifdef CONFIG_CBE_RAS
Signature · 1 line
2.14.3
#2 lore raw

PATCH 3/5 powerpc: Reduce log level of "OPAL detected !" message

In reply to Benjamin Herrenschmidt

This message isn't terribly useful.

---
 arch/powerpc/platforms/powernv/opal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/opal.c +1 -1
index 041ddbd1fc57..2479e3396ed8 100644
@@ -127,7 +127,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
 
 	if (of_flat_dt_is_compatible(node, "ibm,opal-v3")) {
 		powerpc_firmware_features |= FW_FEATURE_OPAL;
-		pr_info("OPAL detected !\n");
+		pr_debug("OPAL detected !\n");
 	} else {
 		panic("OPAL != V3 detected, no longer supported.\n");
 	}
Signature · 1 line
2.14.3
Acked-by on v1 3/5
#3 lore raw

Re: [PATCH 3/5] powerpc: Reduce log level of "OPAL detected !" message

Quoted 3 lines · Benjamin Herrenschmidt

This message isn't terribly useful.

arch/powerpc/platforms/powernv/opal.c int __init early_init_dt_scan_opal(unsigned long node, · line 130

Quoted 8 lines
arch/powerpc/platforms/powernv/opal.c +1 -1
@@ -127,7 +127,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
 
 	if (of_flat_dt_is_compatible(node, "ibm,opal-v3")) {
 		powerpc_firmware_features |= FW_FEATURE_OPAL;
-		pr_info("OPAL detected !\n");
+		pr_debug("OPAL detected !\n");

I've been meaning to add in a thing to grab the version from the device tree and print that too.

Signature · 2 lines
Stewart Smith
OPAL Architect, IBM.
#5 lore raw

Re: [4/5] powerpc: Remove useless EXC_COMMON_HV

In reply to Benjamin Herrenschmidt
Quoted 10 lines · Benjamin Herrenschmidt

The only difference between EXC_COMMON_HV and EXC_COMMON is that the former adds "2" to the trap number which is supposed to represent the fact that this is an "HV" interrupt which uses HSRR0/1.

However KVM is the only one who cares and it has its own separate macros.

In fact, we only have one user of EXC_COMMON_HV and it's for an unknown interrupt case. All the other ones already using EXC_COMMON.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/872e2ae4bdd4c244f7617ffc08c394

cheers

#7 lore raw

Re: [5/5] powerpc: Use the TRAP macro whenever comparing a trap number

In reply to Benjamin Herrenschmidt
Quoted 6 lines · Benjamin Herrenschmidt

Trap numbers can have extra bits at the bottom that need to be filtered out. There are a few cases where we don't do that.

It's possible that we got lucky but better safe than sorry.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/2271db20e4b362405bacc0e4095df4

cheers