All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: u-boot@lists.denx.de
Subject: [PATCH 2/2] watchdog: add watchdog behavior configuration
Date: Thu, 24 Sep 2020 08:53:37 +0200	[thread overview]
Message-ID: <48b3b91d1bdcfe7f3cc4f1c5640a76e7@walle.cc> (raw)
In-Reply-To: <20200923172820.GU14816@bill-the-cat>

Am 2020-09-23 19:28, schrieb Tom Rini:
> On Wed, Sep 23, 2020 at 07:21:57PM +0200, Heinrich Schuchardt wrote:
>> On 9/23/20 6:45 PM, Michael Walle wrote:
>> > Let the user choose between three different behaviours of the watchdog:
>> >  (1) Keep the watchdog disabled
>> >  (2) Supervise u-boot
>> >  (3) Supervise u-boot and the operating systen (default)
>> >
>> > Option (2) will disable the watchdog right before handing control to the
>> > operating system. This is useful when the OS is not aware of the
>> > watchdog. Option (3) doesn't disable the watchdog and assumes the OS
>> > will continue servicing.
>> >
>> > Signed-off-by: Michael Walle <michael@walle.cc>
>> > ---
>> >  cmd/boot.c                    |  7 +++++++
>> >  cmd/bootefi.c                 |  7 +++++++
>> >  cmd/efidebug.c                |  7 +++++++
>> >  common/board_r.c              |  2 +-
>> >  common/bootm_os.c             |  5 +++++
>> >  common/spl/spl.c              |  6 +++---
>> >  drivers/watchdog/Kconfig      | 24 ++++++++++++++++++++++++
>> >  drivers/watchdog/wdt-uclass.c | 33 +++++++++++++++++++++++++--------
>> >  include/wdt.h                 | 17 +++++++++++++++++
>> >  9 files changed, 96 insertions(+), 12 deletions(-)
>> >
>> > diff --git a/cmd/boot.c b/cmd/boot.c
>> > index 36aba22b30..2412410371 100644
>> > --- a/cmd/boot.c
>> > +++ b/cmd/boot.c
>> > @@ -10,6 +10,7 @@
>> >  #include <common.h>
>> >  #include <command.h>
>> >  #include <net.h>
>> > +#include <wdt.h>
>> >
>> >  #ifdef CONFIG_CMD_GO
>> >
>> > @@ -33,6 +34,9 @@ static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>> >
>> >  	printf ("## Starting application at 0x%08lX ...\n", addr);
>> >
>> > +	if (IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_U_BOOT))
>> > +		stop_watchdog();
>> > +
>> >  	/*
>> >  	 * pass address parameter as argv[0] (aka command name),
>> >  	 * and all remaining args
>> > @@ -40,6 +44,9 @@ static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
>> >  	rc = do_go_exec ((void *)addr, argc - 1, argv + 1);
>> >  	if (rc != 0) rcode = 1;
>> >
>> > +	if (IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_U_BOOT))
>> > +		start_watchdog();
>> > +
>> >  	printf ("## Application terminated, rc = 0x%lX\n", rc);
>> >  	return rcode;
>> >  }
>> > diff --git a/cmd/bootefi.c b/cmd/bootefi.c
>> > index 40d5ef2b3a..21f6650174 100644
>> > --- a/cmd/bootefi.c
>> > +++ b/cmd/bootefi.c
>> > @@ -24,6 +24,7 @@
>> >  #include <memalign.h>
>> >  #include <asm-generic/sections.h>
>> >  #include <linux/linkage.h>
>> > +#include <wdt.h>
>> >
>> >  DECLARE_GLOBAL_DATA_PTR;
>> >
>> > @@ -320,6 +321,9 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
>> >  	efi_uintn_t exit_data_size = 0;
>> >  	u16 *exit_data = NULL;
>> >
>> > +	if (IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_U_BOOT))
>> > +		stop_watchdog();
>> > +
>> >  	/* Call our payload! */
>> >  	ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
>> >  	if (ret != EFI_SUCCESS) {
>> > @@ -333,6 +337,9 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
>> >
>> >  	efi_restore_gd();
>> >
>> > +	if (IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_U_BOOT))
>> > +		start_watchdog();
>> > +
>> >  	free(load_options);
>> >
>> >  	return ret;
>> > diff --git a/cmd/efidebug.c b/cmd/efidebug.c
>> > index 9874838b00..5fa0cd1df7 100644
>> > --- a/cmd/efidebug.c
>> > +++ b/cmd/efidebug.c
>> > @@ -16,6 +16,7 @@
>> >  #include <mapmem.h>
>> >  #include <search.h>
>> >  #include <linux/ctype.h>
>> > +#include <wdt.h>
>> >
>> >  #define BS systab.boottime
>> >
>> > @@ -1131,6 +1132,9 @@ static int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
>> >  	ret = efi_bootmgr_load(&image, &load_options);
>> >  	printf("efi_bootmgr_load() returned: %ld\n", ret & ~EFI_ERROR_MASK);
>> >
>> > +	if (IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_U_BOOT))
>> > +		stop_watchdog();
>> > +
>> >  	/* We call efi_start_image() even if error for test purpose. */
>> >  	ret = EFI_CALL(efi_start_image(image, &exit_data_size, &exit_data));
>> >  	printf("efi_start_image() returned: %ld\n", ret & ~EFI_ERROR_MASK);
>> > @@ -1139,6 +1143,9 @@ static int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
>> >
>> >  	efi_restore_gd();
>> >
>> > +	if (IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_U_BOOT))
>> > +		start_watchdog();
>> > +
>> >  	free(load_options);
>> >  	return CMD_RET_SUCCESS;
>> >  }
>> > diff --git a/common/board_r.c b/common/board_r.c
>> > index 9b2fec701a..6734d3ad25 100644
>> > --- a/common/board_r.c
>> > +++ b/common/board_r.c
>> > @@ -731,7 +731,7 @@ static init_fnc_t init_sequence_r[] = {
>> >  	stdio_init_tables,
>> >  	serial_initialize,
>> >  	initr_announce,
>> > -#if CONFIG_IS_ENABLED(WDT)
>> > +#if !IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_NOTHING)
>> >  	initr_watchdog,
>> 
>> This does not compile on odroid_c2_defconfig.
>> 
>> aarch64-linux-gnu-ld.bfd:
>> common/built-in.o:(.data.init_sequence_r+0x88): undefined reference to
>> `initr_watchdog'
>> make: *** [Makefile:1753: u-boot] Error 1
> 
> I think a pre-req for this will be to have re-run the migration of
> CONFIG_WATCHDOG / CONFIG_WDT from config headers and in to defconfigs.
> I'm not 100% sure that's what's causing the breakage here (migration
> isn't done yet) but I could see that being a problem.

No, I actually messed up my patch in the last minute (I did a kernel-ci
run in parallel, though).

#if !IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_NOTHING)
	initr_watchdog,
#endif

must be

#if IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_U_BOOT) || 
IS_ENABLED(CONFIG_WATCHDOG_SUPERVISE_OS)
	initr_watchdog,
#endif

-michael

      reply	other threads:[~2020-09-24  6:53 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 16:45 [PATCH 1/2] watchdog: Hide WATCHDOG_RESET_DISABLE Michael Walle
2020-09-23 16:45 ` [PATCH 2/2] watchdog: add watchdog behavior configuration Michael Walle
2020-09-23 17:01   ` Mark Kettenis
2020-09-23 17:14     ` Tom Rini
2020-09-23 17:31       ` Heinrich Schuchardt
2020-09-23 17:35         ` Tom Rini
2020-09-24  7:33           ` Michael Walle
2020-09-24  8:10             ` Mark Kettenis
2020-09-24  8:20               ` Michael Walle
2020-09-24 10:22                 ` Mark Kettenis
2020-09-24 21:05                   ` Michael Walle
2020-09-24 13:19             ` Tom Rini
2020-09-24 20:30               ` Michael Walle
2020-09-24 20:58                 ` Mark Kettenis
2020-09-24 21:14                   ` Michael Walle
2020-09-25  1:17                     ` Tom Rini
2020-09-25  8:36               ` Wolfgang Denk
2020-09-25 11:29                 ` Heinrich Schuchardt
2020-09-25 13:00                   ` Tom Rini
2020-09-25 13:26                     ` Heinrich Schuchardt
2020-09-26  8:45                       ` Wolfgang Denk
2020-09-26 10:54                         ` Mark Kettenis
2020-09-26 12:39                           ` Heinrich Schuchardt
2020-09-26 12:44                             ` Tom Rini
2020-09-27 16:06                               ` Michael Walle
2020-09-28 15:34                                 ` Tom Rini
2020-09-26 14:40                             ` Wolfgang Denk
2020-09-26 14:22                           ` Wolfgang Denk
2020-09-25 13:04                   ` Wolfgang Denk
2020-10-04 14:55                     ` Michael Walle
2020-10-04 15:10                       ` Heinrich Schuchardt
2020-10-04 15:40                         ` Tom Rini
2020-09-23 17:53       ` Mark Kettenis
2020-09-23 18:51         ` Heinrich Schuchardt
2020-09-23 19:02           ` Tom Rini
2020-09-23 20:01             ` Heinrich Schuchardt
2020-09-23 20:23               ` Tom Rini
2020-09-23 20:58                 ` Heinrich Schuchardt
2020-09-23 21:09                   ` Tom Rini
2020-09-23 20:38           ` Michael Walle
2020-09-23 21:01             ` Heinrich Schuchardt
2020-09-23 17:21   ` Heinrich Schuchardt
2020-09-23 17:28     ` Tom Rini
2020-09-24  6:53       ` Michael Walle [this message]

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=48b3b91d1bdcfe7f3cc4f1c5640a76e7@walle.cc \
    --to=michael@walle.cc \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.