linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: Russell King <rmk+kernel@armlinux.org.uk>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-oxnas@groups.io" <linux-oxnas@groups.io>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"linux-soc@vger.kernel.org" <linux-soc@vger.kernel.org>
Subject: Re: [PATCH 4/9] ARM: sti: remove pen_release and boot_lock
Date: Mon, 17 Dec 2018 08:22:45 +0000	[thread overview]
Message-ID: <b24d6a8c-a1ef-9274-0ef8-7b080b365122@st.com> (raw)
In-Reply-To: <E1gXVI9-000897-25@rmk-PC.armlinux.org.uk>

Hi Russel

On 12/13/18 7:00 PM, Russell King wrote:
> The pen_release implementation was created for Versatile platforms to
> work around boot loaders that did not differentiate between the
> various different secondary CPUs on this ARM development platform.
> This should not be true of modern platforms where we send IPIs to
> specific CPUs to wake them up.  Remove the pen_release stuff from
> SoCs that make use of the per-CPU IPI mechanism.
> 
> The boot_lock is something that was required for ARM development
> platforms to ensure that the delay calibration worked properly.  This
> is not necessary for modern platforms that have better bus bandwidth
> and do not need to calibrate the delay loop for secondary cores.
> Remove the boot_lock entirely.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
>  arch/arm/mach-sti/Makefile  |  2 +-
>  arch/arm/mach-sti/headsmp.S | 43 -------------------------------
>  arch/arm/mach-sti/platsmp.c | 62 ++-------------------------------------------
>  3 files changed, 3 insertions(+), 104 deletions(-)
>  delete mode 100644 arch/arm/mach-sti/headsmp.S
> 
> diff --git a/arch/arm/mach-sti/Makefile b/arch/arm/mach-sti/Makefile
> index acb330916333..f85ff059cfba 100644
> --- a/arch/arm/mach-sti/Makefile
> +++ b/arch/arm/mach-sti/Makefile
> @@ -1,2 +1,2 @@
> -obj-$(CONFIG_SMP)		+= platsmp.o headsmp.o
> +obj-$(CONFIG_SMP)		+= platsmp.o
>  obj-$(CONFIG_ARCH_STI) 		+= board-dt.o
> diff --git a/arch/arm/mach-sti/headsmp.S b/arch/arm/mach-sti/headsmp.S
> deleted file mode 100644
> index e0ad451700d5..000000000000
> --- a/arch/arm/mach-sti/headsmp.S
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -/*
> - *  arch/arm/mach-sti/headsmp.S
> - *
> - * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
> - *		http://www.st.com
> - *
> - * Cloned from linux/arch/arm/mach-vexpress/headsmp.S
> - *
> - *  Copyright (c) 2003 ARM Limited
> - *  All Rights Reserved
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - */
> -#include <linux/linkage.h>
> -#include <linux/init.h>
> -
> -/*
> - * ST specific entry point for secondary CPUs.  This provides
> - * a "holding pen" into which all secondary cores are held until we're
> - * ready for them to initialise.
> - */
> -ENTRY(sti_secondary_startup)
> -	mrc	p15, 0, r0, c0, c0, 5
> -	and	r0, r0, #15
> -	adr	r4, 1f
> -	ldmia	r4, {r5, r6}
> -	sub	r4, r4, r5
> -	add	r6, r6, r4
> -pen:	ldr	r7, [r6]
> -	cmp	r7, r0
> -	bne	pen
> -
> -	/*
> -	 * we've been released from the holding pen: secondary_stack
> -	 * should now contain the SVC stack for this core
> -	 */
> -	b	secondary_startup
> -ENDPROC(sti_secondary_startup)
> -
> -1:	.long	.
> -	.long	pen_release
> diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
> index 231f19e17436..21668501c9bb 100644
> --- a/arch/arm/mach-sti/platsmp.c
> +++ b/arch/arm/mach-sti/platsmp.c
> @@ -28,72 +28,15 @@
>  
>  #include "smp.h"
>  
> -static void write_pen_release(int val)
> -{
> -	pen_release = val;
> -	smp_wmb();
> -	sync_cache_w(&pen_release);
> -}
> -
> -static DEFINE_SPINLOCK(boot_lock);
> -
> -static void sti_secondary_init(unsigned int cpu)
> -{
> -	/*
> -	 * let the primary processor know we're out of the
> -	 * pen, then head off into the C entry point
> -	 */
> -	write_pen_release(-1);
> -
> -	/*
> -	 * Synchronise with the boot thread.
> -	 */
> -	spin_lock(&boot_lock);
> -	spin_unlock(&boot_lock);
> -}
> -
>  static int sti_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  {
> -	unsigned long timeout;
> -
> -	/*
> -	 * set synchronisation state between this boot processor
> -	 * and the secondary one
> -	 */
> -	spin_lock(&boot_lock);
> -
> -	/*
> -	 * The secondary processor is waiting to be released from
> -	 * the holding pen - release it, then wait for it to flag
> -	 * that it has been released by resetting pen_release.
> -	 *
> -	 * Note that "pen_release" is the hardware CPU ID, whereas
> -	 * "cpu" is Linux's internal ID.
> -	 */
> -	write_pen_release(cpu_logical_map(cpu));
> -
>  	/*
>  	 * Send the secondary CPU a soft interrupt, thereby causing
>  	 * it to jump to the secondary entrypoint.
>  	 */
>  	arch_send_wakeup_ipi_mask(cpumask_of(cpu));
>  
> -	timeout = jiffies + (1 * HZ);
> -	while (time_before(jiffies, timeout)) {
> -		smp_rmb();
> -		if (pen_release == -1)
> -			break;
> -
> -		udelay(10);
> -	}
> -
> -	/*
> -	 * now the secondary core is starting up let it run its
> -	 * calibrations, then wait for it to finish
> -	 */
> -	spin_unlock(&boot_lock);
> -
> -	return pen_release != -1 ? -ENOSYS : 0;
> +	return 0;
>  }
>  
>  static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
> @@ -103,7 +46,7 @@ static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
>  	u32 __iomem *cpu_strt_ptr;
>  	u32 release_phys;
>  	int cpu;
> -	unsigned long entry_pa = __pa_symbol(sti_secondary_startup);
> +	unsigned long entry_pa = __pa_symbol(secondary_startup);
>  
>  	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
>  
> @@ -158,6 +101,5 @@ static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
>  
>  const struct smp_operations sti_smp_ops __initconst = {
>  	.smp_prepare_cpus	= sti_smp_prepare_cpus,
> -	.smp_secondary_init	= sti_secondary_init,
>  	.smp_boot_secondary	= sti_boot_secondary,
>  };
> 

Even if this patch is breaking the secondary CPU's bringup, it can be
merged as explained in the commit message.

I will send an additionnal patch to restore the secondary CPU's bringup.

Thanks for this clean-up.

Patrice
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2018-12-17  8:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 17:59 [PATCH 0/9] Clean up ARM SMP/CPU hotplug implementations Russell King - ARM Linux
2018-12-13 18:00 ` [PATCH 1/9] ARM: omap2: remove unnecessary boot_lock Russell King
2018-12-13 18:00 ` [PATCH 2/9] ARM: qcom: " Russell King
2019-01-10 12:50   ` Linus Walleij
2019-01-10 20:56     ` Stephen Boyd
2019-01-10 21:47       ` Linus Walleij
2019-01-11 15:09     ` Russell King - ARM Linux
2019-01-13 22:46       ` Linus Walleij
2019-01-10 22:05   ` Stephen Boyd
2018-12-13 18:00 ` [PATCH 3/9] ARM: oxnas: remove CPU hotplug implementation Russell King
2018-12-20 14:03   ` Neil Armstrong
2018-12-13 18:00 ` [PATCH 4/9] ARM: sti: remove pen_release and boot_lock Russell King
2018-12-17  8:22   ` Patrice CHOTARD [this message]
2018-12-13 18:01 ` [PATCH 5/9] ARM: actions: remove boot_lock and pen_release Russell King
2018-12-13 18:01 ` [PATCH 6/9] ARM: vexpress/realview: consolidate immitation CPU hotplug Russell King
2018-12-13 18:01 ` [PATCH 7/9] ARM: versatile: convert boot_lock to raw Russell King
2018-12-13 18:01 ` [PATCH 8/9] ARM: versatile: rename and comment SMP implementation Russell King
2018-12-13 18:01 ` [PATCH 9/9] ARM: smp: remove arch-provided "pen_release" Russell King
2018-12-14  4:39   ` Viresh Kumar
2018-12-14 13:12     ` Russell King - ARM Linux
2018-12-17  6:16       ` Viresh Kumar
2018-12-20 10:10 ` [PATCH 0/9] Clean up ARM SMP/CPU hotplug implementations Russell King - ARM Linux
2018-12-20 10:23   ` Krzysztof Kozlowski
2018-12-20 11:05     ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b24d6a8c-a1ef-9274-0ef8-7b080b365122@st.com \
    --to=patrice.chotard@st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-oxnas@groups.io \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).