Skip to contentSkip to conversation

ARM: shmobile: Check MD21 at SMP boot in case of APMU

PATCH New Magnus Damm 3 participants 5 messages Feb 17, 2014

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

PATCH 1/1 ARM: shmobile: Check MD21 at SMP boot in case of APMU

From: Magnus Damm <[email protected]>

On R-Car Gen2 SoCs such as r8a7790 and r8a7791 the hardware boot mode bit MD21 indicates if hardware debug mode is enabled or not.

In case hardware debug mode is enabled print a warning and refrain from booting secondary CPU cores. Without this patch Koelsch boards with SW8-4 set to OFF will hang at SMP boot.

---

Written against renesas-devel-v3.14-rc2-20140213

 arch/arm/mach-shmobile/platsmp-apmu.c |    7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-shmobile/platsmp-apmu.c +7 -0
@@ -17,6 +17,7 @@
 #include <asm/cp15.h>
 #include <asm/smp_plat.h>
 #include <mach/common.h>
+#include <mach/rcar-gen2.h>
 
 static struct {
 	void __iomem *iomem;
@@ -136,6 +137,12 @@ void __init shmobile_smp_apmu_prepare_cp
 
 int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
+	/* Refrain boot when hardware debug mode is enabled */
+	if (rcar_gen2_read_mode_pins() & BIT(21)) {
+		pr_warn("Unable to boot CPU%d when MD21 is set\n", cpu);
+		return -ENOTSUPP;
+	}
+
 	/* For this particular CPU register boot vector */
 	shmobile_smp_hook(cpu, virt_to_phys(shmobile_invalidate_start), 0);
 
#1 lore raw

PATCH 1/1 ARM: shmobile: Check MD21 at SMP boot in case of APMU

Quoted 8 lines · Magnus Damm

From: Magnus Damm <[email protected]>

On R-Car Gen2 SoCs such as r8a7790 and r8a7791 the hardware boot mode bit MD21 indicates if hardware debug mode is enabled or not.

In case hardware debug mode is enabled print a warning and refrain from booting secondary CPU cores. Without this patch Koelsch boards with SW8-4 set to OFF will hang at SMP boot.

Out of interest, is this the solution to your recent SMP troubles?

Quoted 33 lines

---

Written against renesas-devel-v3.14-rc2-20140213

 arch/arm/mach-shmobile/platsmp-apmu.c |    7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-shmobile/platsmp-apmu.c +7 -0
@@ -17,6 +17,7 @@
 #include <asm/cp15.h>
 #include <asm/smp_plat.h>
 #include <mach/common.h>
+#include <mach/rcar-gen2.h>
 
 static struct {
 	void __iomem *iomem;
@@ -136,6 +137,12 @@ void __init shmobile_smp_apmu_prepare_cp
 
 int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
+	/* Refrain boot when hardware debug mode is enabled */
+	if (rcar_gen2_read_mode_pins() & BIT(21)) {
+		pr_warn("Unable to boot CPU%d when MD21 is set\n", cpu);
+		return -ENOTSUPP;
+	}
+
 	/* For this particular CPU register boot vector */
 	shmobile_smp_hook(cpu, virt_to_phys(shmobile_invalidate_start), 0);
 
author maintainer
#2 lore raw

PATCH 1/1 ARM: shmobile: Check MD21 at SMP boot in case of APMU

Quoted 11 lines · Simon Horman
Quoted 8 lines · Magnus Damm

From: Magnus Damm <[email protected]>

On R-Car Gen2 SoCs such as r8a7790 and r8a7791 the hardware boot mode bit MD21 indicates if hardware debug mode is enabled or not.

In case hardware debug mode is enabled print a warning and refrain from booting secondary CPU cores. Without this patch Koelsch boards with SW8-4 set to OFF will hang at SMP boot.

Out of interest, is this the solution to your recent SMP troubles?

Yes, one of them. =)

/ magnus

#3 lore raw

PATCH 1/1 ARM: shmobile: Check MD21 at SMP boot in case of APMU

In reply to Magnus Damm
Quoted 8 lines · Magnus Damm

From: Magnus Damm <[email protected]>

On R-Car Gen2 SoCs such as r8a7790 and r8a7791 the hardware boot mode bit MD21 indicates if hardware debug mode is enabled or not.

In case hardware debug mode is enabled print a warning and refrain from booting secondary CPU cores. Without this patch Koelsch boards with SW8-4 set to OFF will hang at SMP boot.

Ah, mine was set to OFF.

Quoted 1 line

with one minor nit:

arch/arm/mach-shmobile/platsmp-apmu.c void __init shmobile_smp_apmu_prepare_cp · line 142

Quoted 5 lines

int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle) {

arch/arm/mach-shmobile/platsmp-apmu.c +3 -0
+       /* Refrain boot when hardware debug mode is enabled */
+       if (rcar_gen2_read_mode_pins() & BIT(21)) {
+               pr_warn("Unable to boot CPU%d when MD21 is set\n", cpu);

%u

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#4 lore raw

PATCH 1/1 ARM: shmobile: Check MD21 at SMP boot in case of APMU

Quoted 10 lines · Geert Uytterhoeven
Quoted 8 lines · Magnus Damm

From: Magnus Damm <[email protected]>

On R-Car Gen2 SoCs such as r8a7790 and r8a7791 the hardware boot mode bit MD21 indicates if hardware debug mode is enabled or not.

In case hardware debug mode is enabled print a warning and refrain from booting secondary CPU cores. Without this patch Koelsch boards with SW8-4 set to OFF will hang at SMP boot.

Quoted 5 lines

Ah, mine was set to OFF.

Quoted 1 line

Thanks!

Quoted 9 lines

with one minor nit:

arch/arm/mach-shmobile/platsmp-apmu.c void __init shmobile_smp_apmu_prepare_cp · line 142

Quoted 5 lines

int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle) {

arch/arm/mach-shmobile/platsmp-apmu.c +3 -0
+       /* Refrain boot when hardware debug mode is enabled */
+       if (rcar_gen2_read_mode_pins() & BIT(21)) {
+               pr_warn("Unable to boot CPU%d when MD21 is set\n", cpu);

%u

Good catch, will send a V2.

Cheers,

/ magnus