From patchwork Wed Nov 27 10:29:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 180292 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp5916345ilf; Wed, 27 Nov 2019 02:31:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyh087uv3pUWBozvmJwUnyDM/G2PDKIzPMwHYMmIqIUd2891kqaSnOVojR4GjGuKl36joBf X-Received: by 2002:a50:ee96:: with SMTP id f22mr30584026edr.86.1574850577279; Wed, 27 Nov 2019 02:29:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574850577; cv=none; d=google.com; s=arc-20160816; b=B3ugQ8V01UiPqxK/F8zmh+IA7XYzwVJLI/LIN+mCHKCfHRmSyTbkxmQ1rsx38OGM+Z XW/rLzr1rr8XDB9taGHXjHRDGn5dDoZF6iEc+p/Ti7vhbBe0h3dZT46ZPNiV4gOF6sR6 QbTXkl4ix5QOzF1Pqiq2HVQKRn70rNCPJ7e5e94n6u/Rj0u7WYngWyCu45XJr0V6MW7m xBpaO3c92BlP0zLWbr1zDxkSWTYpX0sVxXB/6AWOG1bVNhBqLiqxKC6B4Lhv8/0fJ7lM j1bmYPS03Po5d/c7Fqj3oy1EHDM24QPWkOyOZi/ngjx9DoXQUMotC9QfZ8s0O0hs9nYg AN9w== 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=9WNvBkAbCPmItbuJwau3VVcwaQ3svcRnmaumQExcBPY=; b=xlsxfgAUOFvkZeqbbBtWXOIbaZDlD3whSAArnLR8KfrjFiMgeBKpJTvy9mswPszeae 1md1OmN+yBT93I/bonM2rAYjUTuP9ksepeVl3EClE4l1SPKbZKx49Gi/iqPTCPOTrQMZ Ax/9F1Jg0cFV+cyi02pPKKP7IjI/WVVThT5jOVp3kNzBT/gRyDZkt++XNQPa9oLp4dlh KNP6oNQUtbe9BPoQluQwGCZavaDm375hq3MoHBMLA9XK1AWR27WgUVv2ToEJU/kKNtFS Tstv4oCzYllntjjfeaPfLLzX62G4nabNkHLYMVe9xGm3+jV3Ew1a2BwURVTKw/5PppT+ rGTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LVyx7O2W; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 p24si8751899eja.385.2019.11.27.02.29.37; Wed, 27 Nov 2019 02:29:37 -0800 (PST) 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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LVyx7O2W; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1727120AbfK0K3g (ORCPT + 10 others); Wed, 27 Nov 2019 05:29:36 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36506 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727142AbfK0K3g (ORCPT ); Wed, 27 Nov 2019 05:29:36 -0500 Received: by mail-lf1-f68.google.com with SMTP id f16so16727474lfm.3 for ; Wed, 27 Nov 2019 02:29:34 -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=9WNvBkAbCPmItbuJwau3VVcwaQ3svcRnmaumQExcBPY=; b=LVyx7O2W4qGw1a4q/S1Yriak16eQr191zdaPkA2t1RAdn2hi6FFOjti6ZrYVNL10DX RJ+WW95uhdNfmuZRig1tBSv/JMjWpg2BvY9fHYN5vuR/Ns4VGoBlNzrmJacvs5mWJtWX gaSvfQ7eTU8Q1nxVVjkpaWtZIcfi/GE6HURMotCbiwX00oXBD158f9x+TVIgJ/3ZH7/h xZxZiv+9oQiDI8L2bE5YSYH0cmDP9/6phxaCR2dA3EjHx3DBO93b+vMkfbgzGN/mhSgG 1oXq4QU9PiRHlmui545BrHmoZKkPIC/CMAAQ5rX9b+o1nys9wnH9b+OaoOBTod0wJMSx SXwQ== 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=9WNvBkAbCPmItbuJwau3VVcwaQ3svcRnmaumQExcBPY=; b=imC0takUQsGLP9kThFsTXEWLLarFhGvhSsj0+GxF04VIA6g43td+11P/yi35cscp61 onNhK4kLt8DuBLVd3lTSpNwBkXTHdKW99H3G1RbzvJWQJcU6fGyywANiGK5wbmnFrF03 2o6vFiyzo6W2aTwji2Ke4tfOqP0Ra0jjdcHnA6QrCn60wCht2IX74JzHoAM/G4yljmY5 PmeOb8CGUk1jIchabZwBGWZUSAz3wK6HHuNac1lgP07GCblsWAtl/TpMwnoM7xEVvP5b LW1z42xYEDK6TsPKJGhnnfyRJN34tr/GyhZ+D7ualPtISRW7GLqyiQD/nnDefz57f6HG Ldjw== X-Gm-Message-State: APjAAAVVbDInToIUPEGZZXj0WivL3ITbyJRoFbm1Ym4fXj1CqUyYAY2P BPy+/pOVCcg+TGytIcO88XHO8Q== X-Received: by 2002:a19:9149:: with SMTP id y9mr29230817lfj.15.1574850573630; Wed, 27 Nov 2019 02:29:33 -0800 (PST) Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t9sm6868260ljj.19.2019.11.27.02.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 02:29:32 -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 v3 11/13] cpuidle: psci: Manage runtime PM in the idle path Date: Wed, 27 Nov 2019 11:29:12 +0100 Message-Id: <20191127102914.18729-12-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191127102914.18729-1-ulf.hansson@linaro.org> References: <20191127102914.18729-1-ulf.hansson@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 v3: - Rebased. --- drivers/cpuidle/cpuidle-psci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index fd664e134c3f..0707222a40bd 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;