diff options
author | Hung-Te Lin <hungte@chromium.org> | 2022-03-07 16:45:25 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-03-08 01:35:17 +0000 |
commit | 1662f3f83a494a64c7e7d85428a00d4e942d6b8c (patch) | |
tree | 5d17645da05f98867ec6839a16a5c41034325772 | |
parent | 41cc9ec586acf454808efab37626cde7d1f68c46 (diff) | |
download | vboot-1662f3f83a494a64c7e7d85428a00d4e942d6b8c.tar.gz |
futility: updater: always do partial verify (-N/--noverify-all)
The updater should always only update the whole image when write
protection is disabled, or partial (RW) when write protection is
enabled. As a result, it should be better to always turn on -N
(--noverify-all) for two reasons: (1) faster partial write, and
(2) prevent failure due to other processors accessing the flash
in parallel.
- Faster partial write:
On recent x86 Chromebooks the flash size is getting bigger and bigger
(for example 32M on Brya) and the RW section size is much smaller
(8M on Brya). So we wasted a lot of time reading and verifying
sections that we don't care (64M versus 16M) if we don't turn on -N.
- Concurrent access:
On recent x86 devices the system flash is shared by two processors -
the CPU and the CSME. Before the ME is locked, CPU can see and access
all regions - including those managed by ME/CSME. As a result, when
the updater is changing the RW_SECTION, the CSME may be updating
CSE_RO or CSE_RW on its own. So if we don't turn on -N, the
verification will fail in CSE regions.
Also revised to only set FLASHROM_FLAG_VERIFY_AFTER_WRITE one time.
BUG=None
TEST=make; build and run tests.
BRANCH=None
Change-Id: I1ebff2d7f00b85037464eff4fa5d4573f867ce44
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3505290
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
-rw-r--r-- | host/lib/flashrom_drv.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/host/lib/flashrom_drv.c b/host/lib/flashrom_drv.c index 1d9e3fd9..026c2c15 100644 --- a/host/lib/flashrom_drv.c +++ b/host/lib/flashrom_drv.c @@ -191,10 +191,9 @@ int flashrom_write_image(const struct firmware_image *image, flashrom_layout_set(flashctx, layout); } - flashrom_flag_set(flashctx, FLASHROM_FLAG_VERIFY_WHOLE_CHIP, true); - flashrom_flag_set(flashctx, FLASHROM_FLAG_VERIFY_AFTER_WRITE, true); - if (!do_verify) - flashrom_flag_set(flashctx, FLASHROM_FLAG_VERIFY_AFTER_WRITE, false); + flashrom_flag_set(flashctx, FLASHROM_FLAG_VERIFY_WHOLE_CHIP, false); + flashrom_flag_set(flashctx, FLASHROM_FLAG_VERIFY_AFTER_WRITE, + do_verify); r |= flashrom_image_write(flashctx, image->data, image->size, diff_image ? diff_image->data : NULL); |