From patchwork Tue Nov 17 22:37: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: 7643441 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 6D6AC9F2EC for ; Tue, 17 Nov 2015 22:55:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CFA6205C4 for ; Tue, 17 Nov 2015 22:55:31 +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 C6FE62058A for ; Tue, 17 Nov 2015 22:55:30 +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 1Zyp7x-0005bH-Rf; Tue, 17 Nov 2015 22:53:29 +0000 Received: from mail-pa0-x236.google.com ([2607:f8b0:400e:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zyotp-0005Xa-Ih for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 22:38:54 +0000 Received: by pacej9 with SMTP id ej9so22070081pac.2 for ; Tue, 17 Nov 2015 14:38:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U4VKFabic7gV3E6bU2+1wsB/rab11yZ2sdJaObDv/5c=; b=a7pFGiV9tzJe/iPRquBMB/srKgTu6hupKvMAxksT/jDhnlHk0EJCrpiF4suQjHaoUk WKMeGyJIyUiUUNYf7siWYuYkL0AEqwuTgrk5mn5csvePyNDuFE+h/xoKY8zgXpeTP4gA KpMMHlLq4T/xSHiBr4mKefQKmDbr6RS27cNvRQFGDA2KF6TMT/8Z8Hml1qbmpwqudIe9 sKnP7tgxUV+E2db7nAgAAHgO3s5JjGtYcEHYW3MEso5XPyPbsBn04dDkRWmTO5xPgnO3 I0g0WnhZNDkbkLEETvf2FoS+RYSiXMgHrrin7otuJeyNGghQjxOwaPHaIwJpzf9TLctU lI/w== 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=U4VKFabic7gV3E6bU2+1wsB/rab11yZ2sdJaObDv/5c=; b=TCjKFOFYhMbMuZz//r2DwAdq7jxOE+ekaGwBAFn+CunBLBWsuSsZFcaOMZylGP9PTr +NxKrT/IUU1/OMZb0jmW2bjwXHXjJviys2ETcwx0Su1UZvehKy4bZOivmRzPVcgeXOYe 27zRJipd20I0anmSzbodda3mpzU0gDiFgKmlXcsBeMaftRCy8pj8LjLAlrklgbBqdp5S hqrnWfJb7WsWjgGef/DBbmPw+GcjFNMke1w93agaX1c/qq2qHP3kJPXrmfWIOPaD0I5W fvj+z+roxvZq1t0GnSHkAiPtQh1ThOxFq+XVdp2YicWrtzYNXBikZ39iBuKmV+YOZfQF 4ZcQ== X-Gm-Message-State: ALoCoQn0lpur4QpCvyuEF+BkHR+ppmjqwPPfAz919mAf5i4Td71CdpQiQ5ipsPhs1k4WYnL2clf0 X-Received: by 10.66.102.74 with SMTP id fm10mr67675548pab.33.1447799914066; Tue, 17 Nov 2015 14:38:34 -0800 (PST) Received: from ubuntu.localdomain ([8.42.77.226]) by smtp.gmail.com with ESMTPSA id hy1sm14875199pbb.63.2015.11.17.14.38.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Nov 2015 14:38:33 -0800 (PST) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@linaro.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH RFC 09/27] PM / Domains: Attempt runtime suspend of IRQ safe parent domain Date: Tue, 17 Nov 2015 15:37:33 -0700 Message-Id: <1447799871-56374-10-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447799871-56374-1-git-send-email-lina.iyer@linaro.org> References: <1447799871-56374-1-git-send-email-lina.iyer@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_143853_696031_954ACEE1 X-CRM114-Status: GOOD ( 12.75 ) 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: k.kozlowski@samsung.com, lorenzo.pieralisi@arm.com, ahaslam@baylibre.com, linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org, msivasub@codeaurora.org, geert@linux-m68k.org, Lina Iyer , agross@codeaurora.org, mtitinger@baylibre.com 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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 When a sub-domain is powered off, attempt powering off the parent domains to maximize power savings. A sub-domain that is IRQ safe may however have a parent that is not IRQ safe and therefore cannot be powered down in atomic context that the sub-domain may be powered off. An IRQ safe sub-domain may attempt to power down the parent domain in a synchronous call, if the parent is also IRQ safe. Signed-off-by: Lina Iyer --- drivers/base/power/domain.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 8df43f8..0310e2b 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -44,6 +44,8 @@ static int pm_genpd_alloc_states_names(struct generic_pm_domain *genpd, static LIST_HEAD(gpd_list); static DEFINE_MUTEX(gpd_list_lock); +static int genpd_poweroff(struct generic_pm_domain *genpd, bool is_async); + static inline int genpd_lock_nosleep(struct generic_pm_domain *genpd, unsigned int subclass) __acquires(&genpd->slock) @@ -298,6 +300,13 @@ static int __genpd_poweron(struct generic_pm_domain *genpd) &genpd->slave_links, slave_node) { genpd_sd_counter_dec(link->master); + + /* Assume masters that are non-irq safe are always-on */ + if (genpd->irq_safe && link->master->irq_safe) { + genpd_poweroff(link->master, false); + continue; + } + genpd_queue_power_off_work(link->master); } @@ -448,6 +457,13 @@ static int genpd_poweroff(struct generic_pm_domain *genpd, bool is_async) list_for_each_entry(link, &genpd->slave_links, slave_node) { genpd_sd_counter_dec(link->master); + + /* Assume masters that are non-irq safe are always-on */ + if (genpd->irq_safe && link->master->irq_safe) { + genpd_poweroff(link->master, false); + continue; + } + genpd_queue_power_off_work(link->master); }