On Mon, 2024-09-30 at 15:18 +0100, Peter Maydell wrote:
> On Fri, 6 Sept 2024 at 17:51, Jan Luebbe <j...@pengutronix.de> wrote:
> > 
> > The enable bits in the EXT_CSD_PART_CONFIG ext_csd register do *not*
> > specify whether the boot partitions exist, but whether they are enabled
> > for booting. Existence of the boot partitions is specified by a
> > EXT_CSD_BOOT_MULT != 0.
> > 
> > Currently, in the case of boot-partition-size=1M and boot-config=0,
> > Linux detects boot partitions of 1M. But as sd_bootpart_offset always
> > returns 0, all reads/writes are mapped to the same offset in the backing
> > file.
> > 
> > Fix this bug by calculating the offset independent of which partition is
> > enabled for booting.
> 
> Looking at the spec this change seems correct to me.
> 
> Can you elaborate on when users might run into this bug?
> As far as I can see only aspeed.c sets boot-partition-size,
> and when it does so it also sets boot-config to 8. Or are
> we fixing this for the benefit of future board types?

I stumbled across this when trying to use the eMMC emulation for the RAUC test
suite (with some unrelated local hacks, which I still need to clean up for
submission) [1]. Future boards would be affected as well.

One other possible issue would be disabling the boot partition by using 'mmc
bootpart enable 0 0 /dev/mmcblk0' (or similar) from Linux. The layout of the
backing file shouldn't change in that case.

Regards,
Jan

[1] https://github.com/rauc/rauc/tree/master/test
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Reply via email to