Attention is currently required from: Bao Zheng, Jason Glenesk, Raul Rangel, Marshall Dawson, Matt DeVillier, Zheng Bao, Martin Roth, Fred Reitberger, Felix Held.
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/74260 )
Change subject: soc/amd/spi: Mmap 32M/64M flash
......................................................................
Patch Set 7:
(1 comment)
File src/soc/amd/common/block/lpc/spi_map_big.c:
https://review.coreboot.org/c/coreboot/+/74260/comment/111d9845_69fcdbba
PS7, Line 30: spi_write32(SPI_ROM_PAGE, offset / ROM_MAP_SIZE);
I may misunderstand what this does, but I don't think this is safe. It looks like you have a single SPI_ROM_PAGE register that determines what part of the SPI flash is currently mapped in mdev->base?
If so, you can't do this. rdev mappings are allowed to be valid concurrently, i.e. it's legal for someone to do
```
uint32_t *a = rdev_mmap(your_rdev, 0, 0x1000);
uint32_t *b = rdev_mmap(your_rdev, 0x100000, 0x1000);
uint32_t sum = *a + *b;
rdev_munmap(a);
rdev_munmap(b);
```
I think with your implementation here that would explode? You can't have every mmap() call invalidate the pointer returned by the previous one. If your hardware doesn't support keeping different mappings alive concurrently, you'll have to fall back to memory-backed mappings via mmap_helper like drivers/spi/cbfs_spi.c does.
--
To view, visit
https://review.coreboot.org/c/coreboot/+/74260
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ibd2bf1390635494443cac9ee8600a4a741a78c0d
Gerrit-Change-Number: 74260
Gerrit-PatchSet: 7
Gerrit-Owner: Bao Zheng
fishbaozi@gmail.com
Gerrit-Reviewer: Felix Held
felix-coreboot@felixheld.de
Gerrit-Reviewer: Fred Reitberger
reitbergerfred@gmail.com
Gerrit-Reviewer: Jason Glenesk
jason.glenesk@gmail.com
Gerrit-Reviewer: Marshall Dawson
marshalldawson3rd@gmail.com
Gerrit-Reviewer: Martin Roth
martin.roth@amd.corp-partner.google.com
Gerrit-Reviewer: Matt DeVillier
matt.devillier@amd.corp-partner.google.com
Gerrit-Reviewer: Raul Rangel
rrangel@chromium.org
Gerrit-Reviewer: Zheng Bao
Gerrit-Reviewer: build bot (Jenkins)
no-reply@coreboot.org
Gerrit-CC: Julius Werner
jwerner@chromium.org
Gerrit-CC: Nico Huber
nico.h@gmx.de
Gerrit-Attention: Bao Zheng
fishbaozi@gmail.com
Gerrit-Attention: Jason Glenesk
jason.glenesk@gmail.com
Gerrit-Attention: Raul Rangel
rrangel@chromium.org
Gerrit-Attention: Marshall Dawson
marshalldawson3rd@gmail.com
Gerrit-Attention: Matt DeVillier
matt.devillier@amd.corp-partner.google.com
Gerrit-Attention: Zheng Bao
Gerrit-Attention: Martin Roth
martin.roth@amd.corp-partner.google.com
Gerrit-Attention: Fred Reitberger
reitbergerfred@gmail.com
Gerrit-Attention: Felix Held
felix-coreboot@felixheld.de
Gerrit-Comment-Date: Tue, 25 Apr 2023 00:56:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment