Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1033758imm; Wed, 20 Jun 2018 10:26:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI0vsDp+ioaS5ADG0k6694VD3Mr0mF/V6ans3r9tUjxukMZe+dm7ZEDbf4BkIQu26xGWHPH X-Received: by 2002:a63:6dc3:: with SMTP id i186-v6mr19940520pgc.316.1529515586301; Wed, 20 Jun 2018 10:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515586; cv=none; d=google.com; s=arc-20160816; b=srv5BURg+jkTnezqTevgGPzcq6Yz1RdorAEsXDAIgkzW5i7O2RSPw88HfvisP5RAAb /ej4rYJC9+HL5D5D1+gmX5Y+eKpqNJB+EVEf+QSwjvQa73Qr6n+uXFL3ye3RnGfzjNwz VAZU4pyw17Mr1D2GLtfMzh3LMyQni9jaUPnEpuOPHjBYzETTWnYwfgLa+Wk1gm2clWr3 tsSaoQ/YsxJcL7Tzi9zEaYJMFaqRINnLoNyvX/5IoeV27VGuVXs8qCcaOZsQAIgv2UmV vctOBP34MilmU+rKO5+WB5f0sF+I+CuIbIK1+yMuvSpa6hTIYNXoM3jOtvtdPjGbha4O KHyA== 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=iMx6h1L2HIsE81Qqf9KTc/HGuq09dzGoe43tExUeSqA=; b=eFUoc9fvIoX77TP3AYR7Oi9iRJm+iy517kUilLk1zZyil8EgzBb00OpnMaKnXJy5v4 IZtxd8MGtYvhyskYg5ELJdcvT/Yxa1uX/raugEF6P3xyL4bRP5PQmUcENV4oWgwjuw6Q G8dzfIkv3+CScxm7B2AAcHB367T5+GfnZtwBGzC39S1s773mWtsU+nkb6A11Wn2cESWQ qDMBNIbPiPhzA1lZJw31tEHo6G6gNVB45jTZju5+WiCVjAZa/N8j3jE0TrzewkOgxgcO I/YlvKrwzP1L9BIhpxndH10M3L+kcHhEDFABiXWrdJ1/qiI32HshnlmQ78ZvioGrSOvT 3CbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lr1SCMsT; 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 k5-v6si2180157pgn.258.2018.06.20.10.26.11; Wed, 20 Jun 2018 10:26:26 -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=Lr1SCMsT; 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 S932922AbeFTRXV (ORCPT + 99 others); Wed, 20 Jun 2018 13:23:21 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:41757 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932827AbeFTRXS (ORCPT ); Wed, 20 Jun 2018 13:23:18 -0400 Received: by mail-lf0-f65.google.com with SMTP id d24-v6so464367lfa.8 for ; Wed, 20 Jun 2018 10:23:17 -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=iMx6h1L2HIsE81Qqf9KTc/HGuq09dzGoe43tExUeSqA=; b=Lr1SCMsT8ul9gy3ZiZNlhP2+8AuWwFud0Q1JuVsoxiCkAjBT3/MVx41++wpXHYtrzt pIJuCC7YYAu1tt6OvJvaQR5TtdEdmaXw5ancZ1EQj+e15c59a9rvW635+5u8WDX4HYej oTmXppj0RJifVpThU5DPigCvFbvwigZjpnYxo= 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=iMx6h1L2HIsE81Qqf9KTc/HGuq09dzGoe43tExUeSqA=; b=RoX9XK/UaOA200M8P+JXUus7vsW0/Q5HO+yisoWINcO8b5ETj9nteThv4k2Z+pfz/u DZa18hiG+y0ce2AuEn0gdJrjhys5oIX+0/rmeQ1Xtjq5WQ4yGrXicmsMDP1KgRdjeCis MM1HoazEoy/EKe0qelzEeLem1rD/RHLDD3eIFTyr18nY1OWYJ1GPyLi7hZcWM3XF72sf rwYMFuEJFXqRC66i/54muDkYEf+uZdkCrhFG50zYJRjQVMzth7m5N02LFnWD7oTZcdHV Vx3dNDdPvbgUDpUz4EaiOo3BUWu2fF9RXbdz4J2mLRDU4NNJH2/kooa2S+y7Y9WvCfPM 2vSQ== X-Gm-Message-State: APt69E25KvPVD7Q7venqGrAVTBmRYY6tTLscrxR8gpoZYSfUpS73diIR w/Ofeq69soeUq4yNBj5zINerbw== X-Received: by 2002:a2e:1d59:: with SMTP id d86-v6mr15376470ljd.104.1529515397265; Wed, 20 Jun 2018 10:23:17 -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 b2-v6sm514441lji.85.2018.06.20.10.23.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:23:16 -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 v8 23/26] drivers: firmware: psci: Try to attach CPU devices to their PM domains Date: Wed, 20 Jun 2018 19:22:23 +0200 Message-Id: <20180620172226.15012-24-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620172226.15012-1-ulf.hansson@linaro.org> References: <20180620172226.15012-1-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 80c286d83369..700e0e995871 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.17.1