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: 9592859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 00FA7601D7 for ; Mon, 27 Feb 2017 09:14:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEBFB2849D for ; Mon, 27 Feb 2017 09:14:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D32FE2849F; Mon, 27 Feb 2017 09:14:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D1562849D for ; Mon, 27 Feb 2017 09:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=JZsgM3GCWbPIGvx+Ke7kfGV42KZd/Bqp5FJnp14oj6g=; b=s4F 7fucReqsp0Ia/Ie6WBwiqb+FeSNSaxgSN9GRsToFqzAA614yW0fBCt8rvFZ3mwSoPnxuM+4bGD3Xz ccWxRURniLwdGqjguKo/SdxQNBALGuM/yRL++OblV2xAE1a++6GVwA1YD5rvmg2xG9Hy3CyDa8OYb c9J/asu8pkXiFxY6QFvt0cp39jV7TLPcjgCzFzASVNJ0MtzveNSyBPoo3HAdIsbK30jy0vEn2ysZ0 dy1OGlrUF2vbK9qjCPFY2F5rciohjFgLt28HXZJKkmwZzlwbN8XH8gv8E7pzdIue0N+FMx6FIjGPP 3J90TcSsoFskI/m4K5YW1niYNWZXpYA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ciHNl-00027o-CH; Mon, 27 Feb 2017 09:14:13 +0000 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ciHNf-000239-Qn for linux-arm-kernel@lists.infradead.org; Mon, 27 Feb 2017 09:14:10 +0000 Received: by mail-lf0-x231.google.com with SMTP id a6so7675513lfa.0 for ; Mon, 27 Feb 2017 01:13:46 -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=S+nU2HiQUHDC/IiJccGTpOp7k6k/zHvpF5EKB3rBPa66CX4xbiKdUXz6t/54Uu2q+9 4sntPh7jdsikmBstPVzvj0OlePElAqW0XYtYyBnqw7zkobLK2W/ugHkJasVbuwtNn9oX m5ooz0PmVoZ3iVJZDkoVT10N/3a6v/+LODKWKWFVHIQOpNSo2T4gobBDhMwJQsT/51FZ XZ++ONisU5+MHMZNCwjhUfrl9gitfMwyQbkaV5SW4Xar1+RfJTXCnFKH9r8bS5G4r+86 pwbaLcMqX3QZuAFEDTznMK64b8d9QgYX2hlecdXwhwcaTaVywdkOf/q3M08rKnb7nDuv 70gg== X-Gm-Message-State: AMke39kH7C4NMnzurH1gGEfJIBSujJbCtwHhgVCcU7QPIMIlpqo3AHkLvryTnwl61DixtyZ/ 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170227_011408_065818_9CA59C06 X-CRM114-Status: GOOD ( 18.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Linus Walleij , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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 */