From patchwork Wed Jun 20 17:22:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 139391 Delivered-To: patches@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1051084lji; Wed, 20 Jun 2018 10:23:17 -0700 (PDT) X-Received: by 2002:a2e:1414:: with SMTP id u20-v6mr15301097ljd.134.1529515397454; Wed, 20 Jun 2018 10:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515397; cv=none; d=google.com; s=arc-20160816; b=wgOARA1gWgBXJ+4qEIiW5TuhL9Kp8FBzbmJwaVmz3bQngjv/xyCu9/wgNQFqVQcP7V Cvgo3rAaTA9cCEZp41XgyKwCKfP/RPkKPaCdzXVPLTpflorRWsyJP+pCFRcD/HMLQChD zeKSrzjsjFlPrIJ2Iq1WvaltzLYbragNnOT6NN/5LwRmOKxim+WNUeO2fyZ8i1CJ50x8 QHy8nIpdeYzLOv4Q/P+ZtBl5Pd2cZIn7Ajmw3qbhCBjhF/jftB5GLLArUBunGdaNiyxN nh5LB1HzBSiGfijB6sFLhE3YZPC0M4YEyJkPVU1APAUsc2ZwBwAui8tUuduDisO8LeGm NPlA== 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=iMx6h1L2HIsE81Qqf9KTc/HGuq09dzGoe43tExUeSqA=; b=ThBwodVPa1tsv42HlG2U4UXcFvc2sBCL/+b/Px4eCSa67t/8+b8RDjpxONtXWPnCuK vFzlDRPvNIpi48Oqr17SZy9/5Jj84gXqrqKpdn0W54Gj6Oj7DNQwrnBzqYSeuaCICy9F /NuLO+RlNkuA2JIKiH7k59sragTYxZK+j73qJffGp8DfIEus/uZuCd3MzlRXcqWWVdAX vN5uvQ3ZF81IMy6dRmHH4FkRXWus1CHFNGnUkcAXOi2LRqa9ARe5yHqcv5lsHb8QN2NI 7SgWUW3rTQxJ0TyciiRy0xo3qiBnLSmRkB27K2AZCSYgyQACUQvg+xfcqAC6Y5n0lTZg KdKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Lr1SCMsT; 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 x28-v6sor730287ljb.114.2018.06.20.10.23.17 for (Google Transport Security); Wed, 20 Jun 2018 10:23:17 -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=Lr1SCMsT; 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=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=Wky57t/1aF1OlS5Gr5wKZBytFDcZMv/DwpdKkXYqAPtJdF++EIK9jrqgRsFqi6/oMa 6h9rsABvKQIQxhzjtSnXqoEORo4iUr9sAjZefFlN5pKVjthYi68meFVzXWa/KtgLtJqd rLhHbiEcxBpfH+zOKRdxjcvkEvffdUKyJ9drDymxRnFCfGQtxkEFP6j2Gw4sAR9ROAA4 EJ4Vm/dhdz9ZjTHL8H7UP9+rTm00vkoZFFH2UBEFiPMhllIYfmENd1iPP0vEi2GGob/a x0fjEupaxZLJputO1HFRDjhXumkP2SJuw/Zs+0z8lrQQKya6xlEgZoiKdECE7LwV0Iuq 7lXQ== X-Gm-Message-State: APt69E3l+IwSJ+knLMYfJMCh1ELdDi9kSGxr8kbZigjR8Rk125YkGtd+ e941blG/FAY1ztJmu2+9UoY0QMFM X-Google-Smtp-Source: ADUXVKJN7qF1bO1BibAbpbCkbJJtFe10TW1BGESo34tVrvg1dCk+dsk7W0EoG6BuIGK2G2S49aEd3g== X-Received: by 2002:a2e:1d59:: with SMTP id d86-v6mr15376470ljd.104.1529515397265; Wed, 20 Jun 2018 10:23:17 -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 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> 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.17.1 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);