From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Lezcano Subject: Re: [PATCH v10 15/27] drivers: firmware: psci: Announce support for OS initiated suspend mode Date: Thu, 20 Dec 2018 14:11:00 +0100 Message-ID: References: <20181129174700.16585-1-ulf.hansson@linaro.org> <20181129174700.16585-16-ulf.hansson@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <20181129174700.16585-16-ulf.hansson@linaro.org> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Ulf Hansson , "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org On 29/11/2018 18:46, Ulf Hansson wrote: > PSCI firmware v1.0+, supports two different modes for CPU_SUSPEND. The > Platform Coordinated mode, which is the default and mandatory mode, while > support for the OS initiated mode is optional. > > This change introduces initial support for the OS initiated mode, in way > that it adds the related PSCI bits from the spec and prints a message in > the log to inform whether the mode is supported by the PSCI FW. > > Cc: Lina Iyer > Co-developed-by: Lina Iyer > Signed-off-by: Ulf Hansson Reviewed-by: Daniel Lezcano > --- > > Changes in v10: > - None. > > --- > drivers/firmware/psci/psci.c | 21 ++++++++++++++++++++- > include/uapi/linux/psci.h | 5 +++++ > 2 files changed, 25 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c > index 6bfa47cbd174..4f0cbc95e41b 100644 > --- a/drivers/firmware/psci/psci.c > +++ b/drivers/firmware/psci/psci.c > @@ -95,6 +95,11 @@ static inline bool psci_has_ext_power_state(void) > PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; > } > > +static inline bool psci_has_osi_support(void) > +{ > + return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; > +} > + > static inline bool psci_power_state_loses_context(u32 state) > { > const u32 mask = psci_has_ext_power_state() ? > @@ -659,10 +664,24 @@ static int __init psci_0_1_init(struct device_node *np) > return 0; > } > > +static int __init psci_1_0_init(struct device_node *np) > +{ > + int err; > + > + err = psci_0_2_init(np); > + if (err) > + return err; > + > + if (psci_has_osi_support()) > + pr_info("OSI mode supported.\n"); > + > + return 0; > +} > + > static const struct of_device_id psci_of_match[] __initconst = { > { .compatible = "arm,psci", .data = psci_0_1_init}, > { .compatible = "arm,psci-0.2", .data = psci_0_2_init}, > - { .compatible = "arm,psci-1.0", .data = psci_0_2_init}, > + { .compatible = "arm,psci-1.0", .data = psci_1_0_init}, > {}, > }; > > diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h > index b3bcabe380da..581f72085c33 100644 > --- a/include/uapi/linux/psci.h > +++ b/include/uapi/linux/psci.h > @@ -49,6 +49,7 @@ > > #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) > #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) > +#define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) > > #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) > > @@ -97,6 +98,10 @@ > #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ > (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) > > +#define PSCI_1_0_OS_INITIATED BIT(0) > +#define PSCI_1_0_SUSPEND_MODE_PC 0 > +#define PSCI_1_0_SUSPEND_MODE_OSI 1 > + > /* PSCI return values (inclusive of all PSCI versions) */ > #define PSCI_RET_SUCCESS 0 > #define PSCI_RET_NOT_SUPPORTED -1 > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog