> -----Original Message-----
> From: Cédric Le Goater <clg@redhat.com>
> Sent: Wednesday, January 22, 2025 3:09 PM
> To: qemu-arm@nongnu.org; qemu-devel@nongnu.org
> Cc: Joel Stanley <joel@jms.id.au>; Andrew Jeffery
> <andrew@codeconstruct.com.au>; Troy Lee <troy_lee@aspeedtech.com>;
> Jamin Lin <jamin_lin@aspeedtech.com>; Steven Lee
> <steven_lee@aspeedtech.com>; Cédric Le Goater <clg@redhat.com>
> Subject: [PATCH 9/9] aspeed: Create sd devices only when defaults are enabled
>
> When the -nodefaults option is set, sd devices should not be automatically
> created by the machine. Instead they should be defined on the command line.
>
> Note that it is not currently possible to define which bus an "sd-card" device is
> attached to:
>
> -blockdev node-name=drive0,driver=file,filename=/path/to/file.img \
> -device sd-card,drive=drive0,id=sd0
>
> and the first bus named "sd-bus" will be used.
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> hw/arm/aspeed.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index
> 53a859a6e4aa..d9418e2b9f2c 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -456,14 +456,14 @@ static void aspeed_machine_init(MachineState
> *machine)
> amc->i2c_init(bmc);
> }
>
> - for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
> + for (i = 0; i < bmc->soc->sdhci.num_slots && defaults_enabled();
> + i++) {
> sdhci_attach_drive(&bmc->soc->sdhci.slots[i],
> drive_get(IF_SD, 0, i), false, false);
> }
>
> boot_emmc = sc->boot_from_emmc(bmc->soc);
>
> - if (bmc->soc->emmc.num_slots) {
> + if (bmc->soc->emmc.num_slots && defaults_enabled()) {
> emmc0 = drive_get(IF_SD, 0, bmc->soc->sdhci.num_slots);
> sdhci_attach_drive(&bmc->soc->emmc.slots[0], emmc0, true,
> boot_emmc);
> }
> --
> 2.48.1
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Thanks