From patchwork Mon Feb 27 09:13:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 94540 Delivered-To: patch@linaro.org Received: by 10.140.20.113 with SMTP id 104csp784814qgi; Mon, 27 Feb 2017 01:43:34 -0800 (PST) X-Received: by 10.84.141.1 with SMTP id 1mr23184824plu.178.1488188614269; Mon, 27 Feb 2017 01:43:34 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r78si9045221pfg.71.2017.02.27.01.43.34; Mon, 27 Feb 2017 01:43:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782AbdB0JnC (ORCPT + 5 others); Mon, 27 Feb 2017 04:43:02 -0500 Received: from mail-lf0-f47.google.com ([209.85.215.47]:33728 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751564AbdB0JnA (ORCPT ); Mon, 27 Feb 2017 04:43:00 -0500 Received: by mail-lf0-f47.google.com with SMTP id a6so7984428lfa.0 for ; Mon, 27 Feb 2017 01:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=1/MZVGKbAKykihj+Msy6gsdvIZozAq8+xt0YasX9sfo=; b=C6DMWpGt+bI7J3U53Ig+nADeQq2F7M/W51oYmhMmfvOAL7jA6pqEzleghkcbMsm/fD KAe6w9LUlJnRQ8P4dSZeghf3s47AkT+KfB53DrviBr+YfyTJGt5GWYI2x1rWMIP2PXRK Ln/rqMP0BWfDKzkLeUob7FVirbAICIH2WRk9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1/MZVGKbAKykihj+Msy6gsdvIZozAq8+xt0YasX9sfo=; b=rVsYohgScjzm1FTKqBW4EwmBwMRM4ZZNSJrbonIv0YXb45TDKhQ+lPYBONWFPc4fr1 vVtSHKlCa/9KwRPF5aNnIeHxjtagAUknooObtPwCy9o8khsAH4249tvko1SyNZ2FhJmP Mp/8L4SR5OIFyicT0QDcvTDwLp4H9a628AIrKciuSTSkFcrh26PJb84EtMtduN//gr7+ qmMKgfQRRQhfaN3JWQzdG6xYZHkGj7GBfu7JDP+j1vB+WKZyBcAEaXOKJ8CTSAZnZfpf LH8h7wE2r0wz+Ivf2Qfe1IW4+xefUBAKcaRiTQQFfOFzKkPzDthbHygdkMHB9ynGkzMZ ggdg== X-Gm-Message-State: AMke39mMQj6L4/sHpSdzTfPaaKHW3aEq8+8btX7Jdtsor0AbmFLo1WUUMPEJ0RS30Wcw8EKx X-Received: by 10.25.207.81 with SMTP id f78mr4417117lfg.4.1488186825232; Mon, 27 Feb 2017 01:13:45 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id p11sm3807861lfd.20.2017.02.27.01.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Feb 2017 01:13:44 -0800 (PST) From: Linus Walleij To: arm@kernel.org Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij , stable@vger.kernel.org, Ulf Hansson Subject: [PATCH] ARM: ux500: resume the second core properly Date: Mon, 27 Feb 2017 10:13:38 +0100 Message-Id: <20170227091338.9800-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The pen hold/release scheme was copied over to Ux500 from the ARM reference designs like most of these at the time. It is not needed at all, and was mostly removed in commit c00def71efd9 "ARM: ux500: simplify secondary CPU boot". However on the suspend/resume path and hot plug/unplug of CPUs, the .cpu_die() callback was still waiting for the pen to be released which made it spin forever and the second core never come back online after suspend/resume. Fix this by simply replacing the strange custom .cpu_die() with a oneline wfi() just like e.g. the qcom platform does. This fixes the issue and makes the second core come up properly after suspend/resume. As a side effect, this rids us of the completely surplus local setup.h and hotplug.c files, and we just compile this into platsmp.c with everything else SMP. Cc: stable@vger.kernel.org Fixes: c00def71efd9 ("ARM: ux500: simplify secondary CPU boot") Cc: Ulf Hansson Signed-off-by: Linus Walleij --- ARM SoC folks: please apply this directly for fixes. The bug has been around for a while, it is nice to have both CPUs online after suspend/resume. --- arch/arm/mach-ux500/Makefile | 3 --- arch/arm/mach-ux500/cpu-db8500.c | 2 -- arch/arm/mach-ux500/hotplug.c | 37 ------------------------------------- arch/arm/mach-ux500/platsmp.c | 9 +++++++-- arch/arm/mach-ux500/setup.h | 16 ---------------- 5 files changed, 7 insertions(+), 60 deletions(-) delete mode 100644 arch/arm/mach-ux500/hotplug.c delete mode 100644 arch/arm/mach-ux500/setup.h -- 2.9.3 diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index c2499bff4986..a9a3453548f4 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -5,7 +5,4 @@ obj-y := pm.o obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o obj-$(CONFIG_SMP) += platsmp.o -obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o - -CFLAGS_hotplug.o += -march=armv7-a diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 24529cf58df6..28083ef72819 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -31,8 +31,6 @@ #include #include -#include "setup.h" - #include "db8500-regs.h" static int __init ux500_l2x0_unlock(void) diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c deleted file mode 100644 index 1cbed0331fd3..000000000000 --- a/arch/arm/mach-ux500/hotplug.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) STMicroelectronics 2009 - * Copyright (C) ST-Ericsson SA 2010 - * - * License Terms: GNU General Public License v2 - * Based on ARM realview platform - * - * Author: Sundar Iyer - * - */ -#include -#include -#include - -#include - -#include "setup.h" - -/* - * platform-specific code to shutdown a CPU - * - * Called with IRQs disabled - */ -void ux500_cpu_die(unsigned int cpu) -{ - /* directly enter low power state, skipping secure registers */ - for (;;) { - __asm__ __volatile__("dsb\n\t" "wfi\n\t" - : : : "memory"); - if (pen_release == cpu_logical_map(cpu)) { - /* - * OK, proper wakeup, we're done - */ - break; - } - } -} diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index e0ee139fdebf..19c165aeecd2 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c @@ -23,8 +23,6 @@ #include #include -#include "setup.h" - #include "db8500-regs.h" /* Magic triggers in backup RAM */ @@ -90,6 +88,13 @@ static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle) return 0; } +#ifdef CONFIG_HOTPLUG_CPU +void ux500_cpu_die(unsigned int cpu) +{ + wfi(); +} +#endif + static const struct smp_operations ux500_smp_ops __initconst = { .smp_prepare_cpus = ux500_smp_prepare_cpus, .smp_boot_secondary = ux500_boot_secondary, diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h deleted file mode 100644 index 988e7c77068d..000000000000 --- a/arch/arm/mach-ux500/setup.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2009 ST-Ericsson. - * - * 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. - * - * These symbols are needed for board-specific files to call their - * own cpu-specific files - */ -#ifndef __ASM_ARCH_SETUP_H -#define __ASM_ARCH_SETUP_H - -extern void ux500_cpu_die(unsigned int cpu); - -#endif /* __ASM_ARCH_SETUP_H */