summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Barnaś <mb@semihalf.com>2021-05-12 18:16:38 +0200
committerCommit Bot <commit-bot@chromium.org>2021-05-18 00:24:36 +0000
commite38a18d39b0a63428f57ff09a0e0c67ba6472e11 (patch)
tree9a30a9fd1a7a4dbfb64924257b504f199dfe537e
parente98327249389b1a624bf3477b69e15e28d816418 (diff)
downloadchrome-ec-e38a18d39b0a63428f57ff09a0e0c67ba6472e11.tar.gz
zephyr: Remove CONFIG_VBOOT_HASH_RELOAD_WATCHDOG
This reverts commit 0e5fa530e2f1eba6e16188be65ac39974a151a17. After commit 97e22d467 it is no longer needed to reload watchdog during hash calculation. BUG=b:182499153 BRANCH=none TEST=Flash EC and verify that hash calculation is correctly done without rebooting by watchdog. Reading watchdog value shows that there is enough remaining time. Change-Id: Ia7bb6452a6ac42cda88d8b5e1203876cd0465b31 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2897239 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--common/vboot_hash.c18
-rw-r--r--include/config.h25
-rw-r--r--zephyr/app/ec/ec_app_main.c8
3 files changed, 4 insertions, 47 deletions
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index 1bb9298ced..04e3ae5f7f 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -127,28 +127,10 @@ static void hash_next_chunk(size_t size)
static void vboot_hash_all_chunks(void)
{
-#ifdef CONFIG_VBOOT_HASH_RELOAD_WATCHDOG
- uint64_t prev_watchdog = get_time().val;
-
- watchdog_reload();
-#endif
-
do {
size_t size = MIN(CHUNK_SIZE, data_size - curr_pos);
hash_next_chunk(size);
curr_pos += size;
-
-#ifdef CONFIG_VBOOT_HASH_RELOAD_WATCHDOG
- {
- uint64_t cur_time = get_time().val;
-
- if ((cur_time - prev_watchdog) >
- (CONFIG_WATCHDOG_PERIOD_MS * 1000 / 2)) {
- watchdog_reload();
- prev_watchdog = cur_time;
- }
- }
-#endif
} while (curr_pos < data_size);
hash = SHA256_final(&ctx);
diff --git a/include/config.h b/include/config.h
index dfe458c5ad..c43ea3845a 100644
--- a/include/config.h
+++ b/include/config.h
@@ -5038,15 +5038,6 @@
/* Support computing hash of code for verified boot */
#undef CONFIG_VBOOT_HASH
-/*
- * Reload the watchdog at 1/2 the watchdog period during hash
- * calculation. When CONFIG_SHA256_HW_ACCELERATE and
- * CONFIG_SHA256_UNROLLED are disabled, the hash calculation may trip
- * the watchdog. This option becomes enabled by default when both
- * those options are disabled.
- */
-#undef CONFIG_VBOOT_HASH_RELOAD_WATCHDOG
-
/* Support for secure temporary storage for verified boot */
#undef CONFIG_VSTORE
@@ -6359,22 +6350,6 @@
"when CONFIG_SYSTEM_UNLOCK is also enabled."
#endif /* CONFIG_BYPASS_CBI_EEPROM_WP_CHECK && !CONFIG_SYSTEM_UNLOCK */
-/*
- * Enable CONFIG_VBOOT_HASH_RELOAD_WATCHDOG by default when these
- * conditions are met:
- * - Watchdog enabled
- * - No hardware acceleration for SHA256 calculation
- * - Loops for SHA256 calculation are not unrolled
- *
- * See the CONFIG_VBOOT_HASH_RELOAD_WATCHDOG entry in this file for an
- * explanation as to why this is necessary.
- */
-#if defined(CONFIG_WATCHDOG) && !defined(CONFIG_SHA256_HW_ACCELERATE) && \
- !defined(CONFIG_SHA256_UNROLLED) && \
- !defined(CONFIG_VBOOT_HASH_RELOAD_WATCHDOG)
-#define CONFIG_VBOOT_HASH_RELOAD_WATCHDOG
-#endif
-
#if !defined(CONFIG_ZEPHYR) && !defined(CONFIG_ACCELGYRO_ICM_COMM_SPI) && \
!defined(CONFIG_ACCELGYRO_ICM_COMM_I2C)
#ifdef I2C_PORT_ACCEL
diff --git a/zephyr/app/ec/ec_app_main.c b/zephyr/app/ec/ec_app_main.c
index c792a2892f..e0efb49475 100644
--- a/zephyr/app/ec/ec_app_main.c
+++ b/zephyr/app/ec/ec_app_main.c
@@ -62,10 +62,6 @@ void ec_app_main(void)
}
}
- if (IS_ENABLED(CONFIG_PLATFORM_EC_WATCHDOG)) {
- watchdog_init();
- }
-
if (IS_ENABLED(CONFIG_PLATFORM_EC_VBOOT)) {
/*
* For RO, it behaves as follows:
@@ -84,6 +80,10 @@ void ec_app_main(void)
*/
k_thread_priority_set(&k_sys_work_q.thread, LOWEST_THREAD_PRIORITY);
+ if (IS_ENABLED(CONFIG_PLATFORM_EC_WATCHDOG)) {
+ watchdog_init();
+ }
+
/* Call init hooks before main tasks start */
if (IS_ENABLED(CONFIG_PLATFORM_EC_HOOKS)) {
hook_notify(HOOK_INIT);