From patchwork Wed Jul 16 18:39:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 4569191 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6A9DFC0514 for ; Wed, 16 Jul 2014 18:41:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99025201BB for ; Wed, 16 Jul 2014 18:41:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C2C14201B9 for ; Wed, 16 Jul 2014 18:41:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X7U74-0001NG-SZ; Wed, 16 Jul 2014 18:39:34 +0000 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X7U71-0001KZ-Er for linux-arm-kernel@lists.infradead.org; Wed, 16 Jul 2014 18:39:33 +0000 Received: by mail-we0-f181.google.com with SMTP id k48so175416wev.12 for ; Wed, 16 Jul 2014 11:39:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=303eIGMQc1EagycJZsWIMsAVBuDJByzmTRsOV6vQZF0=; b=wrDboxxoCKx9JyFGbLg6G+j2lItzb2PMjPmksNUbjh/JRdmLQctWHzS2UjYoEiPz9S 9BsFoltwW6eprzINwJM1JfA/XWBHKEuBjfonKCzpN15g9BHVGx7SqI87s58ylLNZTgsP z4jJrlCFZgz+kyDH+JCLrREbh2D9FqVnUQUZgUxE4P1NTWEA5zeIS1O6nLwv61SFjSJN +Bo51yHVPdqhyuE8mA/oEnqbgP9rM5JPBaG8SweArFSBpExf6IRt6wt0S3uZ/YxuoW/l zFmyaur7GdSkFUvtrFb74snLrDfZvk33vfJBjonSrG8yoiNBq8EKq/zy6MDGVwFMcGpe 7x8Q== X-Received: by 10.180.20.112 with SMTP id m16mr16230796wie.6.1405535948472; Wed, 16 Jul 2014 11:39:08 -0700 (PDT) Received: from mbp-de-romain.home (AToulouse-554-1-142-44.w90-60.abo.wanadoo.fr. [90.60.237.44]) by mx.google.com with ESMTPSA id lo18sm11939188wic.1.2014.07.16.11.39.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jul 2014 11:39:07 -0700 (PDT) Message-ID: <53C6C6CC.2050508@gmail.com> Date: Wed, 16 Jul 2014 20:39:08 +0200 From: Romain Perier User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v1] ARM: rockchip: Add cpu hotplug support X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140716_113931_665353_70CBFE36 X-CRM114-Status: GOOD ( 15.86 ) X-Spam-Score: -0.8 (/) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all, This patch adds support for cpu hotplug for rockchip SoCs. You can now use kexec with rockchip compatible devices. That's my first patch to the kernel, so perhaps that there are missing things (I am sorry if this is the case). Regards, Romain From 6727523766e3711ab58b2276d2e60bee0f7b7ba8 Mon Sep 17 00:00:00 2001 From: Romain Perier Date: Tue, 15 Jul 2014 19:38:05 +0000 Subject: [PATCH] Add cpu hotplug support --- arch/arm/mach-rockchip/platsmp.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c index 910835d..7cdcf5f 100644 --- a/arch/arm/mach-rockchip/platsmp.c +++ b/arch/arm/mach-rockchip/platsmp.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -178,8 +179,38 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) pmu_set_power_domain(0 + i, false); } +#ifdef CONFIG_HOTPLUG_CPU +static DECLARE_COMPLETION(cpu_died); + +static int rockchip_cpu_kill(unsigned int cpu) +{ + if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(1000))) { + pr_err("CPU%d: didn't die correctly\n", cpu); + return 0; + } + pmu_set_power_domain(0 + cpu, false); + return 1; +} + + +static void rockchip_cpu_die(unsigned int cpu) +{ + complete(&cpu_died); + flush_cache_louis(); + + v7_exit_coherency_flush(louis); + + while(1) + cpu_do_idle(); +} +#endif + static struct smp_operations rockchip_smp_ops __initdata = { .smp_prepare_cpus = rockchip_smp_prepare_cpus, - .smp_boot_secondary = rockchip_boot_secondary, + .smp_boot_secondary = rockchip_boot_secondary +#ifdef CONFIG_HOTPLUG_CPU + , .cpu_kill = rockchip_cpu_kill, + .cpu_die = rockchip_cpu_die +#endif }; CPU_METHOD_OF_DECLARE(rk3066_smp, "rockchip,rk3066-smp", &rockchip_smp_ops);