Skip to contentSkip to conversation

ARM: bcm2836: Send event when onlining other cores

PATCH New Phil Elwell 4 participants 6 messages Aug 8, 2017 – Aug 15, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ARM: bcm2836: Send event when onlining other cores

This two-line patch adds the "sev" instruction required to wake the secondary cores, should they be sleeping in a "wfe" instruction. It applies on top of Eric's bcm2835-soc-smp-cleanup branch[1], after Stefan's patchset moving the SMP startup code out of the irqchip driver.

[1] - https://github.com/anholt/linux/commits/bcm2835-soc-smp-cleanup

Phil Elwell (1):
ARM: bcm2836: Send event when onlining other cores

 arch/arm/mach-bcm/platsmp.c | 3 +++
 1 file changed, 3 insertions(+)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 ARM: bcm2836: Send event when onlining other cores

Secondary cores should enter a low-power idle state when waiting to be started. The "wfe" instruction causes a core to wait until an event or interrupt arrives before continuing to the next instruction, and the "sev" instruction sends a wakeup event to the other cores.

Add an "sev" (and a memory barrier) to bcm2836_boot_secondary, the function that wakes the waiting cores during booting. This is required if the secondary cores are sitting in "wfe", and harmless if not.

---
 arch/arm/mach-bcm/platsmp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-bcm/platsmp.c +3 -0
index 3fa1a99..7811160 100644
@@ -312,6 +312,9 @@ static int bcm2836_boot_secondary(unsigned int cpu, struct task_struct *idle)
 	writel(virt_to_phys(secondary_startup),
 	       intc_base + LOCAL_MAILBOX3_SET0 + 16 * cpu);
 
+	dsb(sy);
+	sev();
+
 	iounmap(intc_base);
 
 	return 0;
Signature · 1 line
1.9.1
#2 lore raw
Quoted 8 lines · Phil Elwell

Secondary cores should enter a low-power idle state when waiting to be started. The "wfe" instruction causes a core to wait until an event or interrupt arrives before continuing to the next instruction, and the "sev" instruction sends a wakeup event to the other cores.

Add an "sev" (and a memory barrier) to bcm2836_boot_secondary, the function that wakes the waiting cores during booting. This is required if the secondary cores are sitting in "wfe", and harmless if not.

Eric, should I just pick this up for the upcoming ARM SoC pull requests that I am preparing, or do you have more changes aside from the two tags I already merged?

Thanks!

Quoted 21 lines
---
 arch/arm/mach-bcm/platsmp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-bcm/platsmp.c +3 -0
index 3fa1a99..7811160 100644
@@ -312,6 +312,9 @@ static int bcm2836_boot_secondary(unsigned int cpu, struct task_struct *idle)
 	writel(virt_to_phys(secondary_startup),
 	       intc_base + LOCAL_MAILBOX3_SET0 + 16 * cpu);
 
+	dsb(sy);
+	sev();
+
 	iounmap(intc_base);
 
 	return 0;
Signature · 1 line
Florian
#3 lore raw

Hi Florian,

Quoted 11 lines

Florian Fainelli <[email protected]> hat am 14. August 2017 um 18:25 geschrieben:

Quoted 5 lines · Phil Elwell

Secondary cores should enter a low-power idle state when waiting to be started. The "wfe" instruction causes a core to wait until an event or interrupt arrives before continuing to the next instruction, and the "sev" instruction sends a wakeup event to the other cores.

Quoted 7 lines
Quoted 3 lines

Add an "sev" (and a memory barrier) to bcm2836_boot_secondary, the function that wakes the waiting cores during booting. This is required if the secondary cores are sitting in "wfe", and harmless if not.

Eric, should I just pick this up for the upcoming ARM SoC pull requests that I am preparing, or do you have more changes aside from the two tags I already merged?

this patch depends on series "ARM: bcm2836: Move SMP startup code to arch/arm".

I didn't had the time to test Phil's patch in all relevant cases. But i could at least prepare a branch with my changes with the acks.

Stefan

Quoted 27 lines

Thanks!

Quoted 21 lines
---
 arch/arm/mach-bcm/platsmp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-bcm/platsmp.c +3 -0
index 3fa1a99..7811160 100644
@@ -312,6 +312,9 @@ static int bcm2836_boot_secondary(unsigned int cpu, struct task_struct *idle)
 	writel(virt_to_phys(secondary_startup),
 	       intc_base + LOCAL_MAILBOX3_SET0 + 16 * cpu);
 
+	dsb(sy);
+	sev();
+
 	iounmap(intc_base);
 
 	return 0;
Signature · 1 line
Florian
#4 lore raw

Hi Eric,

Quoted 20 lines

Stefan Wahren <[email protected]> hat am 14. August 2017 um 19:11 geschrieben:

Hi Florian,

Quoted 15 lines

Florian Fainelli <[email protected]> hat am 14. August 2017 um 18:25 geschrieben:

Quoted 8 lines · Phil Elwell

Secondary cores should enter a low-power idle state when waiting to be started. The "wfe" instruction causes a core to wait until an event or interrupt arrives before continuing to the next instruction, and the "sev" instruction sends a wakeup event to the other cores.

Add an "sev" (and a memory barrier) to bcm2836_boot_secondary, the function that wakes the waiting cores during booting. This is required if the secondary cores are sitting in "wfe", and harmless if not.

Quoted 7 lines
Quoted 3 lines

Eric, should I just pick this up for the upcoming ARM SoC pull requests that I am preparing, or do you have more changes aside from the two tags I already merged?

this patch depends on series "ARM: bcm2836: Move SMP startup code to arch/arm".

I didn't had the time to test Phil's patch in all relevant cases. But i could at least prepare a branch with my changes with the acks.

i prepared the branches bcm2835-dt-next-v2 and bcm2835-soc-next.

Stefan

#5 lore raw
Quoted 26 lines · Stefan Wahren

Hi Eric,

Quoted 24 lines

Stefan Wahren <[email protected]> hat am 14. August 2017 um 19:11 geschrieben:

Hi Florian,

Quoted 18 lines

Florian Fainelli <[email protected]> hat am 14. August 2017 um 18:25 geschrieben:

Quoted 8 lines · Phil Elwell

Secondary cores should enter a low-power idle state when waiting to be started. The "wfe" instruction causes a core to wait until an event or interrupt arrives before continuing to the next instruction, and the "sev" instruction sends a wakeup event to the other cores.

Add an "sev" (and a memory barrier) to bcm2836_boot_secondary, the function that wakes the waiting cores during booting. This is required if the secondary cores are sitting in "wfe", and harmless if not.

Eric, should I just pick this up for the upcoming ARM SoC pull requests that I am preparing, or do you have more changes aside from the two tags I already merged?

Quoted 5 lines
Quoted 3 lines

this patch depends on series "ARM: bcm2836: Move SMP startup code to arch/arm".

I didn't had the time to test Phil's patch in all relevant cases. But i could at least prepare a branch with my changes with the acks.

i prepared the branches bcm2835-dt-next-v2 and bcm2835-soc-next.

bcm2835-soc-next on its own breaks boot for me on the Pi2, so I had to
merge in the DT branch first. I've rebased to do that, pulled in this
patch (and the clk one), and sent PRs for -dt and -soc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170815/79544c84/attachment.sig>