Anastasia Klimchuk submitted this change.

View Change

Approvals: Vincent Fazio: Looks good to me, but someone else must approve build bot (Jenkins): Verified Anastasia Klimchuk: Looks good to me, approved
erasure_layout: Remove redundant verifications from `erase_write`

Previously, in the worst-case scenario of erasing region content then
writing new data, three rounds of verification were performed inside of
the `erase_write` function through calls to:

1. `check_erased_range` when erasing with respect to region boundaries
2. `check_erased_range` for the entire erase block after the loop
containing verification 1 completed
3. `verify_range` when all erases/writes were complete

Verification 2 duplicated verification 1 and was orphaned by commit
fa8808595a, which dropped its paired erasefn call but missed this
related step.

Verification 3 duplicated verification which occurs in
`flashrom_image_write` based on `flashctx flags`.

Now, these 2 redundant verifications are removed to improve the
performance of `erase_write`.

This change was tested using the linux_spi programmer to erase and write
to an MT25QL512 chip.

Change-Id: I638835facd9311979c4991cc4ca41a4b9e174bd5
Signed-off-by: Carly Zlabek <carlyzlabek@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/79354
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
---
M erasure_layout.c
1 file changed, 0 insertions(+), 14 deletions(-)

diff --git a/erasure_layout.c b/erasure_layout.c
index 0c31911..c60305f 100644
--- a/erasure_layout.c
+++ b/erasure_layout.c
@@ -350,13 +350,6 @@
// after erase make it unselected again
erase_layout[i].layout_list[j].selected = false;
msg_cdbg("E(%"PRIx32":%"PRIx32")", start_addr, start_addr + block_len - 1);
- // verify erase
- ret = check_erased_range(flashctx, start_addr, block_len);
- if (ret) {
- msg_cerr("Verifying flash. Erase failed for range %#"PRIx32" : %#"PRIx32", Abort.\n",
- start_addr, start_addr + block_len - 1);
- goto _end;
- }

*all_skipped = false;
}
@@ -385,13 +378,6 @@

*all_skipped = false;
}
- // verify write
- ret = verify_range(flashctx, newcontents + region_start, region_start, region_end - region_start);
- if (ret) {
- msg_cerr("Verifying flash. Write failed for range %#"PRIx32" : %#"PRIx32", Abort.\n",
- region_start, region_end);
- goto _end;
- }

_end:
memcpy(newcontents + region_start, old_start_buf, old_start - region_start);

To view, visit change 79354. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I638835facd9311979c4991cc4ca41a4b9e174bd5
Gerrit-Change-Number: 79354
Gerrit-PatchSet: 3
Gerrit-Owner: Carly Zlabek <carlyzlabek@gmail.com>
Gerrit-Reviewer: Aarya <aarya.chaumal@gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Vincent Fazio <vfazio@gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged