@@ -173,7 +173,7 @@ static void xen_arm_init(MachineState *machine)
xen_init_ram(machine);
- xen_register_ioreq(xam->state, machine->smp.cpus, &xen_memory_listener);
+ xen_register_ioreq(xam->state, machine->smp.max_cpus, &xen_memory_listener);
xen_create_virtio_mmio_devices(xam);
@@ -218,7 +218,26 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data)
MachineClass *mc = MACHINE_CLASS(oc);
mc->desc = "Xen PVH ARM machine";
mc->init = xen_arm_init;
- mc->max_cpus = 1;
+
+ /*
+ * mc->max_cpus holds the MAX value allowed in the -smp command-line opts.
+ *
+ * 1. If users don't pass any -smp option:
+ * ms->smp.cpus will default to 1.
+ * ms->smp.max_cpus will default to 1.
+ *
+ * 2. If users pass -smp X:
+ * ms->smp.cpus will be set to X.
+ * ms->smp.max_cpus will also be set to X.
+ *
+ * 3. If users pass -smp X,maxcpus=Y:
+ * ms->smp.cpus will be set to X.
+ * ms->smp.max_cpus will be set to Y.
+ *
+ * In scenarios 2 and 3, if X or Y are set to something larger than
+ * mc->max_cpus, QEMU will bail out with an error message.
+ */
+ mc->max_cpus = GUEST_MAX_VCPUS;
mc->default_machine_opts = "accel=xen";
/* Set explicitly here to make sure that real ram_size is passed */
mc->default_ram_size = 0;