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: 53058 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id B510E22E23 for ; Thu, 3 Sep 2015 19:59:03 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf84589lbb.2 for ; Thu, 03 Sep 2015 12:59:02 -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=R6vl7OHQHxLGlHzBr9pUH065hkBmMS8D/8Z4VTxDkEk=; b=GgkTR39MJeAvOUHYzy1KlCUiZs9tkmUwtFb/lpcwyxBgBhpVPNcZ/GL2YzU9V5aqr2 /9avVv+H4G0ROkPIVow9nBFh4uM/8Owm169PObqMxf68rAEDCQ+dmoly9TJHOuJ7En0u KGH8ebtlu4wIwNiC5ej4njDj+xVrG/2XE3uRvraWM5fAui/xXNibJA7sqejFg8SUfMk+ S+PMT5Is3wsG14LzhTICG11OkwmIY+X89D1fCq56iDfDoZMuKQkUk6SjfBKtG2EI0QWN 0RjeYWoAdx+d3+WatZJbt19qoNruIcALLQTJlGjcnr7X3OVEvNzxKkbIQUkfJmVfCu3D gvHQ== X-Gm-Message-State: ALoCoQkMJ2qzyzmN61BaX4e3TfMhUE14qsa+NLzIQe/8B8mcRLXZiW0U7v2TQiDQH7zd7u7CQ+sQ X-Received: by 10.112.132.105 with SMTP id ot9mr11103939lbb.21.1441310342772; Thu, 03 Sep 2015 12:59:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.168 with SMTP id c8ls220701laa.106.gmail; Thu, 03 Sep 2015 12:59:02 -0700 (PDT) X-Received: by 10.112.168.7 with SMTP id zs7mr22877375lbb.26.1441310342629; Thu, 03 Sep 2015 12:59:02 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id x5si13726308lal.70.2015.09.03.12.59.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 12:59:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbpo4 with SMTP id o4so182795lbp.2 for ; Thu, 03 Sep 2015 12:59:02 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr23334282lbc.112.1441310342462; Thu, 03 Sep 2015 12:59:02 -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.164.42 with SMTP id yn10csp1491300lbb; Thu, 3 Sep 2015 12:59:01 -0700 (PDT) X-Received: by 10.60.58.4 with SMTP id m4mr27367215oeq.74.1441310338153; Thu, 03 Sep 2015 12:58:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hn3si43263170pdb.66.2015.09.03.12.58.57; Thu, 03 Sep 2015 12:58:58 -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 S1752280AbbICT64 (ORCPT + 13 others); Thu, 3 Sep 2015 15:58:56 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:35837 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751973AbbICT64 (ORCPT ); Thu, 3 Sep 2015 15:58:56 -0400 Received: by pacfv12 with SMTP id fv12so247614pac.2 for ; Thu, 03 Sep 2015 12:58:55 -0700 (PDT) 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 Cc: rjw@rjwysocki.net, geert@linux-m68k.org, k.kozlowski@samsung.com, 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 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> 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.217.177 as permitted sender) smtp.mailfrom=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..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();