Message ID | 20240529051539.71210-8-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | hw/i386: Remove deprecated pc-i440fx-2.0 -> 2.3 machines | expand |
On Wed, 29 May 2024 07:15:23 +0200 Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > acpi_memory_hotplug::is_enabled is set to %true once via > ich9_lpc_initfn() -> ich9_pm_add_properties(). No need to > check it, so remove now dead code. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> > --- > hw/acpi/ich9.c | 28 ++++++---------------------- > 1 file changed, 6 insertions(+), 22 deletions(-) > > diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c > index 9b605af21a..02d8546bd3 100644 > --- a/hw/acpi/ich9.c > +++ b/hw/acpi/ich9.c > @@ -153,17 +153,10 @@ static int ich9_pm_post_load(void *opaque, int version_id) > .offset = vmstate_offset_pointer(_state, _field, uint8_t), \ > } > > -static bool vmstate_test_use_memhp(void *opaque) > -{ > - ICH9LPCPMRegs *s = opaque; > - return s->acpi_memory_hotplug.is_enabled; > -} > - > static const VMStateDescription vmstate_memhp_state = { > .name = "ich9_pm/memhp", > .version_id = 1, > .minimum_version_id = 1, > - .needed = vmstate_test_use_memhp, > .fields = (const VMStateField[]) { > VMSTATE_MEMORY_HOTPLUG(acpi_memory_hotplug, ICH9LPCPMRegs), > VMSTATE_END_OF_LIST() > @@ -335,11 +328,9 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq) > legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), > OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); > > - if (pm->acpi_memory_hotplug.is_enabled) { > - acpi_memory_hotplug_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), > - &pm->acpi_memory_hotplug, > - ACPI_MEMORY_HOTPLUG_BASE); > - } > + acpi_memory_hotplug_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), > + &pm->acpi_memory_hotplug, > + ACPI_MEMORY_HOTPLUG_BASE); > } > > static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name, > @@ -460,12 +451,7 @@ void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > return; > } > > - if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) && > - !lpc->pm.acpi_memory_hotplug.is_enabled) { > - error_setg(errp, > - "memory hotplug is not enabled: %s.memory-hotplug-support " > - "is not set", object_get_typename(OBJECT(lpc))); > - } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > + 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) && > @@ -509,8 +495,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, > { > ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev); > > - if (lpc->pm.acpi_memory_hotplug.is_enabled && > - object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > acpi_memory_unplug_request_cb(hotplug_dev, > &lpc->pm.acpi_memory_hotplug, dev, > errp); > @@ -545,8 +530,7 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > { > ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev); > > - if (lpc->pm.acpi_memory_hotplug.is_enabled && > - object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > acpi_memory_unplug_cb(&lpc->pm.acpi_memory_hotplug, dev, errp); > } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && > !lpc->pm.cpu_hotplug_legacy) {
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 9b605af21a..02d8546bd3 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -153,17 +153,10 @@ static int ich9_pm_post_load(void *opaque, int version_id) .offset = vmstate_offset_pointer(_state, _field, uint8_t), \ } -static bool vmstate_test_use_memhp(void *opaque) -{ - ICH9LPCPMRegs *s = opaque; - return s->acpi_memory_hotplug.is_enabled; -} - static const VMStateDescription vmstate_memhp_state = { .name = "ich9_pm/memhp", .version_id = 1, .minimum_version_id = 1, - .needed = vmstate_test_use_memhp, .fields = (const VMStateField[]) { VMSTATE_MEMORY_HOTPLUG(acpi_memory_hotplug, ICH9LPCPMRegs), VMSTATE_END_OF_LIST() @@ -335,11 +328,9 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq) legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); - if (pm->acpi_memory_hotplug.is_enabled) { - acpi_memory_hotplug_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), - &pm->acpi_memory_hotplug, - ACPI_MEMORY_HOTPLUG_BASE); - } + acpi_memory_hotplug_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), + &pm->acpi_memory_hotplug, + ACPI_MEMORY_HOTPLUG_BASE); } static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name, @@ -460,12 +451,7 @@ void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, return; } - if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) && - !lpc->pm.acpi_memory_hotplug.is_enabled) { - error_setg(errp, - "memory hotplug is not enabled: %s.memory-hotplug-support " - "is not set", object_get_typename(OBJECT(lpc))); - } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { + 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) && @@ -509,8 +495,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, { ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev); - if (lpc->pm.acpi_memory_hotplug.is_enabled && - object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { acpi_memory_unplug_request_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, dev, errp); @@ -545,8 +530,7 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, { ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev); - if (lpc->pm.acpi_memory_hotplug.is_enabled && - object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { + if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { acpi_memory_unplug_cb(&lpc->pm.acpi_memory_hotplug, dev, errp); } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && !lpc->pm.cpu_hotplug_legacy) {