Attention is currently required from: Edward O'Callaghan, Nikolai Artemiev, Anastasia Klimchuk.
Hello build bot (Jenkins), Edward O'Callaghan, Angel Pons, Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/53947
to look at the new patch set (#2).
Change subject: linux_mtd: move global state into programmer data field
......................................................................
linux_mtd: move global state into programmer data field
BUG=b:161951062
BRANCH=none
TEST=builds, reading /dev/mtd0 on Oak succeeds
Change-Id: I5ce6900e4892ed5687cfddb245dfe5461a3e2e84
Signed-off-by: Nikolai Artemiev <nartemiev(a)google.com>
---
M linux_mtd.c
1 file changed, 65 insertions(+), 45 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/47/53947/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/53947
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5ce6900e4892ed5687cfddb245dfe5461a3e2e84
Gerrit-Change-Number: 53947
Gerrit-PatchSet: 2
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
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-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Edward O'Callaghan, Angel Pons, Anastasia Klimchuk.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52958 )
Change subject: buspirate_spi.c: Refactor singleton states into reentrant pattern
......................................................................
Patch Set 2:
(2 comments)
File buspirate_spi.c:
https://review.coreboot.org/c/flashrom/+/52958/comment/cca037ab_c3e0c369
PS2, Line 167: struct buspirate_spi_data *buspirate_data = data;
> I can probably create bp_commbuf as a local variable, alloc at the beginning and free at the end.
Absolutely, yes. As DEFAULT_BUFSIZE is small, it could also live on the
stack in most cases.
> bp_commbufsize is different, I can see why it needs to be in a spi data in flashctx.
AFAICT, it's only there to track the size of `bp_commbuf`. So they should
share a common fate.
I guess Angel is right, somebody tried to optimize things. Not in any way
that would gain us something, though. malloc() and free() are not expensive,
realloc() may be for bigger sizes. Compared to a single byte transferred
over a serial line, it's still nothing.
There's a third alternative. The size is eventually limited by what the
v2 command supports. Somewhere below max_data_read/write is given. We
could just allocate the maximum during init (256 + 5 + 2048 + 1). Define
this as BUFFER_SIZE and let the command functions check that their
parameters fit. Or a combination: use the stack during init, shutdown,
command_v1 and only allocate the buffer if we use command_v2.
https://review.coreboot.org/c/flashrom/+/52958/comment/da0c6345_aa3e5ecb
PS2, Line 325: int bp_commbufsize = 0;
We could declare it as follows
/* 16 bytes data, 3 bytes control. */
unsigned char commbuf[16 + 3];
Then use `sizeof(commbuf)` instead of DEFAULT_BUFSIZE below.
Something similar could be done to buspirate_shutdown(). All other
users of the `bp_commbuf` use buspirate_commbuf_grow() and can use
malloc()/free() instead. Hmm, maybe the v1 function should use the
stack as well?
--
To view, visit https://review.coreboot.org/c/flashrom/+/52958
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I418bbfff15fb126b042fbc9be09dbf59f4d243b8
Gerrit-Change-Number: 52958
Gerrit-PatchSet: 2
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Sat, 08 May 2021 10:50:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Edward O'Callaghan, Nikolai Artemiev, Anastasia Klimchuk.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/53947 )
Change subject: linux_mtd: move global state into programmer data field
......................................................................
Patch Set 1: Code-Review+1
(2 comments)
File linux_mtd.c:
https://review.coreboot.org/c/flashrom/+/53947/comment/9457ea37_002214bf
PS1, Line 411: if
missing a space between `if` and opening brace
https://review.coreboot.org/c/flashrom/+/53947/comment/da4f6ed9_0b6d32a1
PS1, Line 417: free(data);
I would like to put the `free(data);` call after the `linux_mtd_init_exit` label, but the handling of `param` would need to be refactored, which is out of the scope of this patch.
--
To view, visit https://review.coreboot.org/c/flashrom/+/53947
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5ce6900e4892ed5687cfddb245dfe5461a3e2e84
Gerrit-Change-Number: 53947
Gerrit-PatchSet: 1
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
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-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Sat, 08 May 2021 10:29:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Edward O'Callaghan, Nikolai Artemiev.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/53946 )
Change subject: flashchips.c: add support for W25Q32JW..IM
......................................................................
Patch Set 1:
(5 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/53946/comment/33c162d1_7538f38a
PS1, Line 10: commit 1fc77dd1ee27a5d6e58a82c6ed6ed390a15372d7
For reference, this is CL:2160487
(No action needed, this comment just provides a direct link to the upstream change for convenience)
File flashchips.c:
https://review.coreboot.org/c/flashrom/+/53946/comment/eb28bb62_ca7cb4ce
PS1, Line 17583: ..IM
For consistency with W25Q64JW, I'd drop the trailing `..IM` suffix
https://review.coreboot.org/c/flashrom/+/53946/comment/82b761eb_4887ecb9
PS1, Line 17589: FEATURE_WRSR_WREN
Datasheet says that OTP is supported
https://review.coreboot.org/c/flashrom/+/53946/comment/53d9e88b_0474b7ee
PS1, Line 17611: },
Add:
.printlock = spi_prettyprint_status_register_bp2_tb_bpl,
https://review.coreboot.org/c/flashrom/+/53946/comment/c868e9aa_a551106e
PS1, Line 17612: spi_disable_blockprotect
spi_disable_blockprotect_bp2_srwd seems more accurate. Not perfect, but better.
--
To view, visit https://review.coreboot.org/c/flashrom/+/53946
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I7425e12658dd69c4ec8d3309dd591d09a935bb4d
Gerrit-Change-Number: 53946
Gerrit-PatchSet: 1
Gerrit-Owner: Nikolai Artemiev <nartemiev(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: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Comment-Date: Sat, 08 May 2021 10:21:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Anastasia Klimchuk.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52958 )
Change subject: buspirate_spi.c: Refactor singleton states into reentrant pattern
......................................................................
Patch Set 2:
(1 comment)
File buspirate_spi.c:
https://review.coreboot.org/c/flashrom/+/52958/comment/fb9bb438_d943e1bd
PS2, Line 167: struct buspirate_spi_data *buspirate_data = data;
> Thank you for this comment, because I started resolving it and so spent some more time staring at th […]
bp_commbuf was global to minimize the number of times one needs to call malloc() or realloc(). There's a comment in buspirate_commbuf_grow() that gives a hint:
/* Never shrink. realloc() calls are expensive. */
--
To view, visit https://review.coreboot.org/c/flashrom/+/52958
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I418bbfff15fb126b042fbc9be09dbf59f4d243b8
Gerrit-Change-Number: 52958
Gerrit-PatchSet: 2
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Sat, 08 May 2021 10:09:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Angel Pons.
Nikolai Artemiev has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52883 )
Change subject: RFC: flashchips.c: merge GD25B128B/GD25Q128B and GD25Q127C/GD25Q128C
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> Sorry, I'm not convinced. This looks like a workaround for something only downstream uses. […]
Losing FEATURE_QPI definitely isn't ideal. I'm looking into whether the 'B' chips also support QPI; if they do does then I think merging would be ok, but please let me know if there are other issues.
Having a way to ignore a list of chips would be useful too, though I think there is still benefit to merging chips that actually are identical, both for downstream and upstream users.
--
To view, visit https://review.coreboot.org/c/flashrom/+/52883
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I688f2e15aef61afbec728a9a81094bee56d6fbfa
Gerrit-Change-Number: 52883
Gerrit-PatchSet: 1
Gerrit-Owner: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Sat, 08 May 2021 05:07:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Comment-In-Reply-To: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52958 )
Change subject: buspirate_spi.c: Refactor singleton states into reentrant pattern
......................................................................
Patch Set 2:
(1 comment)
File buspirate_spi.c:
https://review.coreboot.org/c/flashrom/+/52958/comment/a426863c_94757414
PS2, Line 167: struct buspirate_spi_data *buspirate_data = data;
> How about an […]
Thank you for this comment, because I started resolving it and so spent some more time staring at the code. And I noticed something!
It looks to me that bp_commbuf does not have a global meaning, its value is rewritten for every send operation (and for shutdown as well). Specifically what I mean is for these functions:
1) buspirate_spi_shutdown
2) buspirate_spi_send_command_v1
3) buspirate_spi_send_command_v2
3) buspirate_spi_init
I can probably create bp_commbuf as a local variable, alloc at the beginning and free at the end.
bp_commbufsize is different, I can see why it needs to be in a spi data in flashctx.
buspirate_commbuf_grow and buspirate_sendrecv can take both as arguments.
What I am worried about is, maybe I am missing something? Why bp_commbuf was initally a global variable, was it just for convenience or for a reason?
What do you think?
--
To view, visit https://review.coreboot.org/c/flashrom/+/52958
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I418bbfff15fb126b042fbc9be09dbf59f4d243b8
Gerrit-Change-Number: 52958
Gerrit-PatchSet: 2
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Sat, 08 May 2021 02:48:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Daniel Campello has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52362 )
Change subject: cli_classic.c: Make -r/-w/-v argument optional
......................................................................
Patch Set 18:
(1 comment)
Patchset:
PS18:
> Daniel, can we go the way of Nico's idea? Like I mention out of band a week or so ago I was never a […]
See my comments on the other CL. For reference on *some* of the call sites: https://source.chromium.org/search?q=%5Cbflashrom%5Cb.*%5Cs(%5C-r%7C%5C-w%7… I believe a migration might be non trivial (if not infeasible) which might mean that we may have to maintain the 2 CLIs separate :(
--
To view, visit https://review.coreboot.org/c/flashrom/+/52362
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I15384b92cb987a6ea1bb4369ef415488b9cf7f41
Gerrit-Change-Number: 52362
Gerrit-PatchSet: 18
Gerrit-Owner: Daniel Campello <campello(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-CC: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Sat, 08 May 2021 01:48:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: comment