From patchwork Tue Aug 4 23:35:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 51938 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 66E38229FD for ; Tue, 4 Aug 2015 23:36:36 +0000 (UTC) Received: by lbcjj5 with SMTP id jj5sf7882324lbc.1 for ; Tue, 04 Aug 2015 16:36:35 -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=YihdTENxRShCiVGaP13eChHUoFgf8w+J4ivrqRXHHrw=; b=lwhsBCKiY65DueJa/dx4tWGwmjkJU7tZcl1FEwMzlh5Y5wXTzM9iQViVTTAixIiN78 343oTGTvxIAKRtd07fPiXGxLvooeanXA3jviVwmxV7dfypWgsvY3gDA2CrpkasypiLJ0 uZ86ukesjDKVOGL80ZTQ4wJGmdXVT3BwiXRcO6nOkQTnawij+et0OeHpjAvu3pfNwOxZ FABkzoqZ2VJ31LdAD9v7LhfttcVejfaAoExIs49tXwDdA7lH1We1i80qZLl4/GyV6BRK ObyZkmB6WhLFMTJ1Ach4FnZKpjBk3On1Vtq+V+B59qnQBB5u3i0G3FJt2FNdJgjoQJ35 TB5w== X-Gm-Message-State: ALoCoQljaoQ090ZB6D6fzCSklvLGVDFoRyHAry6vyR5BE7kFtmlawJCT57DWhXJbXZfb672qG4x+ X-Received: by 10.180.83.33 with SMTP id n1mr536546wiy.4.1438731395143; Tue, 04 Aug 2015 16:36:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.164 with SMTP id cz4ls120926lac.3.gmail; Tue, 04 Aug 2015 16:36:35 -0700 (PDT) X-Received: by 10.112.26.225 with SMTP id o1mr6742885lbg.5.1438731394987; Tue, 04 Aug 2015 16:36:34 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id wh7si910246lbb.123.2015.08.04.16.36.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2015 16:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by labjt7 with SMTP id jt7so243564lab.0 for ; Tue, 04 Aug 2015 16:36:34 -0700 (PDT) X-Received: by 10.112.120.134 with SMTP id lc6mr6843872lbb.86.1438731394873; Tue, 04 Aug 2015 16:36:34 -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.112.7.198 with SMTP id l6csp50507lba; Tue, 4 Aug 2015 16:36:33 -0700 (PDT) X-Received: by 10.68.116.109 with SMTP id jv13mr12733100pbb.137.1438731382855; Tue, 04 Aug 2015 16:36:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mi8si1794926pdb.134.2015.08.04.16.36.21; Tue, 04 Aug 2015 16:36:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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 S932068AbbHDXgV (ORCPT + 12 others); Tue, 4 Aug 2015 19:36:21 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:35772 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754663AbbHDXgU (ORCPT ); Tue, 4 Aug 2015 19:36:20 -0400 Received: by pdrg1 with SMTP id g1so10370027pdr.2 for ; Tue, 04 Aug 2015 16:36:20 -0700 (PDT) X-Received: by 10.70.134.198 with SMTP id pm6mr13197172pdb.17.1438731380104; Tue, 04 Aug 2015 16:36:20 -0700 (PDT) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id to5sm527525pac.33.2015.08.04.16.36.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Aug 2015 16:36:19 -0700 (PDT) From: Lina Iyer To: rjw@rjwysocki.net, ulf.hansson@linaro.org, khilman@linaro.org Cc: geert@linux-m68k.org, k.kozlowski@samsung.com, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, msivasub@codeaurora.org, agross@codeaurora.org, sboyd@codeaurora.org, Lina Iyer , Catalin Marinas , Mark Rutland , Lorenzo Pieralisi Subject: [PATCH 9/9] ARM: smp: Add runtime PM support for CPU hotplug Date: Tue, 4 Aug 2015 17:35:39 -0600 Message-Id: <1438731339-58317-10-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438731339-58317-1-git-send-email-lina.iyer@linaro.org> References: <1438731339-58317-1-git-send-email-lina.iyer@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lina.iyer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) 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: , Enable runtime PM for CPU devices. Do a runtime get of the CPU device when the CPU is hotplugged in and a runtime put of the CPU device when the CPU is hotplugged off. When all the CPUs in a domain are hotplugged off, the domain may also be powered off and cluster_pm_enter/exit() notifications are be sent out. Cc: Catalin Marinas Cc: Mark Rutland Cc: Lorenzo Pieralisi Signed-off-by: Lina Iyer --- arch/arm/kernel/smp.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 0496b48..1d614b8 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -137,7 +138,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) pr_err("CPU%u: failed to boot: %d\n", cpu, ret); } - memset(&secondary_data, 0, sizeof(secondary_data)); return ret; } @@ -205,6 +205,9 @@ int __cpu_disable(void) unsigned int cpu = smp_processor_id(); int ret; + /* We dont need the CPU device anymore. */ + pm_runtime_put_sync(get_cpu_device(cpu)); + ret = platform_cpu_disable(cpu); if (ret) return ret; @@ -272,6 +275,13 @@ void __ref cpu_die(void) { unsigned int cpu = smp_processor_id(); + /* + * We dont need the CPU device anymore. + * Lets do this before IRQs are disabled to allow + * runtime PM to suspend the domain as well. + */ + pm_runtime_put_sync(get_cpu_device(cpu)); + idle_task_exit(); local_irq_disable(); @@ -352,6 +362,7 @@ asmlinkage void secondary_start_kernel(void) { struct mm_struct *mm = &init_mm; unsigned int cpu; + struct device *cpu_dev; /* * The identity mapping is uncached (strongly ordered), so @@ -401,6 +412,11 @@ asmlinkage void secondary_start_kernel(void) local_irq_enable(); local_fiq_enable(); + /* We are running, enable runtime PM for the CPU. */ + cpu_dev = get_cpu_device(cpu); + if (cpu_dev) + pm_runtime_get_sync(cpu_dev); + /* * OK, it's off to the idle thread for us */