Douglas Anderson has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/50155 )
Change subject: WIP: linux_mtd: Disable buffering on the mtd device
......................................................................
WIP: linux_mtd: Disable buffering on the mtd device
We open the device node for the MTD device with this:
dev_fp = fopen(dev_path, "r+")
In C fopen() is allowed to provide _buffered_ access to the file.
That means that the standard library is allowed to read ahead and/or
return cached data. That's really not what we want for something like
this. Let's turn it off.
This fixes a problem where flashrom would sometimes fail to "verify"
that it erased the flash. The error message would look something like
this:
Erasing and writing flash chip... FAILED at 0x0000e220! Expected=0xff, Found=0xe9, failed byte count from 0x0000e200-0x0000e2ff: 0xdc
failed byte count from 0x0000e000-0x0000efff: 0xffffffff
ERASE_FAILED
FAILED!
Uh oh. Erase/write failed. Checking if anything changed.
After the failure I could read the flash device with a new invocation
of flashrom and I would see that, indeed, the erase had worked.
Tracing in the kernel showed that when the failure happened we saw a
pattern that looked like this:
* Read 0x0b00 bytes starting at 0x0000d000
* Read 0x1000 bytes starting at 0x0000db00
* Erase 0x1000 bytes starting at 0x0000e000
...and then there was _not_ a read after the erase. It can be assumed
that, since userspace had already read 0xdb00 - 0xeaff that it was
looking at old buffered data after the erase.
BRANCH=trogdor
BUG=b:178822068
TEST=Loop back and forth writing two BIOS files => no errors
Signed-off-by: Douglas Anderson <dianders(a)chromium.org>
Change-Id: I989afd83a33013b2756a0090d6b08245613215c6
---
M linux_mtd.c
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/55/50155/1
diff --git a/linux_mtd.c b/linux_mtd.c
index d2df95e..22702e9 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -340,6 +340,10 @@
msg_perr("Cannot open file stream for %s\n", dev_path);
goto linux_mtd_setup_exit;
}
+ ret = setvbuf(dev_fp, NULL, _IONBF, 0);
+ if (ret)
+ msg_pwarn("Failed to set MTD device to unbuffered: %d\n", ret);
+
msg_pinfo("Opened %s successfully\n", dev_path);
ret = 0;
--
To view, visit https://review.coreboot.org/c/flashrom/+/50155
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I989afd83a33013b2756a0090d6b08245613215c6
Gerrit-Change-Number: 50155
Gerrit-PatchSet: 1
Gerrit-Owner: Douglas Anderson <dianders(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Sam McNally, Edward O'Callaghan.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49916 )
Change subject: CHROMIUM: flashrom_tester: Drop nix dependency
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
File util/flashrom_tester/src/main.rs:
https://review.coreboot.org/c/flashrom/+/49916/comment/bc510ec4_fd2c9d81
PS1, Line 171: Safe because this doesn't
: // modify any memory.
nit: put the whole sentence in the next line? This way, the comment block is more rectangular
--
To view, visit https://review.coreboot.org/c/flashrom/+/49916
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If7d1c7c7b5663a32c0a338866f7f7f9bee604cc0
Gerrit-Change-Number: 49916
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Sam McNally <sammc(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Sam McNally <sammc(a)google.com>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Comment-Date: Fri, 29 Jan 2021 10:56:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Daniel Kurtz, Sam McNally, Edward O'Callaghan, Peter Marheine.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49915 )
Change subject: CHROMIUM: avl_tool: more gracefully handle termination by SIGINT
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/49915
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If43aea0580fcc7e698daad2ffe085a3c9da5bc41
Gerrit-Change-Number: 49915
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Daniel Kurtz <djkurtz(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Sam McNally <sammc(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Daniel Kurtz <djkurtz(a)chromium.org>
Gerrit-Attention: Sam McNally <sammc(a)google.com>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Fri, 29 Jan 2021 10:55:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Daniel Kurtz, Sam McNally, Edward O'Callaghan, Peter Marheine.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49915 )
Change subject: CHROMIUM: avl_tool: more gracefully handle termination by SIGINT
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49915/comment/c676d400_c788a5df
PS1, Line 7: CHROMIUM:
> happy to drop it, I don't particularly have strong feelings either way. […]
Ah, alright. Thanks for the clarification
--
To view, visit https://review.coreboot.org/c/flashrom/+/49915
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If43aea0580fcc7e698daad2ffe085a3c9da5bc41
Gerrit-Change-Number: 49915
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Daniel Kurtz <djkurtz(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Sam McNally <sammc(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Daniel Kurtz <djkurtz(a)chromium.org>
Gerrit-Attention: Sam McNally <sammc(a)google.com>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Fri, 29 Jan 2021 10:54:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Sam McNally <sammc(a)google.com>
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Daniel Kurtz, Sam McNally, Angel Pons, Peter Marheine.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49915 )
Change subject: CHROMIUM: avl_tool: more gracefully handle termination by SIGINT
......................................................................
Patch Set 1:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49915/comment/911a8892_0946e64a
PS1, Line 7: CHROMIUM:
> What does the `CHROMIUM` prefix mean?
happy to drop it, I don't particularly have strong feelings either way. It simply means its a direct commit from downstream and downstream we prefix upstream commits with `UPSTREAM:`
--
To view, visit https://review.coreboot.org/c/flashrom/+/49915
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If43aea0580fcc7e698daad2ffe085a3c9da5bc41
Gerrit-Change-Number: 49915
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Daniel Kurtz <djkurtz(a)chromium.org>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Sam McNally <sammc(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Daniel Kurtz <djkurtz(a)chromium.org>
Gerrit-Attention: Sam McNally <sammc(a)google.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Fri, 29 Jan 2021 02:16:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sam McNally <sammc(a)google.com>
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/49786 )
Change subject: realtek_mst_i2c_spi.c: Skip return value check for reset function
......................................................................
realtek_mst_i2c_spi.c: Skip return value check for reset function
The return value for reset function can not be guaranteed when
reset success. There is no way to check if reset success or not.
BUG=b:147402710,b:152558985
BRANCH=none
TEST=builds
Signed-off-by: Shiyu Sun <sshiyu(a)chromium.org>
Change-Id: Ia6200f7150db4368c26d8dfe779a9e85184b1b06
Reviewed-on: https://review.coreboot.org/c/flashrom/+/49786
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec(a)chromium.org>
---
M realtek_mst_i2c_spi.c
1 file changed, 7 insertions(+), 3 deletions(-)
Approvals:
build bot (Jenkins): Verified
Edward O'Callaghan: Looks good to me, approved
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 3dd1b36..1bbb71f 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -433,9 +433,13 @@
(struct realtek_mst_i2c_spi_data *)data;
int fd = realtek_mst_data->fd;
if (realtek_mst_data->reset) {
- ret |= realtek_mst_i2c_spi_reset_mpu(fd);
- if (ret != 0)
- msg_perr("%s: MCU failed to reset on tear-down.\n", __func__);
+ /*
+ * Return value for reset mpu is not checked since
+ * the return value is not guaranteed to be 0 on a
+ * success reset. Currently there is no way to fix
+ * that. For more details see b:147402710.
+ */
+ realtek_mst_i2c_spi_reset_mpu(fd);
}
i2c_close(fd);
free(data);
--
To view, visit https://review.coreboot.org/c/flashrom/+/49786
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia6200f7150db4368c26d8dfe779a9e85184b1b06
Gerrit-Change-Number: 49786
Gerrit-PatchSet: 4
Gerrit-Owner: Shiyu Sun <sshiyu(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Shiyu Sun, Angel Pons.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49786 )
Change subject: realtek_mst_i2c_spi.c: Skip return value check for reset function
......................................................................
Patch Set 2:
(1 comment)
File realtek_mst_i2c_spi.c:
https://review.coreboot.org/c/flashrom/+/49786/comment/1627c45d_0f3bff4f
PS1, Line 431: /* Return value for reset mpu is not checked since
: * the return value is not guaranteed to be 0 on a
: * success reset. Currently there is no way to fix that.
: * For more details see b:147402710. */
> Comment style should be: […]
Done
--
To view, visit https://review.coreboot.org/c/flashrom/+/49786
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia6200f7150db4368c26d8dfe779a9e85184b1b06
Gerrit-Change-Number: 49786
Gerrit-PatchSet: 2
Gerrit-Owner: Shiyu Sun <sshiyu(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Shiyu Sun <sshiyu(a)google.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 28 Jan 2021 12:50:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Sam McNally, Edward O'Callaghan, Peter Marheine.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/49915 )
Change subject: CHROMIUM: avl_tool: more gracefully handle termination by SIGINT
......................................................................
Patch Set 1:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/49915/comment/67306649_50bcabc1
PS1, Line 7: CHROMIUM:
> Since it is a new thing for Chromium Flashrom and upstream Flashrom to be collaborating now there is […]
What does the `CHROMIUM` prefix mean?
--
To view, visit https://review.coreboot.org/c/flashrom/+/49915
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If43aea0580fcc7e698daad2ffe085a3c9da5bc41
Gerrit-Change-Number: 49915
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Sam McNally <sammc(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Sam McNally <sammc(a)google.com>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Wed, 27 Jan 2021 09:28:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sam McNally <sammc(a)google.com>
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: comment