From patchwork Thu Sep 3 19:58:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 53059 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 AFF4E22E23 for ; Thu, 3 Sep 2015 19:59:06 +0000 (UTC) Received: by lbcao8 with SMTP id ao8sf90390lbc.1 for ; Thu, 03 Sep 2015 12:59:05 -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=25VZUsTWDCARp2jWVtyRJ+qq4IiCi9Do03Ijy4MQRAY=; b=h2Gd3JWbXMMER64qsGbMQ1Hv4EpmGoKbjgJKkD1RCKI2EF8ziSeJvx1fYkfw7/ny3L xNBatSpPLjo2Nw8CwS0KGntptMDKryjy+SD3mdCw28SIKfLex3EUCR7aBZT85RBFtGJd CVNfTzHg7yVZjaXwVAauCVUpTEIX5kTUmS925GsmpFi051jDAHlo6ns28FbNumAvMqKK g9cwZTetuiapwwxM9GajrRKVU/PoR3NKzi7jhr0GamYNl0gNvabFwKb/iExx7kTQqxwL 2Dohf61PTJYKlluHXxsk6ExBJU84Doj9GYXydMl07mK+jBvBh8q/m0VgrBi/4r9hBLxY g0wA== X-Gm-Message-State: ALoCoQlTBaGw5ydSCQEICsBQRAUo5sJ4b2iTbVyEWfHzWUD7nau44XwlrpbVhnVWfP0dd94nRZFa X-Received: by 10.112.132.105 with SMTP id ot9mr11104012lbb.21.1441310345714; Thu, 03 Sep 2015 12:59:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.163 with SMTP id w3ls261899lae.21.gmail; Thu, 03 Sep 2015 12:59:05 -0700 (PDT) X-Received: by 10.153.7.172 with SMTP id dd12mr16598913lad.25.1441310345565; Thu, 03 Sep 2015 12:59:05 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id t11si8938853lbg.143.2015.09.03.12.59.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Sep 2015 12:59:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbpo4 with SMTP id o4so183415lbp.2 for ; Thu, 03 Sep 2015 12:59:05 -0700 (PDT) X-Received: by 10.112.16.135 with SMTP id g7mr23345980lbd.19.1441310345463; Thu, 03 Sep 2015 12:59:05 -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 yn10csp1491322lbb; Thu, 3 Sep 2015 12:59:04 -0700 (PDT) X-Received: by 10.60.74.103 with SMTP id s7mr27283729oev.86.1441310340094; Thu, 03 Sep 2015 12:59:00 -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.59; Thu, 03 Sep 2015 12:59:00 -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 S1754905AbbICT66 (ORCPT + 13 others); Thu, 3 Sep 2015 15:58:58 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:36792 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753568AbbICT66 (ORCPT ); Thu, 3 Sep 2015 15:58:58 -0400 Received: by pacwi10 with SMTP id wi10so211671pac.3 for ; Thu, 03 Sep 2015 12:58:57 -0700 (PDT) X-Received: by 10.68.112.227 with SMTP id it3mr71775730pbb.132.1441310337656; Thu, 03 Sep 2015 12:58:57 -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.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 12:58:57 -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 7/7] ARM: smp: Add runtime PM support for CPU hotplug Date: Thu, 3 Sep 2015 13:58:34 -0600 Message-Id: <1441310314-8857-8-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.180 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 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..077c55f 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; } @@ -271,6 +271,16 @@ void __cpu_die(unsigned int cpu) void __ref 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(); @@ -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 */