From patchwork Mon Feb 18 13:47:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 2159091 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A72D63FCFC for ; Mon, 18 Feb 2013 13:46:43 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U7QzZ-0005Gy-Bq; Mon, 18 Feb 2013 13:42:49 +0000 Received: from mail-da0-f48.google.com ([209.85.210.48]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U7Qyb-0004kh-MA for linux-arm-kernel@lists.infradead.org; Mon, 18 Feb 2013 13:41:50 +0000 Received: by mail-da0-f48.google.com with SMTP id v40so2503333dad.7 for ; Mon, 18 Feb 2013 05:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:date:message-id:in-reply-to:references :subject; bh=5a5cZGVcW4tSnnGbjxeIwe0l5f8pWkWS70LS9+nehM0=; b=HxUGQ3Zg859HUgMVbylSgV0di/F/zDe5bQsmRN2+3D5CbWkZkrVzKqMqdqYmDVOqKA KP8ilPDbytoa9CgUTTUq2do4x/CXFOCvNbM57ZgO92u4ur//Sir2LYIyYRKWnIx0Ejy0 mrRfPli4XJ8rIXlCskD+l7IPXyFZkdcdbr6pMAoXehbzOh2i5wk6MskZV85ATn0DqBVe wy6a63+NHLdN2vNd7V77WbvxZDQxO7J4+kuJyR9SE9Y9v+5vvJ/SSI1nWdaNpck2v1xm VbQmBgoK7sxIIbtibyd2trD75WFQD5Sma2l0ZdyE4VU4NbhKCDzvAG5y/1O2VyQabWxD R4Tg== X-Received: by 10.68.244.162 with SMTP id xh2mr29771880pbc.55.1361194908020; Mon, 18 Feb 2013 05:41:48 -0800 (PST) Received: from [127.0.0.1] (FL1-122-135-132-124.tky.mesh.ad.jp. [122.135.132.124]) by mx.google.com with ESMTPS id b9sm14524592pba.6.2013.02.18.05.41.45 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Feb 2013 05:41:46 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Date: Mon, 18 Feb 2013 22:47:25 +0900 Message-Id: <20130218134725.17303.98038.sendpatchset@w520> In-Reply-To: <20130218134648.17303.97576.sendpatchset@w520> References: <20130218134648.17303.97576.sendpatchset@w520> Subject: [PATCH 04/08] ARM: shmobile: Update r8a7779 to check SCU for hotplug X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130218_084149_859632_620E8DC6 X-CRM114-Status: GOOD ( 15.28 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.48 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (magnus.damm[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: hechtb@gmail.com, horms@verge.net.au, Magnus Damm , linux-arm-kernel@lists.infradead.org, arnd@arndb.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Magnus Damm Update the r8a7779 CPU Hotplug code to use SCU PSR to wait for the target CPU core. Previously the shared code in hotplug.c was used to let cpu_kill() wait for cpu_die(). With this change in place the r8a7779 SMP code does not depend on hotplug.c anymore. Signed-off-by: Magnus Damm --- arch/arm/mach-shmobile/smp-r8a7779.c | 38 ++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) --- 0004/arch/arm/mach-shmobile/smp-r8a7779.c +++ work/arch/arm/mach-shmobile/smp-r8a7779.c 2013-02-18 22:04:24.000000000 +0900 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -68,6 +69,16 @@ void __init r8a7779_register_twd(void) } #endif +static int r8a7779_scu_psr_core_disabled(int cpu) +{ + unsigned long mask = 3 << (cpu * 8); + + if ((__raw_readl(shmobile_scu_base + 8) & mask) == mask) + return 1; + + return 0; +} + static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) { void __iomem *scu_base = shmobile_scu_base; @@ -89,9 +100,6 @@ static int r8a7779_platform_cpu_kill(uns cpu = cpu_logical_map(cpu); - /* disable cache coherency */ - modify_scu_cpu_psr(3 << (cpu * 8), 0); - if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) ch = r8a7779_ch_cpu[cpu]; @@ -110,7 +118,7 @@ static int __maybe_unused r8a7779_cpu_ki * finish before asking SoC-specific code to power off the CPU core. */ for (k = 0; k < 1000; k++) { - if (shmobile_cpu_is_dead(cpu)) + if (r8a7779_scu_psr_core_disabled(cpu)) return r8a7779_platform_cpu_kill(cpu); mdelay(1); @@ -119,6 +127,24 @@ static int __maybe_unused r8a7779_cpu_ki return 0; } +static void __maybe_unused r8a7779_cpu_die(unsigned int cpu) +{ + dsb(); + flush_cache_all(); + + /* disable cache coherency */ + modify_scu_cpu_psr(3 << (cpu * 8), 0); + + /* Endless loop until power off from r8a7779_cpu_kill() */ + while (1) + cpu_do_idle(); +} + +static int __maybe_unused r8a7779_cpu_disable(unsigned int cpu) +{ + /* only CPU1->3 have power domains, do not allow hotplug of CPU0 */ + return cpu == 0 ? -EPERM : 0; +} static void __cpuinit r8a7779_secondary_init(unsigned int cpu) { @@ -179,7 +205,7 @@ struct smp_operations r8a7779_smp_ops _ .smp_boot_secondary = r8a7779_boot_secondary, #ifdef CONFIG_HOTPLUG_CPU .cpu_kill = r8a7779_cpu_kill, - .cpu_die = shmobile_cpu_die, - .cpu_disable = shmobile_cpu_disable, + .cpu_die = r8a7779_cpu_die, + .cpu_disable = r8a7779_cpu_disable, #endif };