diff options
author | Joel Kitching <kitching@google.com> | 2020-04-07 17:22:15 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-14 06:49:57 +0000 |
commit | d83bfe7426c38a3553f873303e48d27c4805cc19 (patch) | |
tree | 8e48de3c63474249265d21e07092f2ffb14fc1e9 /firmware/lib/vboot_api_kernel.c | |
parent | 896864c9a3225aabf64b4ac669bab725be9e305f (diff) | |
download | vboot-d83bfe7426c38a3553f873303e48d27c4805cc19.tar.gz |
vboot: clear recovery request in all boot modes
Previously, recovery requests are only cleared when user
initiates a manual recovery. This causes problems with
two cases specifically:
* Transient failures - The recovery request remains in the
subcode field for some unknown period of time, and then
erroneously gets promoted to the "recovery reason" the
next time the user initiates a manual recovery request.
* TRAIN_AND_REBOOT - The recovery request remains in the
subcode field after training has completed. The next
time a manual recovery request is initiated, the subcode
is promoted and training occurs yet again. When finished,
a reboot occurs and the user ends up back in the OS.
Make two changes to deal with these cases:
* Clear recovery request (including subcode) unconditionally
for non-recovery boot modes.
* Stop promoting TRAIN_AND_REBOOT subcodes.
BUG=b:153157134, b:35576380
TEST=make clean && make runtests
BRANCH=none
Change-Id: I79f8fbed72a9d052b5ed5f70e9a2515136b6ef10
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2139335
Tested-by: Joel Kitching <kitching@chromium.org>
Tested-by: Frank Wu <frank_wu@compal.corp-partner.google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'firmware/lib/vboot_api_kernel.c')
-rw-r--r-- | firmware/lib/vboot_api_kernel.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index ff13a256..14f70c71 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -198,10 +198,14 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx, VB2_TRY(handle_battery_cutoff(ctx)); } + /* + * If in non-manual recovery mode, save the recovery reason as subcode. + * Otherwise, clear any leftover recovery requests or subcodes. + */ + vb2_clear_recovery(ctx); + /* Select boot path */ if (ctx->flags & VB2_CONTEXT_RECOVERY_MODE) { - vb2_clear_recovery(ctx); - /* If we're in recovery mode just to do memory retraining, all we need to do is reboot. */ if (sd->recovery_reason == VB2_RECOVERY_TRAIN_AND_REBOOT) { @@ -214,6 +218,7 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx, * entering either manual recovery UI or BROKEN screen shortly. */ vb2ex_commit_data(ctx); + /* * In EFS2, recovery mode can be entered even when battery is * drained or damaged. EC-RO sets NO_BOOT flag in such case and |