From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751869AbdJYPph (ORCPT ); Wed, 25 Oct 2017 11:45:37 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38568 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751513AbdJYPpe (ORCPT ); Wed, 25 Oct 2017 11:45:34 -0400 Date: Wed, 25 Oct 2017 16:45:37 +0100 From: Lorenzo Pieralisi To: Geert Uytterhoeven Cc: Mark Rutland , linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [1/2] drivers: firmware: psci: Add psci_is_available() Message-ID: <20171025154537.GA7829@red-moon> References: <1507708982-12336-2-git-send-email-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1507708982-12336-2-git-send-email-geert+renesas@glider.be> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 11, 2017 at 10:03:01AM +0200, Geert Uytterhoeven wrote: > PSCI support may be disabled at build time (by configuration) or at > run-time (PSCI firmware not present). While CONFIG_ARM_PSCI_FW can be > used to check for build time enablement, there is currently no simple > way to check if PSCI is actually available and used. > > Hence add a helper function to check if PSCI is available. Hi Geert, excuse us the delay in responding. I think it would be better if the check just carries out a DT/ACPI matching check rather than being based on PSCI ops initialization but before doing that I would like first to understand what this function can be actually used for (ie I do not think the usage in the PSCI checker is relevant to this discussion). Thanks, Lorenzo > This is useful for e.g. drivers that are used on platforms with and > without PSCI. Such drivers may need to take provisions for proper > operation when PSCI is used, and/or to implement functionality that is > usually provided by PSCI. > > Signed-off-by: Geert Uytterhoeven > --- > drivers/firmware/psci.c | 5 +++++ > include/linux/psci.h | 2 ++ > 2 files changed, 7 insertions(+) > > diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c > index da469c972b503f83..a3a11e2d8ffffaaa 100644 > --- a/drivers/firmware/psci.c > +++ b/drivers/firmware/psci.c > @@ -670,6 +670,11 @@ int __init psci_dt_init(void) > return init_fn(np); > } > > +bool psci_is_available(void) > +{ > + return psci_ops.cpu_off && psci_ops.cpu_on && psci_ops.cpu_suspend; > +} > + > #ifdef CONFIG_ACPI > /* > * We use PSCI 0.2+ when ACPI is deployed on ARM64 and it's > diff --git a/include/linux/psci.h b/include/linux/psci.h > index bdea1cb5e1db142b..2bdee325aeb80cf6 100644 > --- a/include/linux/psci.h > +++ b/include/linux/psci.h > @@ -39,8 +39,10 @@ extern struct psci_operations psci_ops; > > #if defined(CONFIG_ARM_PSCI_FW) > int __init psci_dt_init(void); > +bool psci_is_available(void); > #else > static inline int psci_dt_init(void) { return 0; } > +static inline bool psci_is_available(void) { return false; } > #endif > > #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)