Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1011162imu; Thu, 20 Dec 2018 08:42:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/XJhPBWTxNf8YytPvkCTHgz3+fnq+LoGfHj/Dp4rfFGI4pF7QjDZJmeDEhECmYzl2JucbeU X-Received: by 2002:a17:902:96a:: with SMTP id 97mr23988294plm.45.1545324172615; Thu, 20 Dec 2018 08:42:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545324172; cv=none; d=google.com; s=arc-20160816; b=xwPWRQBv+XDo1SNqWhy7hUP6uPXP3em45YqVtUrPy+MgEGPiEecDx4oUtdTn8VftAc jjQN0oZ7E87UiSU/J+t1AUaZz7duqx/TPmYznFi7b3xhwKajlHNoyh4mmspm/I9vJcvJ WdYfeXfoSJGK0LqkLElupV9Qc2W31xc6O/msPgfI42fm4QrrsSClpAqFLrvgT9hc6cpw B0Qu7rl7KdA0i4Nj2FwH2lCC5e9o53AvQUgl4Htq+KTihcxpHx4cUPRfb3n5WApjGzdg nYf0D4M6JIT8PpMrFnzJPjAEGTCeNJbfJtde8EOdCpEMUslVBxHGHGzrhgLgF9gi5fBr N34A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Qn72qtavczvyDQK9+bypOLwn0vE7TYTvQ62AhlWVQvc=; b=DXldD/Vfpusozf21r2VQp2thQ2VKNhyEhzOI9v0U/pbCvCg43/bBnDN7+kKXIkSIrx VGw6wERSdvTOQkUK10STAlrRzwdRz0MN4UQ+/uHAbxaezsOgd2Qj+vChZ9ajjv48zpEc i52BNczFBsZtJPRRWFbz7See0q59S49P1Il8GOpynPqCpjLPGxFV6kdlXdLwnOQJ9mh1 2fTO0tv6FFsGJV4IxA7wwYne/kQ8F2tVGRFiivU66BHz8IS0smpXZ+ogu5tWi4Anna6X xfr17bfDVLCxYbm0L+sU93AdVrLNg4tvqjFaAvDC/P9A8+ZXPwHFFdpbA4wSI5wQnDc0 w2iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c93U3Jyx; 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 v5si18655938pgg.1.2018.12.20.08.42.33; Thu, 20 Dec 2018 08:42:52 -0800 (PST) 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=c93U3Jyx; 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 S1731875AbeLTPtt (ORCPT + 99 others); Thu, 20 Dec 2018 10:49:49 -0500 Received: from mail-vs1-f66.google.com ([209.85.217.66]:38636 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731827AbeLTPts (ORCPT ); Thu, 20 Dec 2018 10:49:48 -0500 Received: by mail-vs1-f66.google.com with SMTP id x64so1357720vsa.5 for ; Thu, 20 Dec 2018 07:49:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Qn72qtavczvyDQK9+bypOLwn0vE7TYTvQ62AhlWVQvc=; b=c93U3JyxU7xHglhNXDNeXprXo6AnSMsYOYtv0bAJBQYaG/VFNHKiSoh3sjn5+4EIok BsWcGL3OAaiRmdepRf3pLtbpU/MyRxY+e9CW10GFIT3euZGvyafmJ2CwrGITnes/vCii hHBBU11S/aM8xzbF6ZSfauHf0vFO6wijkdxpE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Qn72qtavczvyDQK9+bypOLwn0vE7TYTvQ62AhlWVQvc=; b=UWoQWLryzPgtRhaJQ0UaDsolxlDFysaxRNg1fRAaS8IfeiI45lHpa58zuERPHXxGSP aivNLllbTZPjbDDXkbOgFD0Ckeqod/l3R0IMmN8Z05ZvrEonOqNVNu8bk7CP2DiVzbsD d42uePeQ2dPuwvI/jWyP+js65VScyUSJwlQeaqgRK6YVZaTPArCNpvo/IexZjWhPPRnB FoQfMLXrwzeNfko9ssfYdMslHhrzFU2PgASeUw2vw3E+6NNAekKhjpwrYjlzTHSQBcS1 3irbzANBZn31JA9B5DnX9DK/+jOsDmYszoRVwF84Z+3nxiOaiQJcdg+VhMidrYA69fHc GkUQ== X-Gm-Message-State: AA+aEWbO1fCNbk9DxD0p00xLaXo9Y/2OY4V5q/qAR2S2YvqAfD6ilVuU tygYID2AgdH6QWsMa0ZXQ9l3zfn6c5KyicI3oDvNfQ== X-Received: by 2002:a67:7685:: with SMTP id r127mr12276554vsc.35.1545320986457; Thu, 20 Dec 2018 07:49:46 -0800 (PST) MIME-Version: 1.0 References: <20181129174700.16585-1-ulf.hansson@linaro.org> <20181129174700.16585-18-ulf.hansson@linaro.org> In-Reply-To: From: Ulf Hansson Date: Thu, 20 Dec 2018 16:49:09 +0100 Message-ID: Subject: Re: [PATCH v10 17/27] drivers: firmware: psci: Prepare to support PM domains To: Daniel Lezcano Cc: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Linux PM , "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , Linux ARM , linux-arm-msm , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Dec 2018 at 15:19, Daniel Lezcano wrote: > > On 29/11/2018 18:46, Ulf Hansson wrote: > > Following changes are about to implement support for PM domains to PSCI. > > Those changes are mainly going to be implemented in a new separate file, > > hence a couple of the internal PSCI functions needs to be shared to be > > accessible. So, let's do that via adding new PSCI header file. > > > > Moreover, the changes deploying support for PM domains, needs to be able to > > switch the PSCI FW into the OS initiated mode. For that reason, let's add a > > new function that deals with this and share it via the new PSCI header > > file. > > > > Signed-off-by: Ulf Hansson > > --- > > > > Changes in v10: > > - New patch. Re-places the earlier patch: "drivers: firmware: psci: > > Share a few internal PSCI functions". > > > > --- > > drivers/firmware/psci/psci.c | 28 +++++++++++++++++++++------- > > drivers/firmware/psci/psci.h | 14 ++++++++++++++ > > 2 files changed, 35 insertions(+), 7 deletions(-) > > create mode 100644 drivers/firmware/psci/psci.h > > > > diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c > > index 8dbcdecc2ae4..623591b541a4 100644 > > --- a/drivers/firmware/psci/psci.c > > +++ b/drivers/firmware/psci/psci.c > > @@ -34,6 +34,8 @@ > > #include > > #include > > > > +#include "psci.h" > > + > > /* > > * While a 64-bit OS can make calls with SMC32 calling conventions, for some > > * calls it is necessary to use SMC64 to pass or return 64-bit values. > > @@ -90,23 +92,35 @@ static u32 psci_function_id[PSCI_FN_MAX]; > > static DEFINE_PER_CPU(u32, domain_state); > > static u32 psci_cpu_suspend_feature; > > > > -static inline u32 psci_get_domain_state(void) > > +u32 psci_get_domain_state(void) > > { > > return __this_cpu_read(domain_state); > > } > > > > -static inline void psci_set_domain_state(u32 state) > > +void psci_set_domain_state(u32 state) > > { > > __this_cpu_write(domain_state, state); > > } > > > > +bool psci_set_osi_mode(void) > > +{ > > + int ret; > > + > > + ret = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE, > > + PSCI_1_0_SUSPEND_MODE_OSI, 0, 0); > > + if (ret) > > + pr_warn("failed to enable OSI mode: %d\n", ret); > > + > > + return !ret; > > +} > > Please keep the convention with the error code (0 => success) > > In the next patch it can be called: > > if (psci_has_osi_support()) > osi_mode_enabled = psci_set_osi_mode() ? false : true; > Sure! > > + > > static inline bool psci_has_ext_power_state(void) > > { > > return psci_cpu_suspend_feature & > > PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; > > } > > > > -static inline bool psci_has_osi_support(void) > > +bool psci_has_osi_support(void) > > { > > return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; > > } > > @@ -285,10 +299,7 @@ static int __init psci_features(u32 psci_func_id) > > psci_func_id, 0, 0); > > } > > > > -#ifdef CONFIG_CPU_IDLE > > -static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state); > > - > > -static int psci_dt_parse_state_node(struct device_node *np, u32 *state) > > +int psci_dt_parse_state_node(struct device_node *np, u32 *state) > > { > > int err = of_property_read_u32(np, "arm,psci-suspend-param", state); > > > > @@ -305,6 +316,9 @@ static int psci_dt_parse_state_node(struct device_node *np, u32 *state) > > return 0; > > } > > > > +#ifdef CONFIG_CPU_IDLE > > It would be nicer if you can remove the CONFIG_CPU_IDLE by replacing it > with a specific one (eg. CONFIG_PSCI_IDLE) and make it depend on > CONFIG_CPU_IDLE, so the config options stay contained in their > respective subsystems directory. I am all for simplifying the Kconfig options in here, as indeed it's rather messy. However, I would rather avoid folding in additional cleanup changes to this series, is already extensive enough. Would you be okay if we deal with that on top? [...] Kind regards Uffe