From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
To: Krzysztof Adamski <krzysztof.adamski@nokia.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Peter Collingbourne <pcc@google.com>,
Guenter Roeck <linux@roeck-us.net>,
Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Matija Glavinic-Pecotic <matija.glavinic-pecotic.ext@nokia.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: move efi_reboot to restart handler
Date: Mon, 17 Jan 2022 13:44:41 +0100 [thread overview]
Message-ID: <c92e2db9-00b4-8800-e800-046d564f52d9@nokia.com> (raw)
In-Reply-To: <YeVhtL2gCLkhTPdv@localhost.localdomain>
Hi!
On 17/01/2022 13:31, Krzysztof Adamski wrote:
> On EFI enabled arm64 systems, efi_reboot was called before
> do_kernel_restart, completely omitting the reset_handlers functionality.
> By registering efi_reboot as part of the chain with slightly elevated
> priority, we make it run before the default handler but still allow
> plugging in other handlers.
> Thanks to that, things like gpio_restart, restart handlers in
> watchdog_core, mmc or mtds are working on those platforms.
>
> The priority 129 should be high enough as we will likely be the first
> one to register on this prio so we will be called before others, like
> PSCI handler.
>
> Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
> arch/arm64/kernel/process.c | 7 -------
> arch/arm64/kernel/setup.c | 21 +++++++++++++++++++++
> 2 files changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 5369e649fa79..b86ef77bb0c8 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -130,13 +130,6 @@ void machine_restart(char *cmd)
> local_irq_disable();
> smp_send_stop();
>
> - /*
> - * UpdateCapsule() depends on the system being reset via
> - * ResetSystem().
> - */
> - if (efi_enabled(EFI_RUNTIME_SERVICES))
> - efi_reboot(reboot_mode, NULL);
> -
> /* Now call the architecture specific reboot code. */
> do_kernel_restart(cmd);
>
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index f70573928f1b..5fa95980ba73 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -12,6 +12,7 @@
> #include <linux/stddef.h>
> #include <linux/ioport.h>
> #include <linux/delay.h>
> +#include <linux/reboot.h>
> #include <linux/initrd.h>
> #include <linux/console.h>
> #include <linux/cache.h>
> @@ -298,6 +299,24 @@ u64 cpu_logical_map(unsigned int cpu)
> return __cpu_logical_map[cpu];
> }
>
> +static int efi_restart(struct notifier_block *nb, unsigned long action,
> + void *data)
> +{
> + /*
> + * UpdateCapsule() depends on the system being reset via
> + * ResetSystem().
> + */
> + if (efi_enabled(EFI_RUNTIME_SERVICES))
> + efi_reboot(reboot_mode, NULL);
> +
> + return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block efi_restart_nb = {
> + .notifier_call = efi_restart,
> + .priority = 129,
> +};
> +
> void __init __no_sanitize_address setup_arch(char **cmdline_p)
> {
> setup_initial_init_mm(_stext, _etext, _edata, _end);
> @@ -346,6 +365,8 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p)
>
> paging_init();
>
> + register_restart_handler(&efi_restart_nb);
> +
> acpi_table_upgrade();
>
> /* Parse the ACPI tables for possible boot-time configuration */
--
Best regards,
Alexander Sverdlin.
next prev parent reply other threads:[~2022-01-17 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 12:31 Krzysztof Adamski
2022-01-17 12:44 ` Alexander Sverdlin [this message]
2022-01-17 13:10 ` Mark Rutland
2022-01-17 17:58 ` Krzysztof Adamski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c92e2db9-00b4-8800-e800-046d564f52d9@nokia.com \
--to=alexander.sverdlin@nokia.com \
--cc=catalin.marinas@arm.com \
--cc=krzysztof.adamski@nokia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mark.rutland@arm.com \
--cc=matija.glavinic-pecotic.ext@nokia.com \
--cc=pcc@google.com \
--cc=will@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®