Skip to contentSkip to conversation

MIPS: cavium-octeon: remove checks for CONFIG_CAVIUM_GDB

PATCH Applied Paul Bolle 3 participants 6 messages May 20, 2014 – May 27, 2014 MIPS

lore
Share & tools
lore

Paul Bolle

author
#0 lore raw

PATCH 1/1 MIPS: cavium-octeon: remove checks for CONFIG_CAVIUM_GDB

Three checks for CONFIG_CAVIUM_GDB were added in v2.6.29. But the Kconfig symbol CAVIUM_GDB was never added to the tree. Remove these checks.

Also remove the last reference to octeon_get_boot_debug_flag(). There is no definition of that function anyway.

---
Untested.

A follow up might be to remove plat_smp_ops.cpus_done. All these callbacks are now (basically) nops.

 arch/mips/cavium-octeon/setup.c       | 11 -----------
 arch/mips/cavium-octeon/smp.c         | 17 -----------------
 arch/mips/include/asm/octeon/octeon.h |  1 -
 3 files changed, 29 deletions(-)
arch/mips/cavium-octeon/setup.c +0 -11
index 953ca85f84fa..989781fbae76 100644
@@ -729,17 +729,6 @@ void __init prom_init(void)
 	octeon_write_lcd("Linux");
 #endif
 
-#ifdef CONFIG_CAVIUM_GDB
-	/*
-	 * When debugging the linux kernel, force the cores to enter
-	 * the debug exception handler to break in.
-	 */
-	if (octeon_get_boot_debug_flag()) {
-		cvmx_write_csr(CVMX_CIU_DINT, 1 << cvmx_get_core_num());
-		cvmx_read_csr(CVMX_CIU_DINT);
-	}
-#endif
-
 	octeon_setup_delays();
 
 	/*
arch/mips/cavium-octeon/smp.c +0 -17
index 67a078ffc464..78e1abebc854 100644
@@ -218,15 +218,6 @@ void octeon_prepare_cpus(unsigned int max_cpus)
  */
 static void octeon_smp_finish(void)
 {
-#ifdef CONFIG_CAVIUM_GDB
-	unsigned long tmp;
-	/* Pulse MCD0 signal on Ctrl-C to stop all the cores. Also set the MCD0
-	   to be not masked by this core so we know the signal is received by
-	   someone */
-	asm volatile ("dmfc0 %0, $22\n"
-		      "ori   %0, %0, 0x9100\n" "dmtc0 %0, $22\n" : "=r" (tmp));
-#endif
-
 	octeon_user_io_init();
 
 	/* to generate the first CPU timer interrupt */
@@ -239,14 +230,6 @@ static void octeon_smp_finish(void)
  */
 static void octeon_cpus_done(void)
 {
-#ifdef CONFIG_CAVIUM_GDB
-	unsigned long tmp;
-	/* Pulse MCD0 signal on Ctrl-C to stop all the cores. Also set the MCD0
-	   to be not masked by this core so we know the signal is received by
-	   someone */
-	asm volatile ("dmfc0 %0, $22\n"
-		      "ori   %0, %0, 0x9100\n" "dmtc0 %0, $22\n" : "=r" (tmp));
-#endif
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
arch/mips/include/asm/octeon/octeon.h +0 -1
index f5d77b91537f..d781f9e66884 100644
@@ -211,7 +211,6 @@ union octeon_cvmemctl {
 
 extern void octeon_write_lcd(const char *s);
 extern void octeon_check_cpu_bist(void);
-extern int octeon_get_boot_debug_flag(void);
 extern int octeon_get_boot_uart(void);
 
 struct uart_port;
Signature · 1 line
1.9.0
Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Paul Bolle

Three checks for CONFIG_CAVIUM_GDB were added in v2.6.29. But the Kconfig symbol CAVIUM_GDB was never added to the tree. Remove these checks.

Also remove the last reference to octeon_get_boot_debug_flag(). There is no definition of that function anyway.

Hmm, yes, this was added with commit 5b3b16880f404ca54126210ca86141cceeafc0cf (MIPS: Add Cavium OCTEON processor support files to arch/mips/cavium-octeon.) and incomplete ever since (in mainline kernel).

Quoted 3 lines

---
Untested.

Removing this dead code shouldn't harm. I also did a quick test of a kernel with your patch with an octeon system -- as expected no issues observed. (So it's

Quoted 2 lines

A follow up might be to remove plat_smp_ops.cpus_done. All these callbacks are now (basically) nops.

I am not sure about completely removing cpus_done from plat_smp_ops. Maybe some platform will really make use of this in the future.

Thanks,
Andreas

Quoted 78 lines
 arch/mips/cavium-octeon/setup.c       | 11 -----------
 arch/mips/cavium-octeon/smp.c         | 17 -----------------
 arch/mips/include/asm/octeon/octeon.h |  1 -
 3 files changed, 29 deletions(-)
arch/mips/cavium-octeon/setup.c +0 -11
index 953ca85f84fa..989781fbae76 100644
@@ -729,17 +729,6 @@ void __init prom_init(void)
 	octeon_write_lcd("Linux");
 #endif
 
-#ifdef CONFIG_CAVIUM_GDB
-	/*
-	 * When debugging the linux kernel, force the cores to enter
-	 * the debug exception handler to break in.
-	 */
-	if (octeon_get_boot_debug_flag()) {
-		cvmx_write_csr(CVMX_CIU_DINT, 1 << cvmx_get_core_num());
-		cvmx_read_csr(CVMX_CIU_DINT);
-	}
-#endif
-
 	octeon_setup_delays();
 
 	/*
arch/mips/cavium-octeon/smp.c +0 -17
index 67a078ffc464..78e1abebc854 100644
@@ -218,15 +218,6 @@ void octeon_prepare_cpus(unsigned int max_cpus)
  */
 static void octeon_smp_finish(void)
 {
-#ifdef CONFIG_CAVIUM_GDB
-	unsigned long tmp;
-	/* Pulse MCD0 signal on Ctrl-C to stop all the cores. Also set the MCD0
-	   to be not masked by this core so we know the signal is received by
-	   someone */
-	asm volatile ("dmfc0 %0, $22\n"
-		      "ori   %0, %0, 0x9100\n" "dmtc0 %0, $22\n" : "=r" (tmp));
-#endif
-
 	octeon_user_io_init();
 
 	/* to generate the first CPU timer interrupt */
@@ -239,14 +230,6 @@ static void octeon_smp_finish(void)
  */
 static void octeon_cpus_done(void)
 {
-#ifdef CONFIG_CAVIUM_GDB
-	unsigned long tmp;
-	/* Pulse MCD0 signal on Ctrl-C to stop all the cores. Also set the MCD0
-	   to be not masked by this core so we know the signal is received by
-	   someone */
-	asm volatile ("dmfc0 %0, $22\n"
-		      "ori   %0, %0, 0x9100\n" "dmtc0 %0, $22\n" : "=r" (tmp));
-#endif
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
arch/mips/include/asm/octeon/octeon.h +0 -1
index f5d77b91537f..d781f9e66884 100644
@@ -211,7 +211,6 @@ union octeon_cvmemctl {
 
 extern void octeon_write_lcd(const char *s);
 extern void octeon_check_cpu_bist(void);
-extern int octeon_get_boot_debug_flag(void);
 extern int octeon_get_boot_uart(void);
 
 struct uart_port;
Signature · 1 line
1.9.0
author
#2 lore raw
Quoted 5 lines · Andreas Herrmann
Quoted 4 lines · Paul Bolle

Three checks for CONFIG_CAVIUM_GDB were added in v2.6.29. But the Kconfig symbol CAVIUM_GDB was never added to the tree. Remove these checks.

Quoted 7 lines
Quoted 2 lines

Also remove the last reference to octeon_get_boot_debug_flag(). There is no definition of that function anyway.

Hmm, yes, this was added with commit 5b3b16880f404ca54126210ca86141cceeafc0cf (MIPS: Add Cavium OCTEON processor support files to arch/mips/cavium-octeon.) and incomplete ever since (in mainline kernel).

I've decided not to mention the exact commits, and only mention releases, if problems are rather old. Ie, v2.6.29 should mean, to most observers, "a long time ago".

Quoted 8 lines
Quoted 3 lines

---
Untested.

Removing this dead code shouldn't harm. I also did a quick test of a kernel with your patch with an octeon system -- as expected no issues observed. (So it's

That's great, thanks!

Quoted 6 lines
Quoted 2 lines

A follow up might be to remove plat_smp_ops.cpus_done. All these callbacks are now (basically) nops.

I am not sure about completely removing cpus_done from plat_smp_ops. Maybe some platform will really make use of this in the future.

My view is that cpus_done should just be re-added if that happens.

Paul Bolle

Applied
#3 lore raw
In reply to Paul Bolle
Quoted 8 lines · Paul Bolle

Three checks for CONFIG_CAVIUM_GDB were added in v2.6.29. But the Kconfig symbol CAVIUM_GDB was never added to the tree. Remove these checks.

Also remove the last reference to octeon_get_boot_debug_flag(). There is no definition of that function anyway.

Queued for 3.16. Thanks Paul & Andreas!

Quoted 2 lines

A follow up might be to remove plat_smp_ops.cpus_done. All these callbacks are now (basically) nops.

I'll think about it. The hook is no useful if unused then again now and then ordering issues in SMP startup of secondary CPUs are showing up and it may be useful to solve those. Maybe something like

void __init smp_cpus_done(unsigned int max_cpus)
{
- mp_ops->cpus_done();
+ if (cpus_done)
+ mp_ops->cpus_done();
}

which would make a NULL cpus_done function pointer safe and allow empty definitions to be removed.

Ralf

#4 lore raw
Quoted 27 lines · Ralf Baechle
Quoted 8 lines · Paul Bolle

Three checks for CONFIG_CAVIUM_GDB were added in v2.6.29. But the Kconfig symbol CAVIUM_GDB was never added to the tree. Remove these checks.

Also remove the last reference to octeon_get_boot_debug_flag(). There is no definition of that function anyway.

Queued for 3.16. Thanks Paul & Andreas!

Quoted 2 lines

A follow up might be to remove plat_smp_ops.cpus_done. All these callbacks are now (basically) nops.

I'll think about it. The hook is no useful if unused then again now and then ordering issues in SMP startup of secondary CPUs are showing up and it may be useful to solve those. Maybe something like

void __init smp_cpus_done(unsigned int max_cpus)
{

(quoted diff) +2 -1
- 	mp_ops->cpus_done();
+ 	if (cpus_done)
+ 		mp_ops->cpus_done();

}

Quoted 2 lines

which would make a NULL cpus_done function pointer safe and allow empty definitions to be removed.

I'd prefer this solution over complete removal of the hook.

Andreas

#5 lore raw
Quoted 11 lines · Andreas Herrmann
Quoted 9 lines

void __init smp_cpus_done(unsigned int max_cpus)
{

(quoted diff) +2 -1
- 	mp_ops->cpus_done();
+ 	if (cpus_done)
+ 		mp_ops->cpus_done();

}

which would make a NULL cpus_done function pointer safe and allow empty definitions to be removed.

I'd prefer this solution over complete removal of the hook.

In the end that's what I just did.

Which leaves smp_cpus_done() empty. I think I'm going to put in a function to print a summary of CPUs booted but that's for another patch.

Ralf