From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F66C2BCA1 for ; Fri, 7 Jun 2019 15:21:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A87F6208C3 for ; Fri, 7 Jun 2019 15:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729456AbfFGPVU (ORCPT ); Fri, 7 Jun 2019 11:21:20 -0400 Received: from foss.arm.com ([217.140.110.172]:42562 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728665AbfFGPVU (ORCPT ); Fri, 7 Jun 2019 11:21:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 99207337; Fri, 7 Jun 2019 08:21:19 -0700 (PDT) Received: from e107155-lin (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E9EEB3F718; Fri, 7 Jun 2019 08:21:16 -0700 (PDT) Date: Fri, 7 Jun 2019 16:21:14 +0100 From: Sudeep Holla To: Ulf Hansson Cc: Lorenzo Pieralisi , Mark Rutland , linux-arm-kernel@lists.infradead.org, "Rafael J . Wysocki" , Daniel Lezcano , "Raju P . L . S . S . S . N" , Amit Kucheria , Bjorn Andersson , Stephen Boyd , Niklas Cassel , Tony Lindgren , Kevin Hilman , Lina Iyer , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , Sudeep Holla , Souvik Chakravarty , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/18] drivers: firmware: psci: Prepare to support PM domains Message-ID: <20190607152114.GG15577@e107155-lin> References: <20190513192300.653-1-ulf.hansson@linaro.org> <20190513192300.653-9-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190513192300.653-9-ulf.hansson@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Mon, May 13, 2019 at 09:22:50PM +0200, Ulf Hansson wrote: > Subsequent changes implements support for PM domains to PSCI. Those changes > are mainly implemented in a new separate c-file, hence a couple of the > internal PSCI functions needs to be shared to be accessible. Let's do that > via adding a new PSCI header file. > > Moreover, to implement support for PM domains, switching the PSCI FW into > the OS initiated mode is sometimes needed. Therefore, let's share a new > function that implement this. > This looks fine. -- Regards, Sudeep > Signed-off-by: Ulf Hansson > --- > > Changes: > - Convert psci_set_osi_mode() to return an int. > - Don't share psci_get_domain_state() as that's no longer needed. > - Update changelog. > > --- > drivers/firmware/psci/psci.c | 17 ++++++++++++++--- > drivers/firmware/psci/psci.h | 16 ++++++++++++++++ > 2 files changed, 30 insertions(+), 3 deletions(-) > create mode 100644 drivers/firmware/psci/psci.h > > diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c > index 4aec513136e4..0e91d864e346 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. > @@ -96,7 +98,7 @@ 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) > +bool psci_has_osi_support(void) > { > return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; > } > @@ -161,6 +163,15 @@ static u32 psci_get_version(void) > return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0); > } > > +int psci_set_osi_mode(void) > +{ > + int err; > + > + err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE, > + PSCI_1_0_SUSPEND_MODE_OSI, 0, 0); > + return psci_to_linux_errno(err); > +} > + > static int psci_cpu_suspend(u32 state, unsigned long entry_point) > { > int err; > @@ -292,12 +303,12 @@ static inline 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); > } > > -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); > > diff --git a/drivers/firmware/psci/psci.h b/drivers/firmware/psci/psci.h > new file mode 100644 > index 000000000000..f2277c3ad405 > --- /dev/null > +++ b/drivers/firmware/psci/psci.h > @@ -0,0 +1,16 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > + > +#ifndef __PSCI_H > +#define __PSCI_H > + > +struct device_node; > + > +int psci_set_osi_mode(void); > +bool psci_has_osi_support(void); > + > +#ifdef CONFIG_CPU_IDLE > +void psci_set_domain_state(u32 state); > +int psci_dt_parse_state_node(struct device_node *np, u32 *state); > +#endif > + > +#endif /* __PSCI_H */ > -- > 2.17.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1A19C468BD for ; Fri, 7 Jun 2019 15:21:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB624208C3 for ; Fri, 7 Jun 2019 15:21:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CZHjCP0U" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB624208C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/8q6J+hGu5aF+8q7yrJV2SzdOBB75di0699qzQ16Hjg=; b=CZHjCP0UQOg6RD QOTFh4FYv8Wxa9yjtDr+FmrXECLRANZZlHZjovJGfW0zOQjOYQIaptl/A+OUiKMmG8XO/I7kS/da0 1YyLh7CdQ4qkdM2RgOXdDOXdR0HX72SiVWW1UX1WwY+tki90aZ4OWoMYOQPnAXuWLIeWVjAht9SFV tet/j7CJtqPhlpsYtJi/8/qD7BKq5uFXutryYOIQCnIUY56NfNlqNmMEPl1nplq8fMdZDzaEN9n4s P0qPpGti1yc30uuA/S717U41vB8D3eT52IEiKoyE9VjEP+zGMgkxGh59lmFQ1mUWaV5uS0vAp9Ebj H7kz9hcM1cleNBUHYlKA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZGgG-00049D-RV; Fri, 07 Jun 2019 15:21:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hZGgC-00048r-SS for linux-arm-kernel@lists.infradead.org; Fri, 07 Jun 2019 15:21:22 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 99207337; Fri, 7 Jun 2019 08:21:19 -0700 (PDT) Received: from e107155-lin (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E9EEB3F718; Fri, 7 Jun 2019 08:21:16 -0700 (PDT) Date: Fri, 7 Jun 2019 16:21:14 +0100 From: Sudeep Holla To: Ulf Hansson Subject: Re: [PATCH 08/18] drivers: firmware: psci: Prepare to support PM domains Message-ID: <20190607152114.GG15577@e107155-lin> References: <20190513192300.653-1-ulf.hansson@linaro.org> <20190513192300.653-9-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190513192300.653-9-ulf.hansson@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190607_082121_013512_730FA77F X-CRM114-Status: GOOD ( 21.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Lorenzo Pieralisi , Geert Uytterhoeven , Kevin Hilman , Stephen Boyd , Viresh Kumar , linux-pm@vger.kernel.org, Daniel Lezcano , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Amit Kucheria , Bjorn Andersson , Tony Lindgren , linux-arm-msm@vger.kernel.org, Lina Iyer , Sudeep Holla , Niklas Cassel , Souvik Chakravarty , "Raju P . L . S . S . S . N" , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 13, 2019 at 09:22:50PM +0200, Ulf Hansson wrote: > Subsequent changes implements support for PM domains to PSCI. Those changes > are mainly implemented in a new separate c-file, hence a couple of the > internal PSCI functions needs to be shared to be accessible. Let's do that > via adding a new PSCI header file. > > Moreover, to implement support for PM domains, switching the PSCI FW into > the OS initiated mode is sometimes needed. Therefore, let's share a new > function that implement this. > This looks fine. -- Regards, Sudeep > Signed-off-by: Ulf Hansson > --- > > Changes: > - Convert psci_set_osi_mode() to return an int. > - Don't share psci_get_domain_state() as that's no longer needed. > - Update changelog. > > --- > drivers/firmware/psci/psci.c | 17 ++++++++++++++--- > drivers/firmware/psci/psci.h | 16 ++++++++++++++++ > 2 files changed, 30 insertions(+), 3 deletions(-) > create mode 100644 drivers/firmware/psci/psci.h > > diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c > index 4aec513136e4..0e91d864e346 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. > @@ -96,7 +98,7 @@ 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) > +bool psci_has_osi_support(void) > { > return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; > } > @@ -161,6 +163,15 @@ static u32 psci_get_version(void) > return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0); > } > > +int psci_set_osi_mode(void) > +{ > + int err; > + > + err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE, > + PSCI_1_0_SUSPEND_MODE_OSI, 0, 0); > + return psci_to_linux_errno(err); > +} > + > static int psci_cpu_suspend(u32 state, unsigned long entry_point) > { > int err; > @@ -292,12 +303,12 @@ static inline 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); > } > > -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); > > diff --git a/drivers/firmware/psci/psci.h b/drivers/firmware/psci/psci.h > new file mode 100644 > index 000000000000..f2277c3ad405 > --- /dev/null > +++ b/drivers/firmware/psci/psci.h > @@ -0,0 +1,16 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > + > +#ifndef __PSCI_H > +#define __PSCI_H > + > +struct device_node; > + > +int psci_set_osi_mode(void); > +bool psci_has_osi_support(void); > + > +#ifdef CONFIG_CPU_IDLE > +void psci_set_domain_state(u32 state); > +int psci_dt_parse_state_node(struct device_node *np, u32 *state); > +#endif > + > +#endif /* __PSCI_H */ > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel