From: Philippe Mathieu-Daudé <[email protected]> The ICH9_LPC_SMI_F_BROADCAST_BIT feature bit was only set in the pc_compat_2_8[] array, via the 'x-smi-broadcast=off' property. We removed all machines using that array, lets remove that property. However the code related to ICH9_LPC_SMI_F_BROADCAST_BIT (OVMF optimization hack) has to stay as SMI broadcast is not what hw do by default, and it will cause guest reboots if SMI is triggered if firmware is not aware about it (SeaBIOS and pretty much everything else except of OVMF).
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Igor Mammedov <[email protected]> --- v3: - use |= when initializing smi_host_features (Thomas) - send SMI broadcast is OVMF hack, and has be be negotiated before it's used v2: - do not check for SMI features if hotplug happens when SMI is not enabled. (matters for qtest and possibly seabios) - removing property also removes default ICH9_LPC_SMI_F_BROADCAST_BIT put default back in place only set it initfn() instead --- hw/acpi/ich9.c | 4 ++-- hw/isa/lpc_ich9.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index bbb1bd60a2..87afe86bcc 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -432,7 +432,7 @@ void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { uint64_t negotiated = lpc->smi_negotiated_features; - if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) && + if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN && !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) { error_setg(errp, "cpu hotplug with SMI wasn't enabled by firmware"); error_append_hint(errp, "update machine type to newer than 5.1 " @@ -476,7 +476,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { uint64_t negotiated = lpc->smi_negotiated_features; - if (negotiated & BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT) && + if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN && !(negotiated & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT))) { error_setg(errp, "cpu hot-unplug with SMI wasn't enabled " "by firmware"); diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 51dc680029..8517ec9cae 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -476,11 +476,12 @@ static void ich9_apm_ctrl_changed(uint32_t val, void *arg) if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN) { if (lpc->smi_negotiated_features & (UINT64_C(1) << ICH9_LPC_SMI_F_BROADCAST_BIT)) { + /* optimization for OVMF with ICH9_LPC_SMI_F_BROADCAST_BIT */ CPUState *cs; CPU_FOREACH(cs) { cpu_interrupt(cs, CPU_INTERRUPT_SMI); } - } else { + } else { /* default ich9 behavior, SeaBIOS doesn't have SMI broadcast */ cpu_interrupt(current_cpu, CPU_INTERRUPT_SMI); } } @@ -685,6 +686,7 @@ static void ich9_lpc_initfn(Object *obj) static const uint8_t acpi_enable_cmd = ICH9_APM_ACPI_ENABLE; static const uint8_t acpi_disable_cmd = ICH9_APM_ACPI_DISABLE; + lpc->smi_host_features |= BIT_ULL(ICH9_LPC_SMI_F_BROADCAST_BIT); object_initialize_child(obj, "rtc", &lpc->rtc, TYPE_MC146818_RTC); @@ -834,8 +836,6 @@ static const Property ich9_lpc_properties[] = { DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, false), DEFINE_PROP_BOOL("smm-compat", ICH9LPCState, pm.smm_compat, false), DEFINE_PROP_BOOL("smm-enabled", ICH9LPCState, pm.smm_enabled, false), - DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features, - ICH9_LPC_SMI_F_BROADCAST_BIT, true), DEFINE_PROP_BIT64("x-smi-cpu-hotplug", ICH9LPCState, smi_host_features, ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT, true), DEFINE_PROP_BIT64("x-smi-cpu-hotunplug", ICH9LPCState, smi_host_features, -- 2.47.3
