> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
> index 7512be64d67..5716191fff1 100644
> --- a/hw/i386/x86-common.c
> +++ b/hw/i386/x86-common.c
> @@ -183,6 +183,17 @@ void x86_cpu_plug(HotplugHandler *hotplug_dev,
> fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus);
> }
>
> + /*
> + * Non-hotplugged CPUs get their SMM cpu address space initialized in
> + * machine init done notifier: register_smram_listener().
> + *
> + * We need initialize the SMM cpu address space for the hotplugged CPU
> + * specifically.
> + */
> + if (kvm_enabled() && dev->hotplugged &&
> x86_machine_is_smm_enabled(x86ms)) {
> + kvm_smm_cpu_address_space_init(cpu);
> + }
> +
Unfortunately, the original KVM SMM patch caused this bug, but even
more unfortunately, CPU_FOREACH in the machine_done callback is more
fragile than I originally anticipated, now requiring more hack checks to
fix. :-(
IMO, the root of the chaos is that KVM SMM doesn't do this in the CPU
context like TCG did for a long time. I'll find time to sort all this
out.
Regards,
Zhao