From patchwork Thu Sep 3 19:58:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 7119101 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D696DBF036 for ; Thu, 3 Sep 2015 20:01:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F359320827 for ; Thu, 3 Sep 2015 20:01:34 +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 113E1207C5 for ; Thu, 3 Sep 2015 20:01:34 +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 1ZXafp-0000H5-BX; Thu, 03 Sep 2015 19:59:53 +0000 Received: from mail-pa0-f41.google.com ([209.85.220.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXafE-0008Av-EU for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2015 19:59:16 +0000 Received: by pacwi10 with SMTP id wi10so211074pac.3 for ; Thu, 03 Sep 2015 12:58:55 -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=qMDxqEqLSY1ZV3HS7vJD9DcUDKYmx9Ojkkt0UbSvMKw=; b=Hv/XJ0W/Kc7sVDuNJTqNteGBq66t6cmFpT5KmRDxRBI9ympPN5SIv/ubIrDjsQNIg0 kMJKnXgKkUMWx8lF7NdgW2j/EdfP7V1ySs7+8u+L5WxHppZ3ZbLNT3dh+iJfFYxTNRIt BttKcdAdf30Sra3TOdpJOygQGuoXVPziJWp+UNaQwWrRyHjKsDXg/MjHWBbO1SC849oT t/TMguwkP5iPfYD1s79KTDNFcO/I+oHia19jTGxWQlBH6ENN7GlhI1nkG/OL5AcLCG5p wKS6dvkF7y7dvZQWnzEiWJxqe5SqZxXiF9rEPQ+Qh4HFZ7FXznJqr6FqfY65Z2jRVk5Y 1Y1Q== X-Gm-Message-State: ALoCoQnk5XQA3WgV7lomJ2OzTUqQNLtAK77d0yxBlvxGLaCmkbOG3I89yhqtJkF01/w98Ykb8un9 X-Received: by 10.68.184.197 with SMTP id ew5mr71977637pbc.145.1441310335679; Thu, 03 Sep 2015 12:58:55 -0700 (PDT) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id a17sm13396430pbu.55.2015.09.03.12.58.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 12:58:55 -0700 (PDT) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@linaro.org, linux-pm@vger.kernel.org Subject: [PATCH v2 6/7] ARM64: smp: Add runtime PM support for CPU hotplug Date: Thu, 3 Sep 2015 13:58:33 -0600 Message-Id: <1441310314-8857-7-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441310314-8857-1-git-send-email-lina.iyer@linaro.org> References: <1441310314-8857-1-git-send-email-lina.iyer@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150903_125916_527792_E6F230FD X-CRM114-Status: GOOD ( 13.67 ) 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 , Catalin Marinas , sboyd@codeaurora.org, rjw@rjwysocki.net, 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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..4076962 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 */ @@ -292,6 +298,16 @@ void __cpu_die(unsigned int cpu) void cpu_die(void) { unsigned int cpu = smp_processor_id(); + struct device *cpu_dev; + + /* + * We dont need the CPU device anymore. + * Lets do this before IRQs are disabled to allow + * runtime PM to suspend the domain as well. + */ + cpu_dev = get_cpu_device(cpu); + if (cpu_dev) + pm_runtime_put_sync(cpu_dev); idle_task_exit();