Message ID | 20220927095405.241531-2-rasmus.villemoes@prevas.dk |
---|---|
State | Accepted |
Commit | c11cedc876631c1753427a68db4efaa00f700a79 |
Delegated to: | Stefan Roese |
Headers | show |
Series | handle watchdogs during keyed autoboot | expand |
On 27.09.22 11:54, Rasmus Villemoes wrote: > Currently, AUTOBOOT_KEYED and its variant AUTOBOOT_ENCRYPTION are > broken when one has an external always-running watchdog device with a > timeout shorter than the configured boot delay (in my case, I have a > gpio-wdt one with a timeout of 1 second), because we fail to call > WATCHDOG_RESET() in the loops where we wait for the bootdelay to > elapse. > > This is done implicitly in the !AUTOBOOT_KEYED case, > i.e. abortboot_single_key(), because that loop contains a > udelay(10000), and udelay() does a WATCHDOG_RESET(). > > To fix this, simply add similar udelay() calls in the other loops. > > Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > common/autoboot.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/common/autoboot.c b/common/autoboot.c > index 63f2587941..cdafe76309 100644 > --- a/common/autoboot.c > +++ b/common/autoboot.c > @@ -115,6 +115,7 @@ static int passwd_abort_crypt(uint64_t etime) > presskey_len++; > } > } > + udelay(10000); > } while (never_timeout || get_ticks() <= etime); > > return abort; > @@ -206,6 +207,7 @@ static int passwd_abort_sha256(uint64_t etime) > if (slow_equals(sha, sha_env, SHA256_SUM_LEN)) > abort = 1; > } > + udelay(10000); > } while (!abort && get_ticks() <= etime); > > free(presskey); > @@ -293,6 +295,7 @@ static int passwd_abort_key(uint64_t etime) > abort = 1; > } > } > + udelay(10000); > } while (!abort && get_ticks() <= etime); > > return abort; Viele Grüße, Stefan Roese
On 27.09.22 11:54, Rasmus Villemoes wrote: > Currently, AUTOBOOT_KEYED and its variant AUTOBOOT_ENCRYPTION are > broken when one has an external always-running watchdog device with a > timeout shorter than the configured boot delay (in my case, I have a > gpio-wdt one with a timeout of 1 second), because we fail to call > WATCHDOG_RESET() in the loops where we wait for the bootdelay to > elapse. > > This is done implicitly in the !AUTOBOOT_KEYED case, > i.e. abortboot_single_key(), because that loop contains a > udelay(10000), and udelay() does a WATCHDOG_RESET(). > > To fix this, simply add similar udelay() calls in the other loops. > > Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Applied to u-boot-watchdog/master Thanks, Stefan > --- > common/autoboot.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/common/autoboot.c b/common/autoboot.c > index 63f2587941..cdafe76309 100644 > --- a/common/autoboot.c > +++ b/common/autoboot.c > @@ -115,6 +115,7 @@ static int passwd_abort_crypt(uint64_t etime) > presskey_len++; > } > } > + udelay(10000); > } while (never_timeout || get_ticks() <= etime); > > return abort; > @@ -206,6 +207,7 @@ static int passwd_abort_sha256(uint64_t etime) > if (slow_equals(sha, sha_env, SHA256_SUM_LEN)) > abort = 1; > } > + udelay(10000); > } while (!abort && get_ticks() <= etime); > > free(presskey); > @@ -293,6 +295,7 @@ static int passwd_abort_key(uint64_t etime) > abort = 1; > } > } > + udelay(10000); > } while (!abort && get_ticks() <= etime); > > return abort; Viele Grüße, Stefan Roese
diff --git a/common/autoboot.c b/common/autoboot.c index 63f2587941..cdafe76309 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -115,6 +115,7 @@ static int passwd_abort_crypt(uint64_t etime) presskey_len++; } } + udelay(10000); } while (never_timeout || get_ticks() <= etime); return abort; @@ -206,6 +207,7 @@ static int passwd_abort_sha256(uint64_t etime) if (slow_equals(sha, sha_env, SHA256_SUM_LEN)) abort = 1; } + udelay(10000); } while (!abort && get_ticks() <= etime); free(presskey); @@ -293,6 +295,7 @@ static int passwd_abort_key(uint64_t etime) abort = 1; } } + udelay(10000); } while (!abort && get_ticks() <= etime); return abort;
Currently, AUTOBOOT_KEYED and its variant AUTOBOOT_ENCRYPTION are broken when one has an external always-running watchdog device with a timeout shorter than the configured boot delay (in my case, I have a gpio-wdt one with a timeout of 1 second), because we fail to call WATCHDOG_RESET() in the loops where we wait for the bootdelay to elapse. This is done implicitly in the !AUTOBOOT_KEYED case, i.e. abortboot_single_key(), because that loop contains a udelay(10000), and udelay() does a WATCHDOG_RESET(). To fix this, simply add similar udelay() calls in the other loops. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> --- common/autoboot.c | 3 +++ 1 file changed, 3 insertions(+)