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: 6945241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5ACE19F38B for ; Tue, 4 Aug 2015 23:39:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 770592042A for ; Tue, 4 Aug 2015 23:39:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6FEB203DC for ; Tue, 4 Aug 2015 23:39:26 +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 1ZMlm1-0006fZ-UE; Tue, 04 Aug 2015 23:37:33 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZMllC-0006Bf-2w for linux-arm-kernel@bombadil.infradead.org; Tue, 04 Aug 2015 23:36:42 +0000 Received: from mail-pa0-f51.google.com ([209.85.220.51]) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1ZMllA-0007Jw-Ao for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2015 23:36:41 +0000 Received: by pawu10 with SMTP id u10so19637318paw.1 for ; Tue, 04 Aug 2015 16:36:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4EA0YIRbM77L4pRqVk5JXEbOUr0MRTvNRiQP5AlEVC4=; b=D4v7DxJQ7i8DQBFiw4AoiAsZOy4VNsBsupf8qTfd+qVyDkfdQ6RtHfkZBmdKJEavUV U5yYDnIkOuZCCLF11yH9zPfPKS9+qFRgsuo8TduNvzHcaOPekUJjh4Pp5rmIdwMfV92J R//g+h/FyxERa4eARUKEs93+BPSE/swLEVY5+SVsn05CJf6GCpxzqhIHcJPhOR6EJmQy F3rjUM5J54IbEi+U6or4F9ZhsekU152wH3s2t4tRt4PlS8Z7p81q77XPsyhPnubrtpF7 ZHGD/1CpFQciW0cIJcv6x6/i9U/Ax0yY1Fj66Y85fieVAVA+HzbwANUi5viOOV1ioeK3 t0cA== X-Gm-Message-State: ALoCoQk9WV5ejlHnVcgZX91qXqrwrAd6+08u0ASwplhnqnwmAsWkdnxXDgtlqGx+0Zu4vE2ZJNRr 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150804_193640_476754_5F53263A X-CRM114-Status: GOOD ( 15.34 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , k.kozlowski@samsung.com, Lorenzo Pieralisi , linux-pm@vger.kernel.org, Catalin Marinas , sboyd@codeaurora.org, msivasub@codeaurora.org, geert@linux-m68k.org, Lina Iyer , agross@codeaurora.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-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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();