aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-02-04 14:42:01 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-02-16 14:25:08 +0100
commit2be22bc72d18d92ca9e0c16e56bf309839360f5d (patch)
tree3719e0066cfc4a83bfe3a71d2ab14c3e68bcd69b
parentb5d5edc1d9564b5156230860e494e1279099587d (diff)
downloadqemu-2be22bc72d18d92ca9e0c16e56bf309839360f5d.zip
qemu-2be22bc72d18d92ca9e0c16e56bf309839360f5d.tar.gz
qemu-2be22bc72d18d92ca9e0c16e56bf309839360f5d.tar.bz2
hw/boards: Ensure machine setting auto_create_sdcard expose a SD Bus
Using the auto_create_sdcard feature without SD Bus is irrelevant. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20250204200934.65279-8-philmd@linaro.org>
-rw-r--r--system/vl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/system/vl.c b/system/vl.c
index f9a0526..2a570ed 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -53,6 +53,7 @@
#include "hw/usb.h"
#include "hw/isa/isa.h"
#include "hw/scsi/scsi.h"
+#include "hw/sd/sd.h"
#include "hw/display/vga.h"
#include "hw/firmware/smbios.h"
#include "hw/acpi/acpi.h"
@@ -2661,12 +2662,27 @@ static void qemu_init_displays(void)
static void qemu_init_board(void)
{
+ MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
+
/* process plugin before CPUs are created, but once -smp has been parsed */
qemu_plugin_load_list(&plugin_list, &error_fatal);
/* From here on we enter MACHINE_PHASE_INITIALIZED. */
machine_run_board_init(current_machine, mem_path, &error_fatal);
+ if (machine_class->auto_create_sdcard) {
+ bool ambigous;
+
+ /* Ensure there is a SD bus available to create SD card on */
+ Object *obj = object_resolve_path_type("", TYPE_SD_BUS, &ambigous);
+ if (!obj && !ambigous) {
+ fprintf(stderr, "Can not create sd-card on '%s' machine"
+ " because it lacks a sd-bus\n",
+ machine_class->name);
+ abort();
+ }
+ }
+
drive_check_orphaned();
realtime_init();