From patchwork Thu Apr 12 11:14:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 133261 Delivered-To: patches@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1573997ljb; Thu, 12 Apr 2018 04:15:19 -0700 (PDT) X-Received: by 10.46.158.199 with SMTP id h7mr381116ljk.103.1523531719195; Thu, 12 Apr 2018 04:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523531719; cv=none; d=google.com; s=arc-20160816; b=wPPyavgC/jlChOD8dS/Tua8Zc/lc/YLBW02fvfOR+xFl6XEjInvRrY0KehVTMZb+6F Gre9RKOG1iuTCgc5b+rYyYoq6N7czIkiayL1jJ27zNgeFi2HscYzzY+O+30gC3dn8wNf iIILAVVrBttboUR4hGYyVFfDrs4kIWbCLBeCOmwN/gVj23I3X8tgVn56vTyPdvgm0Al3 j8LIvyoUOIU2j9I9ernj3ww+4GpgrBb1E9llAv0G5OtzrdODn5xvZ+wWqu4Pw3ZAWWEp andi1cH3eJSLyUVwHDw68xdN+CZAkAPTrCAribGeaXQRSItiATUAXIhUgpYGrM2XczSz My+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=/gTZrll8xrDqP3b3gZj5ZKm+3pAu9Ck4XPU4WG+9or8=; b=kcuHI5CIGbPzCWMBy9amqqmaEl133dhppENWo6UalLv16LPk7AKExw4J6RW/p4BPQw ARrTRS06Wr8+gB6FZPEVBAFStSGQm87g+vQfO3pSs3e3B/ecnMSnJrTRWd0BaZeryENe dbGafohnTZwbH8VjfFlkIvROyeDH8riex6L+r0KpFr/8zLQB/kLtoHXO3J4h1VdoMeVx 4iwjV+Flo0zRYynrWNU4ltVgmczCvPqO6M8+N+3zvqCMC9aTbbFo1q8TARJJUgSRegDe Mx8V4NxPinhnbGP4NHasYpst4KPSv500UELO6fPI93Zxk729h3JsGWO/4fc/KgGYTViL kTbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f1G401pn; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h2-v6sor901104lfl.99.2018.04.12.04.15.19 for (Google Transport Security); Thu, 12 Apr 2018 04:15:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f1G401pn; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=rzAs1mpXH1rfFnSMx5PKuR7RXygO+7fGXkr9+wpY+hOtUtV9s+bRiv0EKf7b3utDqi 1kxjiNg3RTwpE8Vic8cgamYkPLV+worYh/oeOfk775xep+o35X7NIyH18oa8Uw80Z3NB oNXFLCVbTYvLWKm4i9UXuxiFPx9xRw0FgCNErtI42r2DN3Cu38mazSICmh38AgzZq66+ cLoA1bq8VOcFHpvOaTyEkUpK++kMGPf1F9j8VFYkKs+kr/Aes/bZXHC6OdbvRmHWTXgW eoVtU+G7xUgjUuLbgO8CCnCAcBwhXnd41v9QeC9iyqipl4OR+bKFxqDKMREeXH6ujxSV NsfQ== X-Gm-Message-State: ALQs6tCmhXEsDdSAilqfJcltfcxil0yV0+7uPRdMGWc8d7UbR25/MfaU 9VChGiBn/U/kViB4qgu9VIcRZyb9 X-Google-Smtp-Source: AIpwx4/uTTN5AvO/Hwr//Fa5h2ts6SpaXnnQR+qdf1ZCqoguXw4aahiYj9568CGl3R9FgJFTfFXQyg== X-Received: by 2002:a19:4b43:: with SMTP id y64-v6mr5413798lfa.11.1523531718944; Thu, 12 Apr 2018 04:15:18 -0700 (PDT) Return-Path: 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> 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(+) -- 2.7.4 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);