On 10/27/24 23:11, Guenter Roeck wrote:
On 10/27/24 14:13, Cédric Le Goater wrote:
On 10/26/24 17:32, Guenter Roeck wrote:
On 10/26/24 03:02, Cédric Le Goater wrote:
[ ... ]
I don't mind a single file. What bothers me is that the partitioning is made
mandatory for ast2600 even if not used.
Our only use case, in 2019, was to boot QEMU ast2600 machines from an
eMMC device using an OpenBMC FW image like the ones we find on IBM
Power10 Rainier systems. I agree we only focused on this scenario.
Most of the support should be there for other use cases, and it's now
a question of finding the right tunables for the user.
I did a quick experiment using 2 patches,
one on hw/sd/sd.c to fix c8cb19876d3e ("hw/sd/sdcard: Support boot
area in emmc image")
@@ -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;
and another on hw/arm/aspeed.c to remove the setting of the eMMC
device properties when it is not bootable :
@@ -338,7 +338,7 @@ static void sdhci_attach_drive(SDHCIStat
return;
}
card = qdev_new(emmc ? TYPE_EMMC : TYPE_SD_CARD);
- if (emmc) {
+ if (emmc && boot_emmc) {
qdev_prop_set_uint64(card, "boot-partition-size", 1 * MiB);
qdev_prop_set_uint8(card, "boot-config",
boot_emmc ? 0x1 << 3 : 0x0);
(I am not saying this is correct)
Works for me, though, and it is much better than mandating the existence
of boot partitions.
Yes. However, if the emmc device was user creatable, we could use :
-blockdev node-name=emmc0,driver=file,filename=mmc-ast2600-evb-noboot.raw \
-device emmc,bus=sdhci-bus.2,drive=emmc0
and with boot partitions:
-M boot-emmc=true \
-blockdev node-name=emmc0,driver=file,filename=mmc-ast2600-evb.raw \
-device
emmc,bus=sdhci-bus.2,drive=emmc0,boot-partition-size=1048576,boot-config=8
The above would be my preferred approach if acceptable. The "sd-bus"
bus identifier should be changed in other machines tough.
No real preference here, though my understanding is that emmc devices
are by definition built-in, and that is what emmc_class_init() says as well.
Also, there does not seem to be an sdhci-bus, only sd-bus, and that does
not support any index values. That may be just my lack of knowledge, though.
No, you are right. On a real ast2600-evb, the eMMC device is indeed
soldered on the board. But, for testing purposes, it is sometime
interesting to add some flexibility in the machine definition and
in the modeling too. This avoids "hard-coding" default devices in
the machines and lets the user define its own variant models using
the QEMU command line.
C.
Guenter
If you end up submitting those patches, please feel free to add
Tested-by: Guenter Roeck <li...@roeck-us.net>
I should send these fixes for QEMU 9.2.
Thanks,
C.