[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw/sd/sdcard: Fix calculation of size when using eMMC boot p
From: |
Cédric Le Goater |
Subject: |
Re: [PATCH] hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions |
Date: |
Tue, 29 Oct 2024 09:31:16 +0100 |
User-agent: |
Mozilla Thunderbird |
On 10/28/24 17:23, Jan Luebbe wrote:
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).
Fixes: c8cb19876d3e ("hw/sd/sdcard: Support boot area in emmc image")
Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
---
hw/sd/sd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 2d3467c3d956..8430d5ae361c 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -826,7 +826,9 @@ static void sd_reset(DeviceState *dev)
sect = 0;
}
size = sect << HWBLOCK_SHIFT;
- size -= sd_bootpart_offset(sd);
+ if (sd_is_emmc(sd)) {
+ size -= sd->boot_part_size * 2;
+ }
sect = sd_addr_to_wpnum(size) + 1;
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, (continued)
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Guenter Roeck, 2024/10/26
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Cédric Le Goater, 2024/10/26
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Guenter Roeck, 2024/10/26
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Cédric Le Goater, 2024/10/27
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Guenter Roeck, 2024/10/27
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Cédric Le Goater, 2024/10/27
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Guenter Roeck, 2024/10/27
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Jan Lübbe, 2024/10/28
- Re: [PATCH 0/2] arm: Add collie and sx functional tests, Guenter Roeck, 2024/10/29
- [PATCH] hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions, Jan Luebbe, 2024/10/28
- Re: [PATCH] hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions,
Cédric Le Goater <=