* [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available
@ 2023-01-05 9:08 Marc Zyngier
2023-01-05 13:08 ` Mark Rutland
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Marc Zyngier @ 2023-01-05 9:08 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel
Cc: Hector Martin, Dmitry Baryshkov, Mark Brown, Ulf Hansson,
Arnd Bergmann, Mark Rutland, Lorenzo Pieralisi
Contrary to popular belief, PSCI is not a universal property of an
ARM/arm64 system. There is a garden variety of systems out there
that don't (or even cannot) implement it.
I'm the first one deplore such a situation, but hey...
On such systems, a "cat /sys/kernel/debug/psci" results in
fireworks, as no invocation callback is registered.
Check for the invoke_psci_fn and psci_ops.get_version pointers
before registering with the debugfs subsystem, avoiding the
issue altogether.
Fixes: 3137f2e60098 ("firmware/psci: Add debugfs support to ease debugging")
Reported-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
---
drivers/firmware/psci/psci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index e7bcfca4159f..447ee4ea5c90 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -440,6 +440,9 @@ static const struct file_operations psci_debugfs_ops = {
static int __init psci_debugfs_init(void)
{
+ if (!invoke_psci_fn || !psci_ops.get_version)
+ return 0;
+
return PTR_ERR_OR_ZERO(debugfs_create_file("psci", 0444, NULL, NULL,
&psci_debugfs_ops));
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available
2023-01-05 9:08 [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available Marc Zyngier
@ 2023-01-05 13:08 ` Mark Rutland
2023-01-05 13:13 ` Dmitry Baryshkov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mark Rutland @ 2023-01-05 13:08 UTC (permalink / raw)
To: Marc Zyngier
Cc: linux-arm-kernel, linux-kernel, Hector Martin, Dmitry Baryshkov,
Mark Brown, Ulf Hansson, Arnd Bergmann, Lorenzo Pieralisi
On Thu, Jan 05, 2023 at 09:08:34AM +0000, Marc Zyngier wrote:
> Contrary to popular belief, PSCI is not a universal property of an
> ARM/arm64 system. There is a garden variety of systems out there
> that don't (or even cannot) implement it.
>
> I'm the first one deplore such a situation, but hey...
>
> On such systems, a "cat /sys/kernel/debug/psci" results in
> fireworks, as no invocation callback is registered.
>
> Check for the invoke_psci_fn and psci_ops.get_version pointers
> before registering with the debugfs subsystem, avoiding the
> issue altogether.
>
> Fixes: 3137f2e60098 ("firmware/psci: Add debugfs support to ease debugging")
> Reported-by: Hector Martin <marcan@marcan.st>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
> ---
> drivers/firmware/psci/psci.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
> index e7bcfca4159f..447ee4ea5c90 100644
> --- a/drivers/firmware/psci/psci.c
> +++ b/drivers/firmware/psci/psci.c
> @@ -440,6 +440,9 @@ static const struct file_operations psci_debugfs_ops = {
>
> static int __init psci_debugfs_init(void)
> {
> + if (!invoke_psci_fn || !psci_ops.get_version)
> + return 0;
> +
> return PTR_ERR_OR_ZERO(debugfs_create_file("psci", 0444, NULL, NULL,
> &psci_debugfs_ops));
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available
2023-01-05 9:08 [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available Marc Zyngier
2023-01-05 13:08 ` Mark Rutland
@ 2023-01-05 13:13 ` Dmitry Baryshkov
2023-01-05 22:56 ` Hector Martin
2023-01-06 17:50 ` Will Deacon
3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2023-01-05 13:13 UTC (permalink / raw)
To: Marc Zyngier, linux-arm-kernel, linux-kernel
Cc: Hector Martin, Mark Brown, Ulf Hansson, Arnd Bergmann,
Mark Rutland, Lorenzo Pieralisi
On 05/01/2023 11:08, Marc Zyngier wrote:
> Contrary to popular belief, PSCI is not a universal property of an
> ARM/arm64 system. There is a garden variety of systems out there
> that don't (or even cannot) implement it.
>
> I'm the first one deplore such a situation, but hey...
>
> On such systems, a "cat /sys/kernel/debug/psci" results in
> fireworks, as no invocation callback is registered.
>
> Check for the invoke_psci_fn and psci_ops.get_version pointers
> before registering with the debugfs subsystem, avoiding the
> issue altogether.
>
> Fixes: 3137f2e60098 ("firmware/psci: Add debugfs support to ease debugging")
> Reported-by: Hector Martin <marcan@marcan.st>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available
2023-01-05 9:08 [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available Marc Zyngier
2023-01-05 13:08 ` Mark Rutland
2023-01-05 13:13 ` Dmitry Baryshkov
@ 2023-01-05 22:56 ` Hector Martin
2023-01-06 17:50 ` Will Deacon
3 siblings, 0 replies; 5+ messages in thread
From: Hector Martin @ 2023-01-05 22:56 UTC (permalink / raw)
To: Marc Zyngier, linux-arm-kernel, linux-kernel
Cc: Dmitry Baryshkov, Mark Brown, Ulf Hansson, Arnd Bergmann,
Mark Rutland, Lorenzo Pieralisi
On 05/01/2023 18.08, Marc Zyngier wrote:
> Contrary to popular belief, PSCI is not a universal property of an
> ARM/arm64 system. There is a garden variety of systems out there
> that don't (or even cannot) implement it.
>
> I'm the first one deplore such a situation, but hey...
>
> On such systems, a "cat /sys/kernel/debug/psci" results in
> fireworks, as no invocation callback is registered.
>
> Check for the invoke_psci_fn and psci_ops.get_version pointers
> before registering with the debugfs subsystem, avoiding the
> issue altogether.
>
> Fixes: 3137f2e60098 ("firmware/psci: Add debugfs support to ease debugging")
> Reported-by: Hector Martin <marcan@marcan.st>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
> ---
> drivers/firmware/psci/psci.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
> index e7bcfca4159f..447ee4ea5c90 100644
> --- a/drivers/firmware/psci/psci.c
> +++ b/drivers/firmware/psci/psci.c
> @@ -440,6 +440,9 @@ static const struct file_operations psci_debugfs_ops = {
>
> static int __init psci_debugfs_init(void)
> {
> + if (!invoke_psci_fn || !psci_ops.get_version)
> + return 0;
> +
> return PTR_ERR_OR_ZERO(debugfs_create_file("psci", 0444, NULL, NULL,
> &psci_debugfs_ops));
> }
Reviewed-by: Hector Martin <marcan@marcan.st>
- Hector
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available
2023-01-05 9:08 [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available Marc Zyngier
` (2 preceding siblings ...)
2023-01-05 22:56 ` Hector Martin
@ 2023-01-06 17:50 ` Will Deacon
3 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2023-01-06 17:50 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, Marc Zyngier
Cc: catalin.marinas, kernel-team, Will Deacon, Arnd Bergmann,
Hector Martin, Lorenzo Pieralisi, Dmitry Baryshkov, Ulf Hansson,
Mark Rutland, Mark Brown
On Thu, 5 Jan 2023 09:08:34 +0000, Marc Zyngier wrote:
> Contrary to popular belief, PSCI is not a universal property of an
> ARM/arm64 system. There is a garden variety of systems out there
> that don't (or even cannot) implement it.
>
> I'm the first one deplore such a situation, but hey...
>
> On such systems, a "cat /sys/kernel/debug/psci" results in
> fireworks, as no invocation callback is registered.
>
> [...]
Applied to arm64 (for-next/fixes), thanks!
[1/1] firmware/psci: Don't register with debugfs if PSCI isn't available
https://git.kernel.org/arm64/c/cef139299fd8
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-06 17:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 9:08 [PATCH] firmware/psci: Don't register with debugfs if PSCI isn't available Marc Zyngier
2023-01-05 13:08 ` Mark Rutland
2023-01-05 13:13 ` Dmitry Baryshkov
2023-01-05 22:56 ` Hector Martin
2023-01-06 17:50 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).