From patchwork Wed Dec 11 15:43:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 181278 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp703825ile; Wed, 11 Dec 2019 07:45:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxG9ysfnTPx/ygAla2BhC1ETMfVNvv9NHC0fkiLQmjrPH1WzP5zAf/juAEUiYM8hmYWWu6d X-Received: by 2002:aca:b346:: with SMTP id c67mr2734738oif.17.1576079056531; Wed, 11 Dec 2019 07:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576079056; cv=none; d=google.com; s=arc-20160816; b=gWKMFgKu0cm9JZm1XkrbJFpyOiWwoLOpne/76Fe07shy+3K61O3kJRNIYJF/WPENm3 hrc5HPm/Emq0Er9+vxf+KVOB69KB0KP3FAqb7Y7Ht8xM0hdF/G0Dbzi7RMiqmCKIW8gq uPfB7KxseW+/Zku3fX79gcxw5B0VsBOGX0J8ej8ax4RXHBudl7XCm3oyWXE6ekTgQesn KG7hFCxi9hdBNvlaVStmJ/LuSbQW1A5kbYWq8OpltGIeNmjzpiuLhuKqUDkEjPCI6NBS ah3fGDDh42Fi8aXuCwRlPSkawJbT338wFRB9hFAsnX8FYYhHp4UwtgkZXDG4Cg0ZEFSu Pouw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=r0T/EqYWBtflCGTq6mIMCsH8miOWB9TkKYLC0qt4riw=; b=BgRAXYviGA9jvI05mfGtk5Cdrpz/IfCi+WHbc0L99WIYcz+PXcYeMOxJHEwjC/fhQc N5AvlL3wOLWOnQSRKNlqkoE6ZCmCNeSfK1hskKIIEw0hOCxqOH04deSM3qgsXxbioL51 qsbkyQP3Fkc8HyvpZkLlIVxBs6v45z/0r/nDMj4CKtx8msjBKMjHXFVW/9GluOjaFjc/ KZ+zOyjhPJssYsi7gtIk+kZKUcsrq1hmqjn4K+Sv28wNw+jfGNBXu2TwEkIAmjhQjOJH 0tHhmqbXixOdyg+XgqSbEIcpJFNGrcN6N7P/aXeLU9BofY3BdGaJ3px93w4OgYS+Z75N b5vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="csmtam/S"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o23si1409002oie.146.2019.12.11.07.44.16; Wed, 11 Dec 2019 07:44:16 -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=pass header.i=@linaro.org header.s=google header.b="csmtam/S"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388417AbfLKPoN (ORCPT + 15 others); Wed, 11 Dec 2019 10:44:13 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:33555 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387474AbfLKPoM (ORCPT ); Wed, 11 Dec 2019 10:44:12 -0500 Received: by mail-lf1-f66.google.com with SMTP id n25so17120978lfl.0 for ; Wed, 11 Dec 2019 07:44: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=r0T/EqYWBtflCGTq6mIMCsH8miOWB9TkKYLC0qt4riw=; b=csmtam/SiKcgswiwzehs2UqYPsYUd6V90h51/HbH4XWJjcqs1r1E/s1eSNFY7TV2QF VuLfcccAUO5CLeDup/dWo/mK3qDtyOYfqw8v36X2BZVRhAWoGzA01YLphklYA/xd8wIY +yvsBmjuXVPeLG3Tp5sP8TVqWVDA0xmJ17VP0KWwDdL/gydysGuwPc1ytoolSALiPmN8 F7ENETnujKlFDv9J8XyMAGYsOc79CQfgaVpcX8Dj8e5WaoF1O5pz7ZTu+63xruymwcbS QBNG4HCIgPqfklO2UJIhOQ08uM29v0Re0uU9c6byBZYV+FQEzX5JddcEC1YgiYcHRx8s 1Jrg== 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=r0T/EqYWBtflCGTq6mIMCsH8miOWB9TkKYLC0qt4riw=; b=F2ooSbpr9FaFqZ8V39Z1MXicFnkBpt5pgkgwM2k77aPcomrxfmR5r4ipvubWJJM02e 00gVUklyANeYkhcf7s7Y7Au9NM3h71l252DSPxSTuCDGsVsrHwMdPvnISKikxlXtPMIp 7s+ZHBAHrAFF5CrHALn2YxqYburZFGxlvEn5eAXyx4Aqa789FoYtAwnyUnkQCNuLegRd vNvsLTl/BMctGg5l2I1M7xQeScNDyuZRZyiqEM/+MgWrqXSX+WOqGzDPTfRXRIUUdXRZ AbM24fUh6eKRDkUwR/ChnQC3XBUm4NfIRFHFSVW127CDznzosJagpd44OCfa/NpT3nFD W2Dw== X-Gm-Message-State: APjAAAXEnsBt1R/APuu7CN4ExpShPxugT3V1EfKrPE44qwZ1g/0k2v3o aw+mie9PuDiOAx0O98F1prWslg== X-Received: by 2002:a19:c0b:: with SMTP id 11mr2684337lfm.135.1576079050137; Wed, 11 Dec 2019 07:44:10 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b14sm1389608lff.68.2019.12.11.07.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 07:44:09 -0800 (PST) From: Ulf Hansson To: Sudeep Holla , Lorenzo Pieralisi , Rob Herring , linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Daniel Lezcano , Mark Rutland , Lina Iyer , Vincent Guittot , Stephen Boyd , Andy Gross , Bjorn Andersson , Kevin Hilman , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v4 11/14] cpuidle: psci: Manage runtime PM in the idle path Date: Wed, 11 Dec 2019 16:43:40 +0100 Message-Id: <20191211154343.29765-12-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211154343.29765-1-ulf.hansson@linaro.org> References: <20191211154343.29765-1-ulf.hansson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In case we have succeeded to attach a CPU to its PM domain, let's deploy runtime PM support for the corresponding attached device, to allow the CPU to be powered-managed accordingly. The triggering point for when runtime PM reference counting should be done, has been selected to the deepest idle state for the CPU. However, from the hierarchical point view, there may be good reasons to do runtime PM reference counting even on shallower idle states, but at this point this isn't supported, mainly due to limitations set by the generic PM domain. Signed-off-by: Ulf Hansson --- Changes in v4: - None. --- drivers/cpuidle/cpuidle-psci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Sudeep Holla diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index 9600fe674a89..6e7804e697ed 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -51,14 +52,21 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, { struct psci_cpuidle_data *data = this_cpu_ptr(&psci_cpuidle_data); u32 *states = data->psci_states; - u32 state = psci_get_domain_state(); + struct device *pd_dev = data->dev; + u32 state; int ret; + /* Do runtime PM to manage a hierarchical CPU toplogy. */ + pm_runtime_put_sync_suspend(pd_dev); + + state = psci_get_domain_state(); if (!state) state = states[idx]; ret = psci_enter_state(idx, state); + pm_runtime_get_sync(pd_dev); + /* Clear the domain state to start fresh when back from idle. */ psci_set_domain_state(0); return ret;