From patchwork Fri Mar 28 21:13:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 27376 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3951E20062 for ; Fri, 28 Mar 2014 21:13:13 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 9sf7513116ykp.5 for ; Fri, 28 Mar 2014 14:13:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=vh1qvTwhHd9mP00DtkOQ1b1rGoID8tSg7RxIGfSSMB4=; b=D3Tvl+hErrthJ3xzHVfHMFPBtnBMWt46xJy4vbFiCJ9JKSXcKUY8xpHpFHDEAG3vTF Iil5PKcnS+BIzW0wHCPt3QXknDbwlD7sgXzyjy8icuf9HkdMw+YHcxsy6oIlY2ATU0Tf nG8J+30jjLn6U8p84NI8KhkR6jYwU2wQKCKOHfxYtFisIukgn3MAfJVmhAo0frJjtqXR TcjwApRPd5ZnQZtSLykOmMqIBFHaPcgdQMcVkRRdxCcokMDD6lNFHzDQKUdh45/9z1Xs DDSWq6H6UrcXFitk4SuPnUIEsFf69ohI/YV0TQaoc7G0l1tDIMAlavYGBjPupbtCzSg8 9uvg== X-Gm-Message-State: ALoCoQlxRvQjdVYjvsj26wzuxyK32BVReb5XnpEI/wOgfh4/1HQq5H6kH5jUrgVjmKf++4OIe5lV X-Received: by 10.236.126.72 with SMTP id a48mr3594895yhi.49.1396041192934; Fri, 28 Mar 2014 14:13:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.103.77 with SMTP id x71ls1756309qge.31.gmail; Fri, 28 Mar 2014 14:13:12 -0700 (PDT) X-Received: by 10.52.253.75 with SMTP id zy11mr7746903vdc.10.1396041192779; Fri, 28 Mar 2014 14:13:12 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id p8si1494978vef.14.2014.03.28.14.13.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 14:13:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if17so6345080vcb.36 for ; Fri, 28 Mar 2014 14:13:12 -0700 (PDT) X-Received: by 10.58.154.10 with SMTP id vk10mr9172753veb.18.1396041192669; Fri, 28 Mar 2014 14:13:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp39636vcv; Fri, 28 Mar 2014 14:13:12 -0700 (PDT) X-Received: by 10.66.142.42 with SMTP id rt10mr11097281pab.1.1396041191848; Fri, 28 Mar 2014 14:13:11 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qj1si4357749pbb.385.2014.03.28.14.13.11; Fri, 28 Mar 2014 14:13:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753122AbaC1VM6 (ORCPT + 9 others); Fri, 28 Mar 2014 17:12:58 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:33366 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753191AbaC1VMv (ORCPT ); Fri, 28 Mar 2014 17:12:51 -0400 Received: by mail-ig0-f182.google.com with SMTP id uy17so1383918igb.9 for ; Fri, 28 Mar 2014 14:12:51 -0700 (PDT) X-Received: by 10.50.35.129 with SMTP id h1mr13637508igj.17.1396041171136; Fri, 28 Mar 2014 14:12:51 -0700 (PDT) Received: from localhost.localdomain (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id t1sm7139024igw.16.2014.03.28.14.12.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 14:12:50 -0700 (PDT) From: Alex Elder To: linux@arm.linux.org.uk, linus.walleij@linaro.org, viresh.linux@gmail.com, shiraz.hashim@gmail.com, catalin.marinas@arm.com Cc: spear-devel@list.st.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 7/7] ARM: spear: use central SMP spin-table routines Date: Fri, 28 Mar 2014 16:13:00 -0500 Message-Id: <1396041180-29897-8-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1396041180-29897-1-git-send-email-elder@linaro.org> References: <1396041180-29897-1-git-send-email-elder@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: elder@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Get rid of the spear-specific code that implements the "holding pen" for secondary CPUs. Use the code defined in "arch/arm/kernel/smp.c" instead. Note: The original "holding pen" code for this machine used only the bottom 4 bits of the MPIDR to identify the processor id. The common code looks at the bottom 24 bits. The validity of this change needs to be verified. Signed-off-by: Alex Elder --- arch/arm/mach-spear/Makefile | 2 +- arch/arm/mach-spear/generic.h | 1 - arch/arm/mach-spear/headsmp.S | 47 -------------------------- arch/arm/mach-spear/platsmp.c | 75 ++--------------------------------------- 4 files changed, 4 insertions(+), 121 deletions(-) delete mode 100644 arch/arm/mach-spear/headsmp.S diff --git a/arch/arm/mach-spear/Makefile b/arch/arm/mach-spear/Makefile index a946c19..974a417 100644 --- a/arch/arm/mach-spear/Makefile +++ b/arch/arm/mach-spear/Makefile @@ -7,7 +7,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include # Common support obj-y := restart.o time.o -smp-$(CONFIG_SMP) += headsmp.o platsmp.o +smp-$(CONFIG_SMP) += platsmp.o smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_ARCH_SPEAR13XX) += spear13xx.o $(smp-y) diff --git a/arch/arm/mach-spear/generic.h b/arch/arm/mach-spear/generic.h index a99d90a..86189ec 100644 --- a/arch/arm/mach-spear/generic.h +++ b/arch/arm/mach-spear/generic.h @@ -36,7 +36,6 @@ void __init spear13xx_l2x0_init(void); void spear_restart(enum reboot_mode, const char *); -void spear13xx_secondary_startup(void); void spear13xx_cpu_die(unsigned int cpu); extern struct smp_operations spear13xx_smp_ops; diff --git a/arch/arm/mach-spear/headsmp.S b/arch/arm/mach-spear/headsmp.S deleted file mode 100644 index ed85473..0000000 --- a/arch/arm/mach-spear/headsmp.S +++ /dev/null @@ -1,47 +0,0 @@ -/* - * arch/arm/mach-spear13XX/headsmp.S - * - * Picked from realview - * Copyright (c) 2012 ST Microelectronics Limited - * Shiraz Hashim - * - * 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 -#include - - __INIT - -/* - * spear13xx 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(spear13xx_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 - - /* re-enable coherency */ - mrc p15, 0, r0, c1, c0, 1 - orr r0, r0, #(1 << 6) | (1 << 0) - mcr p15, 0, r0, c1, c0, 1 - /* - * we've been released from the holding pen: secondary_stack - * should now contain the SVC stack for this core - */ - b secondary_startup - - .align -1: .long . - .long pen_release -ENDPROC(spear13xx_secondary_startup) diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c index e16f779..e97af7d 100644 --- a/arch/arm/mach-spear/platsmp.c +++ b/arch/arm/mach-spear/platsmp.c @@ -20,77 +20,8 @@ #include #include "generic.h" -/* - * Write pen_release in a way that is guaranteed to be visible to all - * observers, irrespective of whether they're taking part in coherency - * or not. This is necessary for the hotplug code to work reliably. - */ -static void write_pen_release(int val) -{ - pen_release = val; - smp_wmb(); - sync_cache_w(&pen_release); -} - -static DEFINE_SPINLOCK(boot_lock); - static void __iomem *scu_base = IOMEM(VA_SCU_BASE); -static void spear13xx_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 spear13xx_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); - - 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; -} - /* * Initialise the CPU possible map early - this describes the CPUs * which may be present or become present in the system. @@ -119,14 +50,14 @@ static void __init spear13xx_smp_prepare_cpus(unsigned int max_cpus) * (presently it is in SRAM). The BootMonitor waits until it receives a * soft interrupt, and then the secondary CPU branches to this address. */ - __raw_writel(virt_to_phys(spear13xx_secondary_startup), SYS_LOCATION); + __raw_writel(virt_to_phys(secondary_holding_pen), SYS_LOCATION); } struct smp_operations spear13xx_smp_ops __initdata = { .smp_init_cpus = spear13xx_smp_init_cpus, .smp_prepare_cpus = spear13xx_smp_prepare_cpus, - .smp_secondary_init = spear13xx_secondary_init, - .smp_boot_secondary = spear13xx_boot_secondary, + .smp_secondary_init = smp_secondary_init, + .smp_boot_secondary = smp_boot_secondary, #ifdef CONFIG_HOTPLUG_CPU .cpu_die = spear13xx_cpu_die, #endif