From patchwork Tue Aug 4 23:35:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 51937 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 51575229FD for ; Tue, 4 Aug 2015 23:36:33 +0000 (UTC) Received: by labth1 with SMTP id th1sf9077984lab.2 for ; Tue, 04 Aug 2015 16:36:32 -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=zqDbB8xlEA7r2iAV/fhMTOcS9tK4gWzArPGkdoc3U84=; b=JuceGuo9zFpE/LxBZ4caNzft3f3QZQtgg/jmHbEDALLcCS1MAHvlRhMe8K4DFWxd3q MKGw5XFkh5VWEF3e3pOjzxasJKTXR6X+EJKVmWYzf+e24xYPqETv5bRWrR9td0/qRkU3 EF9Z2snUvEICgjih/Vg6LGQt/FL7doQ4klQUBwDqIDdz5ywRY5IIbs3tQb99ho4x4JNJ wFdpyk/iJtq+/j/jg8F0u7R6T0VgK8eONWY+S3ZRm0oridgQHi2YZY+4lC8bwowtJHhK rNPGohONvWLZ7Wndw/9fGPEnRhwL2uOzk8/V+NnhJ95jP9y8OSSYwQhnnIjk1hTeslTl 8qsw== X-Gm-Message-State: ALoCoQmtTJM7VIlcvC+jvRN1hMtsJKXt66FMfBvxWWLBx1hp5tLtP3toDO9aDHhky6tqhs+TWOlx X-Received: by 10.112.99.37 with SMTP id en5mr1831907lbb.7.1438731392203; Tue, 04 Aug 2015 16:36:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.228 with SMTP id h4ls121801lam.23.gmail; Tue, 04 Aug 2015 16:36:32 -0700 (PDT) X-Received: by 10.112.144.199 with SMTP id so7mr6779879lbb.109.1438731392061; Tue, 04 Aug 2015 16:36:32 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id i4si952628laf.44.2015.08.04.16.36.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2015 16:36:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by labgo9 with SMTP id go9so17662357lab.3 for ; Tue, 04 Aug 2015 16:36:32 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr6804075lbc.19.1438731391970; Tue, 04 Aug 2015 16:36:31 -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 l6csp50495lba; Tue, 4 Aug 2015 16:36:31 -0700 (PDT) X-Received: by 10.66.161.105 with SMTP id xr9mr13322313pab.50.1438731380925; Tue, 04 Aug 2015 16:36:20 -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.20; Tue, 04 Aug 2015 16:36:20 -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 S1754679AbbHDXgT (ORCPT + 12 others); Tue, 4 Aug 2015 19:36:19 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:35813 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754663AbbHDXgS (ORCPT ); Tue, 4 Aug 2015 19:36:18 -0400 Received: by pabxd6 with SMTP id xd6so2469170pab.2 for ; Tue, 04 Aug 2015 16:36:18 -0700 (PDT) X-Received: by 10.68.224.133 with SMTP id rc5mr13017769pbc.80.1438731378422; Tue, 04 Aug 2015 16:36:18 -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.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Aug 2015 16:36:18 -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 8/9] ARM64: smp: Add runtime PM support for CPU hotplug Date: Tue, 4 Aug 2015 17:35:38 -0600 Message-Id: <1438731339-58317-9-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.50 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 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/arm64/kernel/smp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index dbdaacd..fbeeffa 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -135,6 +135,7 @@ asmlinkage void secondary_start_kernel(void) { struct mm_struct *mm = &init_mm; unsigned int cpu = smp_processor_id(); + struct device *cpu_dev; /* * All kernel threads share the same mm context; grab a @@ -185,6 +186,11 @@ asmlinkage void secondary_start_kernel(void) local_irq_enable(); local_async_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 */ @@ -219,6 +225,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 = op_cpu_disable(cpu); if (ret) return ret; @@ -293,6 +302,13 @@ void 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();