]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions
authorJan Luebbe <jlu@pengutronix.de>
Mon, 28 Oct 2024 16:23:08 +0000 (17:23 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 5 Nov 2024 16:14:12 +0000 (19:14 +0300)
commite30319cddd744055757999e45512898cdf2d190c
treecc33b94842985e7d8e22510b0d28c3da90e8f351
parentcbfbd133469e4772bb369e130dc30195385b1e5b
hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions

The sd_bootpart_offset() function calculates the *runtime* offset which
changes as the guest switches between accessing the main user data area
and the boot partitions by writing to the EXT_CSD_PART_CONFIG_ACC_MASK
bits, so it shouldn't be used to calculate the main user data area size.

Instead, subtract the boot_part_size directly (twice, as there are two
identical boot partitions defined by the eMMC spec).

Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Fixes: c8cb19876d3e ("hw/sd/sdcard: Support boot area in emmc image")
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
(cherry picked from commit c078298301a8c72fe12da85d94372689196628bc)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/sd/sd.c