Attention is currently required from: Angel Pons.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69196 )
Change subject: layout: Factor out flash_region structure from romentry
......................................................................
Patch Set 2:
(2 comments)
Patchset:
PS2:
> What benefit does this provide?
That's a good question since this patch on its own doesn't have any extra context.
I'll leave this space for Nik to fill in and flesh out as it's his project but just wanted to get him started here. The tl;dr is to get the Intel CSME co-processor to work properly in the writeprotect/layout frameworks.
This patch almost stands on its own merit but just needs some more context. Over to you Nik possibly with a topic and some follow up patches?
File include/layout.h:
https://review.coreboot.org/c/flashrom/+/69196/comment/e959c942_88deb8ca
PS2, Line 42: bool read_prot;
: bool write_prot;
@Nik, when you hijack this patch maybe drop these in this patch and add in a subsequent patch when you need them.
--
To view, visit https://review.coreboot.org/c/flashrom/+/69196
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I768742b73db901df5b5208fcbcb8a324a06014c2
Gerrit-Change-Number: 69196
Gerrit-PatchSet: 2
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Mon, 07 Nov 2022 02:58:38 +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: Anastasia Klimchuk.
Hello build bot (Jenkins), Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/69267
to look at the new patch set (#3).
Change subject: tests: Detect llvm-cov file io and unmock io functions
......................................................................
tests: Detect llvm-cov file io and unmock io functions
Code coverage writes data to disk atexit of the program. We need to
unmock the file io at this point so that the data is really written.
BUG=b:187647884
BRANCH=None
TEST=meson test
TEST=llvm-profdata merge -sparse default.profraw -o default.profdata
TEST=llvm-cov show ./flashrom_unit_tests
-instr-profile=default.profdata --format=html --output-dir=.
Change-Id: I21cc1d631e92fa19006b967e85676f108e80b307
Signed-off-by: Evan Benn <evanbenn(a)chromium.org>
---
M Documentation/building.md
M tests/tests.c
M tests/wraps.h
3 files changed, 56 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/67/69267/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/69267
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I21cc1d631e92fa19006b967e85676f108e80b307
Gerrit-Change-Number: 69267
Gerrit-PatchSet: 3
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Anastasia Klimchuk.
Hello build bot (Jenkins), Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/69266
to look at the new patch set (#3).
Change subject: tests: Detect gcov file io and unmock io functions
......................................................................
tests: Detect gcov file io and unmock io functions
Code coverage writes data to disk atexit of the program. We need to
unmock the file io at this point so that the data is really written.
BUG=b:187647884
BRANCH=None
TEST=meson test
TEST=ninja coverage
Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b
Signed-off-by: Evan Benn <evanbenn(a)chromium.org>
---
M Documentation/building.md
M tests/io_mock.h
M tests/tests.c
M tests/wraps.h
4 files changed, 82 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/66/69266/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/69266
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b
Gerrit-Change-Number: 69266
Gerrit-PatchSet: 3
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Anastasia Klimchuk.
Hello build bot (Jenkins), Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/69266
to look at the new patch set (#2).
Change subject: tests: Detect gcov file io and unmock io functions
......................................................................
tests: Detect gcov file io and unmock io functions
Code coverage writes data to disk atexit of the program. We need to
unmock the file io at this point so that the data is really written.
BUG=b:187647884
BRANCH=None
TEST=meson test
TEST=ninja coverage
Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b
Signed-off-by: Evan Benn <evanbenn(a)chromium.org>
---
M Documentation/building.md
M tests/io_mock.h
M tests/tests.c
M tests/wraps.h
4 files changed, 80 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/66/69266/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/69266
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b
Gerrit-Change-Number: 69266
Gerrit-PatchSet: 2
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Thomas Heijligen, Anastasia Klimchuk.
Hello build bot (Jenkins), Thomas Heijligen, Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/69265
to look at the new patch set (#2).
Change subject: meson: Move meson tests config to top level build file
......................................................................
meson: Move meson tests config to top level build file
meson has a bug with code coverage, moving the test to the top level
build file works around this bug.
https://github.com/mesonbuild/meson/issues/6747
BUG=b:187647884
BRANCH=None
TEST=meson test
Change-Id: Ibba93037831fc0ed526f701cbe360b5a493895d1
Signed-off-by: Evan Benn <evanbenn(a)chromium.org>
---
M meson.build
D tests/meson.build
2 files changed, 131 insertions(+), 126 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/65/69265/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/69265
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibba93037831fc0ed526f701cbe360b5a493895d1
Gerrit-Change-Number: 69265
Gerrit-PatchSet: 2
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Felix Singer, Thomas Heijligen.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/68433 )
Change subject: tests: Add prefix to io_mock functions not to clash with macros
......................................................................
Patch Set 7:
(3 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/68433/comment/5192d2f8_becdb4e1
PS5, Line 13: stays
> typo: stay (without s)
Done
https://review.coreboot.org/c/flashrom/+/68433/comment/8326775a_03b8cc92
PS5, Line 10: because the latter are allowed
: to be macros. Adding a prefix to flashrom mock functions avoids
: them being accidentally expanded. Standard I/O functions are
: expanded and flashrom mocks stays as they are
> Why is it a problem that standard IO functions are macros? <...> How does the prefix prevent that the flashrom mocks are expanded?
The situation is: there are some functions which are allowed to be macros (standard I/O). Which means, the programmer code .c file can have for example `fopen(.....)` but then during pre-processing step `fopen` can be replaced with anything. It depends on the environment, but from the point of view of flashrom unit tests we don't know what `fopen` will be replaced with. And this is totally fine, because fopen is allowed to be a macro.
Now, just by coincidence, we have function pointers in our io_mock framework, which have the same names as standard I/O. So we also have `fopen`, but it's a different one, it is a member of io_mock struct. However, because the name clashes, our own fopen from io_mock is also replaced together with fopen from standard I/O. This is wrong, and should not happen.
The name clash is a coincidence, there are no reasons for the names from io_mock to be the same as standard I/O. We can have any names in io_mock. It makes sense to keep some reference between original and mock function, to have code more readable. This is why the idea was to add a prefix, `iom_`.
With the prefix, names do not clash anymore. Function with name iom_fopen will not be replaced with fopen macro. This is what we need: original functions are pre-processed as needed, but functions in io_mock stay as is.
> I don't understand the relation between that function pointer and the standard I/O functions.
The relation is only logical, as the relation between original function and its custom mock. This is why we can add prefix and rename our function pointers in io_mock.
> Shouldn't undefining _FORTIFY_SOURCE solve that problem? In my understanding standard I/O functions are not expanded when _FORTIFY_SOURCE is undefined.
So just to re-iterate, we have two sets of functions in question: 1) standard I/O 2) flashrom own io_mock
With the help of undefining _FORTIFY_SOURCE we can avoid one of the cases when standard I/O functions are not expanded. _FORTIFY_SOURCE helps to deal with one of the cases for 1) It is very convenient, because it reduces the number of wraps we need, less noise in the code, more readable code.
This patch solves the problem for 2)
In general, there could be many more different macro expansions, which are completely independent of _FORTIFY_SOURCE. And in general, we cannot block them, we actually want the all to work normally. However, we don't want our functions 2) to get expanded. So we make names not to clash and solve this.
File tests/io_mock.h:
https://review.coreboot.org/c/flashrom/+/68433/comment/bd584e3c_cd627f88
PS5, Line 73: /* Port I/O */
: void (*outb)(void *state, unsigned char value, unsigned short port);
: unsigned char (*inb)(void *state, unsigned short port);
:
: void (*outw)(void *state, unsigned short value, unsigned short port);
: unsigned short (*inw)(void *state, unsigned short port);
:
: void (*outl)(void *state, unsigned int value, unsigned short port);
: unsigned int (*inl)(void *state, unsigned short port);
:
: /* USB I/O */
: int (*libusb_init)(void *state, libusb_context **ctx);
: int (*libusb_control_transfer)(void *state,
: libusb_device_handle *devh,
: uint8_t bmRequestType,
: uint8_t bRequest,
: uint16_t wValue,
: uint16_t wIndex,
: unsigned char *data,
: uint16_t wLength,
: unsigned int timeout);
: ssize_t (*libusb_get_device_list)(void *state, libusb_context *, libusb_device ***list);
: void (*libusb_free_device_list)(void *state, libusb_device **list, int unref_devices);
: int (*libusb_get_device_descriptor)(void *state, libusb_device *, struct libusb_device_descriptor *);
: int (*libusb_get_config_descriptor)(void *state,
: libusb_device *,
: uint8_t config_index,
: struct libusb_config_descriptor **);
: void (*libusb_free_config_descriptor)(void *state, struct libusb_config_descriptor *);
> I am wondering, should these functions be renamed as well?
They could, but if they cannot ever be macros, then it doesn't matter.
--
To view, visit https://review.coreboot.org/c/flashrom/+/68433
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I7998a8fb1b9e65621e12adbfab5460a245d5606b
Gerrit-Change-Number: 68433
Gerrit-PatchSet: 7
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Comment-Date: Mon, 07 Nov 2022 02:20:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Felix Singer <felixsinger(a)posteo.net>
Gerrit-MessageType: comment
Attention is currently required from: Thomas Heijligen, Anastasia Klimchuk.
Evan Benn has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69265 )
Change subject: meson: Move meson tests config to top level build file
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
This is not the greatest solution, but the only thing I found that worked. Without this we only get coverage for the tests/*.c files.
Also tried : `CFLAGS="-fprofile-dir="(pwd)"/buildcov/cov" meson setup --wipe buildcov -Db_coverage=true`. That puts the gcda files in the right place, but then the `ninja coverage` step fails as the gcno files are still in the old place.
The llvm code coverage does not need this patch.
--
To view, visit https://review.coreboot.org/c/flashrom/+/69265
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ibba93037831fc0ed526f701cbe360b5a493895d1
Gerrit-Change-Number: 69265
Gerrit-PatchSet: 1
Gerrit-Owner: Evan Benn <evanbenn(a)google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Thomas Heijligen <src(a)posteo.de>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Mon, 07 Nov 2022 02:13:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment