Anastasia Klimchuk has submitted this change. ( https://review.coreboot.org/c/flashrom/+/80771?usp=email )
Change subject: linux_mtd: Provide no-op delay implementation ......................................................................
linux_mtd: Provide no-op delay implementation
Flashrom has several magic programmer_delay() calls scattered throughout its codebase (see cli_classic.s/main() and flashrom.c/flashrom_image_write(), at least). These delays are superfluous for the linux_mtd programmer, because it's an opaque programmer in which all protocol details are handled by the kernel driver.
Stub out the delay function, so we don't waste up to 1.1 seconds of needless delay time, depending on the operation and CLI vs libflashrom usage.
BUG=b:325539928 TEST=`elogtool add 0xa7` on a linux_mtd system (such as a Mediatek Chromebook): Time improvement - reduces from ~1.5s wall clock to about 0.4s CPU usage: -90%, as most of the CPU cycles (before this change) are spent in needless magic-delay busy loops
Change-Id: I3ac69d3fd7cfc689c5b32c130d044516ed846c29 Signed-off-by: Brian Norris briannorris@chromium.org Reviewed-on: https://review.coreboot.org/c/flashrom/+/80771 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Anastasia Klimchuk aklm@chromium.org --- M linux_mtd.c 1 file changed, 9 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Anastasia Klimchuk: Looks good to me, approved
diff --git a/linux_mtd.c b/linux_mtd.c index 495db9a..eea0cf2 100644 --- a/linux_mtd.c +++ b/linux_mtd.c @@ -429,6 +429,14 @@ return FLASHROM_WP_ERR_RANGE_LIST_UNAVAILABLE; }
+static void linux_mtd_nop_delay(const struct flashctx *flash, unsigned int usecs) +{ + /* + * Ignore delay requests. The Linux MTD framework brokers all flash + * protocol, including timing, resets, etc. + */ +} + static const struct opaque_master linux_mtd_opaque_master = { /* max_data_{read,write} don't have any effect for this programmer */ .max_data_read = MAX_DATA_UNSPECIFIED, @@ -441,6 +449,7 @@ .wp_read_cfg = linux_mtd_wp_read_cfg, .wp_write_cfg = linux_mtd_wp_write_cfg, .wp_get_ranges = linux_mtd_wp_get_available_ranges, + .delay = linux_mtd_nop_delay, };
/* Returns 0 if setup is successful, non-zero to indicate error */