All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com, anisinha@redhat.com, philmd@linaro.org,
	kraxel@redhat.com, thuth@redhat.com
Subject: [PATCH v3 17/16] hw/southbridge/ich9: Remove ICH9_LPC_SMI_F_BROADCAST_BIT definition
Date: Thu,  5 Mar 2026 17:06:14 +0100	[thread overview]
Message-ID: <20260305160614.2525174-1-imammedo@redhat.com> (raw)
In-Reply-To: <20260303140058.2423099-1-imammedo@redhat.com>

From: Philippe Mathieu-Daudé <philmd@linaro.org>

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é <philmd@linaro.org>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
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



  parent reply	other threads:[~2026-03-05 16:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25  9:20 [PATCH v2 00/16] hw/i386/pc: Remove deprecated 2.8 and 2.9 PC machines Thomas Huth
2026-02-25  9:20 ` [PATCH v2 01/16] hw/i386/pc: Remove deprecated pc-q35-2.8 and pc-i440fx-2.8 machines Thomas Huth
2026-02-25  9:20 ` [PATCH v2 02/16] hw/i386/pc: Remove pc_compat_2_8[] array Thomas Huth
2026-02-25  9:20 ` [PATCH v2 03/16] hw/i386/kvm: Remove KVMClockState::mach_use_reliable_get_clock field Thomas Huth
2026-02-25  9:20 ` [PATCH v2 04/16] hw/core/machine: Remove hw_compat_2_8[] array Thomas Huth
2026-02-25  9:20 ` [PATCH v2 05/16] hw/block/pflash: Remove PFlashCFI01::old_multiple_chip_handling field Thomas Huth
2026-02-25  9:20 ` [PATCH v2 06/16] hw/pci/pcie: Remove QEMU_PCIE_EXTCAP_INIT definition Thomas Huth
2026-02-25  9:20 ` [PATCH v2 07/16] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_DEVERR definition Thomas Huth
2026-02-25  9:20 ` [PATCH v2 08/16] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_LNKCTL definition Thomas Huth
2026-02-25  9:20 ` [PATCH v2 09/16] hw/virtio/virtio-pci: Remove VIRTIO_PCI_FLAG_INIT_PM definition Thomas Huth
2026-02-25  9:20 ` [PATCH v2 10/16] hw/i386/pc: Remove deprecated pc-q35-2.9 and pc-i440fx-2.9 machines Thomas Huth
2026-02-25  9:20 ` [PATCH v2 11/16] hw/i386/pc: Remove pc_compat_2_9[] array Thomas Huth
2026-02-25  9:20 ` [PATCH v2 12/16] hw/core/machine: Remove hw_compat_2_9[] array Thomas Huth
2026-02-25  9:20 ` [PATCH v2 13/16] hw/net/virtio-net: Remove VirtIONet::mtu_bypass_backend field Thomas Huth
2026-02-25  9:20 ` [PATCH v2 14/16] hw/pci-bridge/gen_pcie_rp: Remove GenPCIERootPort::migrate_msix field Thomas Huth
2026-02-25  9:20 ` [PATCH v2 15/16] hw/i386/x86-iommu: Remove X86IOMMUState::pt_supported field Thomas Huth
2026-03-04 11:25   ` Igor Mammedov
2026-02-25  9:20 ` [PATCH v2 16/16] tests/qtest/test-x86-cpuid-compat: Remove the test with the i440fx-2.9 machine Thomas Huth
2026-02-25 18:26   ` Fabiano Rosas
2026-03-04 11:26   ` Igor Mammedov
2026-03-03 14:00 ` [PATCH 17/16] hw/southbridge/ich9: Remove ICH9_LPC_SMI_F_BROADCAST_BIT definition Igor Mammedov
2026-03-04 17:20   ` Thomas Huth
2026-03-05 12:10     ` Igor Mammedov
2026-03-05 12:33       ` Thomas Huth
2026-03-05 14:32         ` Igor Mammedov
2026-03-05 16:06           ` Igor Mammedov
2026-03-05 16:06   ` Igor Mammedov [this message]
2026-03-05  7:26 ` [PATCH v2 00/16] hw/i386/pc: Remove deprecated 2.8 and 2.9 PC machines Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260305160614.2525174-1-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.