Received: by 10.192.165.156 with SMTP id m28csp1827415imm; Thu, 12 Apr 2018 04:19:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx49hjdsJYnsAtmOIDuuoobQFD44o2VNtizh6EAKpcZDv5LT0RT2d/6yuyVYj/CT6AcHJeFS8 X-Received: by 2002:a17:902:b903:: with SMTP id bf3-v6mr574410plb.37.1523531975951; Thu, 12 Apr 2018 04:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523531975; cv=none; d=google.com; s=arc-20160816; b=KYdL0CselhCUlzT4YLbVH2+75d44JDSszw1r17KlnEv8AAQdOEQNKPzePLz1FSFQAX c+TDo3okn+vIv0YRMg074yGrLs03z+zG1Rg8KbuV7rJ7Mz+MBBFiPvRr7iYk15QiSSGN SpN4W0JautH8XuUKY1UA5abHQWWcJPJYwRGIKhGRKUfxW+FZ44aP0Rfin0aIbaKQK89b 216TMIivIj8qwZ1CszH9UyesvhcvxipaPIE8B8C1z81Y1QRJcYdrD+4e+HTBiaCuA7AY 4JyfCmLUjQoukH96HJE8k1prz/mqwAor4c3GZzHHutBvn/vGc/2U1cDfBh6XomiW6cgW yFkA== 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:arc-authentication-results; bh=/gTZrll8xrDqP3b3gZj5ZKm+3pAu9Ck4XPU4WG+9or8=; b=JhYTpz71aJYtjSB7hMTbgEsqq0F3m3g4C2AbSmc6t8y1vLRYHnCO2gU6oj194U2B+M 3SNPZMFdexwGGSS2Lsrh35h2vtsOMvQmWVLMCo67gVrFdQ1xtXdjLXh3IH5oNoPEKs+B HzfEsKzOQ03D8O4tflH33p+f5GMagg9Pw0TKHTGopvbqFh5JILVvesPr5GjPhhWHRC7e nmNzPewgSanXTnRkiVbLcIpb01GbQdjQkIeR9ffa1iOnjx+/DckVzfACn0NLH4plrSwb CUpDqZJQd/h2UwGdFJ1vrZZgVTTZ3uZ0lSjzwbCjaFLdyvdRcMK6yz3koZ4uZ4VkyO48 PcWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f1G401pn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 b15si2093697pgs.393.2018.04.12.04.18.58; Thu, 12 Apr 2018 04:19:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=f1G401pn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1753326AbeDLLP0 (ORCPT + 99 others); Thu, 12 Apr 2018 07:15:26 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:45749 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753273AbeDLLPU (ORCPT ); Thu, 12 Apr 2018 07:15:20 -0400 Received: by mail-lf0-f67.google.com with SMTP id q5-v6so7098679lff.12 for ; Thu, 12 Apr 2018 04:15:19 -0700 (PDT) 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=/gTZrll8xrDqP3b3gZj5ZKm+3pAu9Ck4XPU4WG+9or8=; b=f1G401pncmeFYFtKQuzH8K8t05naTjxSVaBI9Fj8ifS6XLsschLFT65k8Hx4DUYXiJ D1V/3Uv0rU3Vm5VCCxttYmNYr6U7uT1VsKgbPBwpQAOraI6wTi759C+IGpTWhz+yW0i3 dyHaLus68gao6VOQzWgSL3TQ8riNSpVzuNmfw= 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=/gTZrll8xrDqP3b3gZj5ZKm+3pAu9Ck4XPU4WG+9or8=; b=jkYMHKIYf9s4Vyj9ruHCbBuFeQZUQ+OtPMe5nK3DzGezAlW6PhDnU3Tgp/h4T33dOI 4XMbXV5Mt66avgvDOLPTWZ2mJiqwEH3/d2ziPefES0Fhk9eSgNWcQSal2sTAW8ak4yg/ PC10pRRbYz8Qt+5sbRn5leaLuNwcRflj4Z1BySfAaK/r4dET1O3WZQ7NPQIymcfPB9mQ 0w+OlhNSh+61cxUJXz762j0a5RaQXpXMSkTeOVXcqqvjVijhGO8XaxDqFjqb4aZyCxpb 2YT+D23Wogn2z2EyyCTsIBNnIubePlD5DCF6ryyw7duDClcJvog3qZ+XoM38WpGawLOe r03g== X-Gm-Message-State: ALQs6tCjr6a0CoRjicYH4YaYR5kvOC/pqkisEamrc0YfBmKjQ8jO2kKE MHhOUBLQUZWi6XNGF6keepfHsg== X-Received: by 2002:a19:4b43:: with SMTP id y64-v6mr5413798lfa.11.1523531718944; Thu, 12 Apr 2018 04:15:18 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id r29sm543187lje.72.2018.04.12.04.15.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Apr 2018 04:15:18 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 23/26] drivers: firmware: psci: Try to attach CPU devices to their PM domains Date: Thu, 12 Apr 2018 13:14:28 +0200 Message-Id: <1523531671-27491-24-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> References: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case the OS initiated CPU suspend mode have been enabled, the PM domain topology for CPUs have earlier been created by PSCI. Let's use this information in psci_dt_cpu_init_idle() as a condition for when it makes sense to try to attach the CPU to its corresponding PM domain, via calling of_genpd_attach_cpu(). If the CPU is attached successfully to its PM domain, idle management is now fully prepared to be controlled through runtime PM for the CPU. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/firmware/psci/psci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 80c286d..700e0e9 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,7 @@ static u32 psci_function_id[PSCI_FN_MAX]; static DEFINE_PER_CPU(u32, domain_state); static u32 psci_cpu_suspend_feature; +static bool psci_osi_mode_enabled; u32 psci_get_domain_state(void) { @@ -339,6 +341,14 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) /* Idle states parsed correctly, initialize per-cpu pointer */ per_cpu(psci_power_state, cpu) = psci_states; + + /* If running OSI mode, attach the CPU device to its PM domain. */ + if (psci_osi_mode_enabled) { + ret = of_genpd_attach_cpu(cpu); + if (ret) + goto free_mem; + } + return 0; free_mem: @@ -753,6 +763,7 @@ int __init psci_dt_topology_init(void) goto out; } + psci_osi_mode_enabled = true; pr_info("OSI mode enabled.\n"); out: of_node_put(np); -- 2.7.4