diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 82a7daa188385b9275bc61160cfa4eb274edf18b..d045e8b4547e1da3c79d7275491103a22789d52a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1524,6 +1524,7 @@ static void pc_generic_machine_class_init(ObjectClass *oc, void *data) mc->hot_add_cpu = qm->hot_add_cpu; mc->kvm_type = qm->kvm_type; mc->block_default_type = qm->block_default_type; + mc->units_per_default_bus = qm->units_per_default_bus; mc->max_cpus = qm->max_cpus; mc->no_serial = qm->no_serial; mc->no_parallel = qm->no_parallel; diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index d4a907c71b7fa748d3c42516a605a1118a09bcda..b28ddbb74239bb913e276013dc74fb44c8e50067 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -344,7 +344,8 @@ static void pc_q35_init_1_4(MachineState *machine) #define PC_Q35_MACHINE_OPTIONS \ PC_DEFAULT_MACHINE_OPTIONS, \ .desc = "Standard PC (Q35 + ICH9, 2009)", \ - .hot_add_cpu = pc_hot_add_cpu + .hot_add_cpu = pc_hot_add_cpu, \ + .units_per_default_bus = 1 #define PC_Q35_2_2_MACHINE_OPTIONS \ PC_Q35_MACHINE_OPTIONS, \ diff --git a/include/hw/boards.h b/include/hw/boards.h index dfb6718dc184c8c3eb0fe2392703a386f8efe767..663f16acdd2e655f636c5c9c1960f8e72ca501f2 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -28,6 +28,7 @@ struct QEMUMachine { QEMUMachineHotAddCPUFunc *hot_add_cpu; QEMUMachineGetKvmtypeFunc *kvm_type; BlockInterfaceType block_default_type; + int units_per_default_bus; int max_cpus; unsigned int no_serial:1, no_parallel:1, @@ -86,6 +87,7 @@ struct MachineClass { int (*kvm_type)(const char *arg); BlockInterfaceType block_default_type; + int units_per_default_bus; int max_cpus; unsigned int no_serial:1, no_parallel:1, diff --git a/vl.c b/vl.c index 4bc8f97c25a2e300bf856fec177e69fbcc51125b..debcbcceea8957dd342ec00d08768dc1925bae85 100644 --- a/vl.c +++ b/vl.c @@ -1585,6 +1585,7 @@ static void machine_class_init(ObjectClass *oc, void *data) mc->hot_add_cpu = qm->hot_add_cpu; mc->kvm_type = qm->kvm_type; mc->block_default_type = qm->block_default_type; + mc->units_per_default_bus = qm->units_per_default_bus; mc->max_cpus = qm->max_cpus; mc->no_serial = qm->no_serial; mc->no_parallel = qm->no_parallel; @@ -4375,6 +4376,13 @@ int main(int argc, char **argv, char **envp) blk_mig_init(); ram_mig_init(); + /* If the currently selected machine wishes to override the units-per-bus + * property of its default HBA interface type, do so now. */ + if (machine_class->units_per_default_bus) { + override_max_devs(machine_class->block_default_type, + machine_class->units_per_default_bus); + } + /* open the virtual block devices */ if (snapshot) qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, NULL, 0);