From patchwork Wed Feb 8 16:34:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 93645 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2768494qgi; Wed, 8 Feb 2017 08:35:50 -0800 (PST) X-Received: by 10.99.51.76 with SMTP id z73mr28196188pgz.137.1486571750565; Wed, 08 Feb 2017 08:35:50 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m18si7490273pgd.142.2017.02.08.08.35.50; Wed, 08 Feb 2017 08:35:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752529AbdBHQfr (ORCPT + 9 others); Wed, 8 Feb 2017 11:35:47 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:35655 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752573AbdBHQfo (ORCPT ); Wed, 8 Feb 2017 11:35:44 -0500 Received: by mail-pf0-f177.google.com with SMTP id f144so43422999pfa.2 for ; Wed, 08 Feb 2017 08:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hD0nbDRZ8c9FSUl8u7AUwvDaa2mVWWaQqit2DQ5+ATw=; b=VYIEQM1AyN/3fT3UFI2BxnW0Xhux/2ZFVfeL0hI7B7frO4KQW6mjIutrvXFeD6pl3z Bft+aGZJpDMcS3vXUk8wYaQdD1KkB0Pm+ai6AHZCptsBlN23x/vZ8XLk9wISsPkNZVTl OGd2YCXYwQ3UCCg6g8x3tzETmEmN72hIhoxrk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hD0nbDRZ8c9FSUl8u7AUwvDaa2mVWWaQqit2DQ5+ATw=; b=B0azUVLHUeO62WP3gWBFBe8r7yPTrmomExyXkmkAB2H4+Gazk/Kj8hLBeMAHPIGPQK 2RyspSnYe64WNMvmFW7Szbe8jDLB3d+vzbFfPR8YGfydBmXEzL9E1RiIL1f8FXwfmGuA uEXOZiBdoDwzb+SMiMnbNVfPAElROXV9e8PaEgUbT4GWfpueoeve7Lp5UZNCdUhLDsWF 6Ga6OdOWKSB/1YeRaJJCJ0WMrcHXaHAmT3DljcO+nyIci5aR7OFyqttMiYUL9Rf1f3i8 xK0cQCmYPvD9XXtvhVihpJQC3Pffd3UcdZ1+IaKp1/iKPPxEtFQqEw9H7ER7r86TNGyR SyzA== X-Gm-Message-State: AIkVDXKJgfBO5L3VbnyIdONOfb82bcaUuptH7LBmqfp2U1KAw7w/IStgyoWD+Yj4dt8uLrgf X-Received: by 10.99.95.16 with SMTP id t16mr28142692pgb.212.1486571710256; Wed, 08 Feb 2017 08:35:10 -0800 (PST) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id y23sm21653325pfi.66.2017.02.08.08.35.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Feb 2017 08:35:09 -0800 (PST) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@kernel.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andy.gross@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, brendan.jackman@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, Juri.Lelli@arm.com, Lina Iyer Subject: [PATCH 2/2] PM / Domains: Support in context powering off parent domain Date: Wed, 8 Feb 2017 08:34:52 -0800 Message-Id: <1486571692-33212-4-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486571692-33212-1-git-send-email-lina.iyer@linaro.org> References: <1486571692-33212-1-git-send-email-lina.iyer@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Powering off a domain schedules a work to opportunistically power off the parent domains. Domains that are IRQ safe may have parents that are also IRQ safe. It would be beneficial to power off such IRQ safe parents in the same context as well. Signed-off-by: Lina Iyer --- drivers/base/power/domain.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 3825bb9..51e2254 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -375,7 +375,8 @@ static int genpd_dev_pm_qos_notifier(struct notifier_block *nb, * If all of the @genpd's devices have been suspended and all of its subdomains * have been powered down, remove power from @genpd. */ -static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async) +static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async, + unsigned int depth) { struct pm_domain_data *pdd; struct gpd_link *link; @@ -442,7 +443,17 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async) list_for_each_entry(link, &genpd->slave_links, slave_node) { genpd_sd_counter_dec(link->master); - genpd_queue_power_off_work(link->master); + /* + * Power off the parent in the same context if the parent + * domain is also IRQ safe. + */ + if (genpd_is_irq_safe(genpd) && + genpd_is_irq_safe(link->master)) { + genpd_lock_nested(link->master, depth + 1); + genpd_power_off(link->master, false, depth + 1); + genpd_unlock(link->master); + } else + genpd_queue_power_off_work(link->master); } return 0; @@ -459,7 +470,7 @@ static void genpd_power_off_work_fn(struct work_struct *work) genpd = container_of(work, struct generic_pm_domain, power_off_work); genpd_lock(genpd); - genpd_power_off(genpd, true); + genpd_power_off(genpd, true, 0); genpd_unlock(genpd); } @@ -578,7 +589,7 @@ static int genpd_runtime_suspend(struct device *dev) return 0; genpd_lock(genpd); - genpd_power_off(genpd, false); + genpd_power_off(genpd, false, 0); genpd_unlock(genpd); return 0; @@ -658,7 +669,7 @@ static int genpd_runtime_resume(struct device *dev) if (!pm_runtime_is_irq_safe(dev) || (pm_runtime_is_irq_safe(dev) && genpd_is_irq_safe(genpd))) { genpd_lock(genpd); - genpd_power_off(genpd, 0); + genpd_power_off(genpd, 0, 0); genpd_unlock(genpd); }