Message ID | 1463496205-251412-21-git-send-email-imammedo@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 05/17/2016 05:43 PM, Igor Mammedov wrote: > add necessary wiring to init new CPU hotplug hardware > if ICH9-LPC.cpu-hotplug-legacy is "off". > Set ICH9-LPC.cpu-hotplug-legacy to "off" by default and > switch legacy hotplug to enabled only for 2.6 and older > machine types. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > --- > v1: > - drop ICH9-LPC.cpu-hotplug property > --- > hw/acpi/ich9.c | 42 +++++++++++++++++++++++++++++++++++++----- > include/hw/acpi/ich9.h | 6 +++++- > include/hw/compat.h | 6 +++++- > 3 files changed, 47 insertions(+), 7 deletions(-) > > diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c > index 121e30c..b0285b9 100644 > --- a/hw/acpi/ich9.c > +++ b/hw/acpi/ich9.c > @@ -170,6 +170,24 @@ static const VMStateDescription vmstate_memhp_state = { > } > }; > > +static bool vmstate_test_use_cpuhp(void *opaque) > +{ > + ICH9LPCPMRegs *s = opaque; > + return !s->cpu_hotplug_legacy; > +} > + > +static const VMStateDescription vmstate_cpuhp_state = { > + .name = "ich9_pm/cpuhp", > + .version_id = 1, > + .minimum_version_id = 1, > + .minimum_version_id_old = 1, > + .needed = vmstate_test_use_cpuhp, > + .fields = (VMStateField[]) { > + VMSTATE_CPU_HOTPLUG(cpuhp.state, ICH9LPCPMRegs), > + VMSTATE_END_OF_LIST() > + } > +}; > + > static bool vmstate_test_use_tco(void *opaque) > { > ICH9LPCPMRegs *s = opaque; > @@ -209,6 +227,7 @@ const VMStateDescription vmstate_ich9_pm = { > .subsections = (const VMStateDescription*[]) { > &vmstate_memhp_state, > &vmstate_tco_io_state, > + &vmstate_cpuhp_state, > NULL > } > }; > @@ -275,7 +294,10 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, > > if (pm->cpu_hotplug_legacy) { > legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), > - OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); > + OBJECT(lpc_pci), &pm->cpuhp.legacy, ICH9_CPU_HOTPLUG_IO_BASE); > + } else { > + cpu_hotplug_hw_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), > + &pm->cpuhp.state, ICH9_CPU_HOTPLUG_IO_BASE); > } > > if (pm->acpi_memory_hotplug.is_enabled) { > @@ -414,7 +436,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp) > { > static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; > pm->acpi_memory_hotplug.is_enabled = true; > - pm->cpu_hotplug_legacy = true; Maybe is too soon to disable legacy CPU hotplug? Will the new cpu hotplug mechanism work from this patch on, or it will break git bisect? Thanks, Marcel > pm->disable_s3 = 0; > pm->disable_s4 = 0; > pm->s4_val = 2; > @@ -461,9 +482,13 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, > dev, errp); > - } else if (lpc->pm.cpu_hotplug_legacy && > - object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > - legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp); > + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > + if (lpc->pm.cpu_hotplug_legacy) { > + legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.legacy, dev, > + errp); > + } else { > + acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.state, dev, errp); > + } > } else { > error_setg(errp, "acpi: device plug request for not supported device" > " type: %s", object_get_typename(OBJECT(dev))); > @@ -480,6 +505,10 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, > acpi_memory_unplug_request_cb(hotplug_dev, > &lpc->pm.acpi_memory_hotplug, dev, > errp); > + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && > + !lpc->pm.cpu_hotplug_legacy) { > + acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp.state, > + dev, errp); > } else { > error_setg(errp, "acpi: device unplug request for not supported device" > " type: %s", object_get_typename(OBJECT(dev))); > @@ -494,6 +523,9 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > if (lpc->pm.acpi_memory_hotplug.is_enabled && > 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) { > + acpi_cpu_unplug_cb(&lpc->pm.cpuhp.state, dev, errp); > } else { > error_setg(errp, "acpi: device unplug for not supported device" > " type: %s", object_get_typename(OBJECT(dev))); > diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h > index e29a856..198c017 100644 > --- a/include/hw/acpi/ich9.h > +++ b/include/hw/acpi/ich9.h > @@ -23,6 +23,7 @@ > > #include "hw/acpi/acpi.h" > #include "hw/acpi/cpu_hotplug.h" > +#include "hw/acpi/cpu.h" > #include "hw/acpi/memory_hotplug.h" > #include "hw/acpi/acpi_dev_interface.h" > #include "hw/acpi/tco.h" > @@ -49,7 +50,10 @@ typedef struct ICH9LPCPMRegs { > Notifier powerdown_notifier; > > bool cpu_hotplug_legacy; > - AcpiCpuHotplug gpe_cpu; > + union { > + AcpiCpuHotplug legacy; /* used for keeping legacy state */ > + CPUHotplugState state; > + } cpuhp; > > MemHotplugState acpi_memory_hotplug; > > diff --git a/include/hw/compat.h b/include/hw/compat.h > index 636befe..a65d9d2 100644 > --- a/include/hw/compat.h > +++ b/include/hw/compat.h > @@ -2,7 +2,11 @@ > #define HW_COMPAT_H > > #define HW_COMPAT_2_6 \ > - /* empty */ > + {\ > + .driver = "ICH9-LPC",\ > + .property = "cpu-hotplug-legacy",\ > + .value = "on",\ > + },\ > > #define HW_COMPAT_2_5 \ > {\ >
On Mon, 30 May 2016 22:02:31 +0300 Marcel Apfelbaum <marcel@redhat.com> wrote: > On 05/17/2016 05:43 PM, Igor Mammedov wrote: > > add necessary wiring to init new CPU hotplug hardware > > if ICH9-LPC.cpu-hotplug-legacy is "off". > > Set ICH9-LPC.cpu-hotplug-legacy to "off" by default and > > switch legacy hotplug to enabled only for 2.6 and older > > machine types. > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > > --- > > v1: > > - drop ICH9-LPC.cpu-hotplug property > > --- > > hw/acpi/ich9.c | 42 +++++++++++++++++++++++++++++++++++++----- > > include/hw/acpi/ich9.h | 6 +++++- > > include/hw/compat.h | 6 +++++- > > 3 files changed, 47 insertions(+), 7 deletions(-) > > > > diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c > > index 121e30c..b0285b9 100644 > > --- a/hw/acpi/ich9.c > > +++ b/hw/acpi/ich9.c > > @@ -170,6 +170,24 @@ static const VMStateDescription vmstate_memhp_state = { > > } > > }; > > > > +static bool vmstate_test_use_cpuhp(void *opaque) > > +{ > > + ICH9LPCPMRegs *s = opaque; > > + return !s->cpu_hotplug_legacy; > > +} > > + > > +static const VMStateDescription vmstate_cpuhp_state = { > > + .name = "ich9_pm/cpuhp", > > + .version_id = 1, > > + .minimum_version_id = 1, > > + .minimum_version_id_old = 1, > > + .needed = vmstate_test_use_cpuhp, > > + .fields = (VMStateField[]) { > > + VMSTATE_CPU_HOTPLUG(cpuhp.state, ICH9LPCPMRegs), > > + VMSTATE_END_OF_LIST() > > + } > > +}; > > + > > static bool vmstate_test_use_tco(void *opaque) > > { > > ICH9LPCPMRegs *s = opaque; > > @@ -209,6 +227,7 @@ const VMStateDescription vmstate_ich9_pm = { > > .subsections = (const VMStateDescription*[]) { > > &vmstate_memhp_state, > > &vmstate_tco_io_state, > > + &vmstate_cpuhp_state, > > NULL > > } > > }; > > @@ -275,7 +294,10 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, > > > > if (pm->cpu_hotplug_legacy) { > > legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), > > - OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); > > + OBJECT(lpc_pci), &pm->cpuhp.legacy, ICH9_CPU_HOTPLUG_IO_BASE); > > + } else { > > + cpu_hotplug_hw_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), > > + &pm->cpuhp.state, ICH9_CPU_HOTPLUG_IO_BASE); > > } > > > > if (pm->acpi_memory_hotplug.is_enabled) { > > @@ -414,7 +436,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp) > > { > > static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; > > pm->acpi_memory_hotplug.is_enabled = true; > > - pm->cpu_hotplug_legacy = true; > > Maybe is too soon to disable legacy CPU hotplug? Will the new cpu hotplug mechanism > work from this patch on, or it will break git bisect? it doesn't break bisect compile wise nor 'make check' wise, but it's hotplug won't be functional till acpi: add CPU hotplug methods to DSDT perhaps I need to move it there or into a separate patch after it. > > Thanks, > Marcel > > > pm->disable_s3 = 0; > > pm->disable_s4 = 0; > > pm->s4_val = 2; > > @@ -461,9 +482,13 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > > object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > > acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, > > dev, errp); > > - } else if (lpc->pm.cpu_hotplug_legacy && > > - object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > > - legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp); > > + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > > + if (lpc->pm.cpu_hotplug_legacy) { > > + legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.legacy, dev, > > + errp); > > + } else { > > + acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.state, dev, errp); > > + } > > } else { > > error_setg(errp, "acpi: device plug request for not supported device" > > " type: %s", object_get_typename(OBJECT(dev))); > > @@ -480,6 +505,10 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, > > acpi_memory_unplug_request_cb(hotplug_dev, > > &lpc->pm.acpi_memory_hotplug, dev, > > errp); > > + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && > > + !lpc->pm.cpu_hotplug_legacy) { > > + acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp.state, > > + dev, errp); > > } else { > > error_setg(errp, "acpi: device unplug request for not supported device" > > " type: %s", object_get_typename(OBJECT(dev))); > > @@ -494,6 +523,9 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > > if (lpc->pm.acpi_memory_hotplug.is_enabled && > > 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) { > > + acpi_cpu_unplug_cb(&lpc->pm.cpuhp.state, dev, errp); > > } else { > > error_setg(errp, "acpi: device unplug for not supported device" > > " type: %s", object_get_typename(OBJECT(dev))); > > diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h > > index e29a856..198c017 100644 > > --- a/include/hw/acpi/ich9.h > > +++ b/include/hw/acpi/ich9.h > > @@ -23,6 +23,7 @@ > > > > #include "hw/acpi/acpi.h" > > #include "hw/acpi/cpu_hotplug.h" > > +#include "hw/acpi/cpu.h" > > #include "hw/acpi/memory_hotplug.h" > > #include "hw/acpi/acpi_dev_interface.h" > > #include "hw/acpi/tco.h" > > @@ -49,7 +50,10 @@ typedef struct ICH9LPCPMRegs { > > Notifier powerdown_notifier; > > > > bool cpu_hotplug_legacy; > > - AcpiCpuHotplug gpe_cpu; > > + union { > > + AcpiCpuHotplug legacy; /* used for keeping legacy state */ > > + CPUHotplugState state; > > + } cpuhp; > > > > MemHotplugState acpi_memory_hotplug; > > > > diff --git a/include/hw/compat.h b/include/hw/compat.h > > index 636befe..a65d9d2 100644 > > --- a/include/hw/compat.h > > +++ b/include/hw/compat.h > > @@ -2,7 +2,11 @@ > > #define HW_COMPAT_H > > > > #define HW_COMPAT_2_6 \ > > - /* empty */ > > + {\ > > + .driver = "ICH9-LPC",\ > > + .property = "cpu-hotplug-legacy",\ > > + .value = "on",\ > > + },\ > > > > #define HW_COMPAT_2_5 \ > > {\ > > >
On 05/31/2016 01:06 PM, Igor Mammedov wrote: > On Mon, 30 May 2016 22:02:31 +0300 > Marcel Apfelbaum <marcel@redhat.com> wrote: > >> On 05/17/2016 05:43 PM, Igor Mammedov wrote: >>> add necessary wiring to init new CPU hotplug hardware >>> if ICH9-LPC.cpu-hotplug-legacy is "off". >>> Set ICH9-LPC.cpu-hotplug-legacy to "off" by default and >>> switch legacy hotplug to enabled only for 2.6 and older >>> machine types. >>> >>> Signed-off-by: Igor Mammedov <imammedo@redhat.com> >>> --- >>> v1: >>> - drop ICH9-LPC.cpu-hotplug property >>> --- >>> hw/acpi/ich9.c | 42 +++++++++++++++++++++++++++++++++++++----- >>> include/hw/acpi/ich9.h | 6 +++++- >>> include/hw/compat.h | 6 +++++- >>> 3 files changed, 47 insertions(+), 7 deletions(-) >>> >>> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c >>> index 121e30c..b0285b9 100644 >>> --- a/hw/acpi/ich9.c >>> +++ b/hw/acpi/ich9.c >>> @@ -170,6 +170,24 @@ static const VMStateDescription vmstate_memhp_state = { >>> } >>> }; >>> >>> +static bool vmstate_test_use_cpuhp(void *opaque) >>> +{ >>> + ICH9LPCPMRegs *s = opaque; >>> + return !s->cpu_hotplug_legacy; >>> +} >>> + >>> +static const VMStateDescription vmstate_cpuhp_state = { >>> + .name = "ich9_pm/cpuhp", >>> + .version_id = 1, >>> + .minimum_version_id = 1, >>> + .minimum_version_id_old = 1, >>> + .needed = vmstate_test_use_cpuhp, >>> + .fields = (VMStateField[]) { >>> + VMSTATE_CPU_HOTPLUG(cpuhp.state, ICH9LPCPMRegs), >>> + VMSTATE_END_OF_LIST() >>> + } >>> +}; >>> + >>> static bool vmstate_test_use_tco(void *opaque) >>> { >>> ICH9LPCPMRegs *s = opaque; >>> @@ -209,6 +227,7 @@ const VMStateDescription vmstate_ich9_pm = { >>> .subsections = (const VMStateDescription*[]) { >>> &vmstate_memhp_state, >>> &vmstate_tco_io_state, >>> + &vmstate_cpuhp_state, >>> NULL >>> } >>> }; >>> @@ -275,7 +294,10 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, >>> >>> if (pm->cpu_hotplug_legacy) { >>> legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), >>> - OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); >>> + OBJECT(lpc_pci), &pm->cpuhp.legacy, ICH9_CPU_HOTPLUG_IO_BASE); >>> + } else { >>> + cpu_hotplug_hw_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), >>> + &pm->cpuhp.state, ICH9_CPU_HOTPLUG_IO_BASE); >>> } >>> >>> if (pm->acpi_memory_hotplug.is_enabled) { >>> @@ -414,7 +436,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp) >>> { >>> static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; >>> pm->acpi_memory_hotplug.is_enabled = true; >>> - pm->cpu_hotplug_legacy = true; >> >> Maybe is too soon to disable legacy CPU hotplug? Will the new cpu hotplug mechanism >> work from this patch on, or it will break git bisect? > it doesn't break bisect compile wise nor 'make check' wise, > but it's hotplug won't be functional till > acpi: add CPU hotplug methods to DSDT > perhaps I need to move it there or into a separate patch after it. > Exactly, I would move the "enabling" code after the new hotplug mechanism is functional. The same for the next patch for piix4. Thanks, Marcel >> >> Thanks, >> Marcel >> >>> pm->disable_s3 = 0; >>> pm->disable_s4 = 0; >>> pm->s4_val = 2; >>> @@ -461,9 +482,13 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, >>> object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { >>> acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, >>> dev, errp); >>> - } else if (lpc->pm.cpu_hotplug_legacy && >>> - object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { >>> - legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp); >>> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { >>> + if (lpc->pm.cpu_hotplug_legacy) { >>> + legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.legacy, dev, >>> + errp); >>> + } else { >>> + acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.state, dev, errp); >>> + } >>> } else { >>> error_setg(errp, "acpi: device plug request for not supported device" >>> " type: %s", object_get_typename(OBJECT(dev))); >>> @@ -480,6 +505,10 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, >>> acpi_memory_unplug_request_cb(hotplug_dev, >>> &lpc->pm.acpi_memory_hotplug, dev, >>> errp); >>> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && >>> + !lpc->pm.cpu_hotplug_legacy) { >>> + acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp.state, >>> + dev, errp); >>> } else { >>> error_setg(errp, "acpi: device unplug request for not supported device" >>> " type: %s", object_get_typename(OBJECT(dev))); >>> @@ -494,6 +523,9 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, >>> if (lpc->pm.acpi_memory_hotplug.is_enabled && >>> 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) { >>> + acpi_cpu_unplug_cb(&lpc->pm.cpuhp.state, dev, errp); >>> } else { >>> error_setg(errp, "acpi: device unplug for not supported device" >>> " type: %s", object_get_typename(OBJECT(dev))); >>> diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h >>> index e29a856..198c017 100644 >>> --- a/include/hw/acpi/ich9.h >>> +++ b/include/hw/acpi/ich9.h >>> @@ -23,6 +23,7 @@ >>> >>> #include "hw/acpi/acpi.h" >>> #include "hw/acpi/cpu_hotplug.h" >>> +#include "hw/acpi/cpu.h" >>> #include "hw/acpi/memory_hotplug.h" >>> #include "hw/acpi/acpi_dev_interface.h" >>> #include "hw/acpi/tco.h" >>> @@ -49,7 +50,10 @@ typedef struct ICH9LPCPMRegs { >>> Notifier powerdown_notifier; >>> >>> bool cpu_hotplug_legacy; >>> - AcpiCpuHotplug gpe_cpu; >>> + union { >>> + AcpiCpuHotplug legacy; /* used for keeping legacy state */ >>> + CPUHotplugState state; >>> + } cpuhp; >>> >>> MemHotplugState acpi_memory_hotplug; >>> >>> diff --git a/include/hw/compat.h b/include/hw/compat.h >>> index 636befe..a65d9d2 100644 >>> --- a/include/hw/compat.h >>> +++ b/include/hw/compat.h >>> @@ -2,7 +2,11 @@ >>> #define HW_COMPAT_H >>> >>> #define HW_COMPAT_2_6 \ >>> - /* empty */ >>> + {\ >>> + .driver = "ICH9-LPC",\ >>> + .property = "cpu-hotplug-legacy",\ >>> + .value = "on",\ >>> + },\ >>> >>> #define HW_COMPAT_2_5 \ >>> {\ >>> >> >
On Tue, 31 May 2016 13:21:20 +0300 Marcel Apfelbaum <marcel@redhat.com> wrote: > On 05/31/2016 01:06 PM, Igor Mammedov wrote: > > On Mon, 30 May 2016 22:02:31 +0300 > > Marcel Apfelbaum <marcel@redhat.com> wrote: > > > >> On 05/17/2016 05:43 PM, Igor Mammedov wrote: > >>> add necessary wiring to init new CPU hotplug hardware > >>> if ICH9-LPC.cpu-hotplug-legacy is "off". > >>> Set ICH9-LPC.cpu-hotplug-legacy to "off" by default and > >>> switch legacy hotplug to enabled only for 2.6 and older > >>> machine types. > >>> > >>> Signed-off-by: Igor Mammedov <imammedo@redhat.com> > >>> --- > >>> v1: > >>> - drop ICH9-LPC.cpu-hotplug property > >>> --- > >>> hw/acpi/ich9.c | 42 +++++++++++++++++++++++++++++++++++++----- > >>> include/hw/acpi/ich9.h | 6 +++++- > >>> include/hw/compat.h | 6 +++++- > >>> 3 files changed, 47 insertions(+), 7 deletions(-) > >>> > >>> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c > >>> index 121e30c..b0285b9 100644 > >>> --- a/hw/acpi/ich9.c > >>> +++ b/hw/acpi/ich9.c > >>> @@ -170,6 +170,24 @@ static const VMStateDescription vmstate_memhp_state = { > >>> } > >>> }; > >>> > >>> +static bool vmstate_test_use_cpuhp(void *opaque) > >>> +{ > >>> + ICH9LPCPMRegs *s = opaque; > >>> + return !s->cpu_hotplug_legacy; > >>> +} > >>> + > >>> +static const VMStateDescription vmstate_cpuhp_state = { > >>> + .name = "ich9_pm/cpuhp", > >>> + .version_id = 1, > >>> + .minimum_version_id = 1, > >>> + .minimum_version_id_old = 1, > >>> + .needed = vmstate_test_use_cpuhp, > >>> + .fields = (VMStateField[]) { > >>> + VMSTATE_CPU_HOTPLUG(cpuhp.state, ICH9LPCPMRegs), > >>> + VMSTATE_END_OF_LIST() > >>> + } > >>> +}; > >>> + > >>> static bool vmstate_test_use_tco(void *opaque) > >>> { > >>> ICH9LPCPMRegs *s = opaque; > >>> @@ -209,6 +227,7 @@ const VMStateDescription vmstate_ich9_pm = { > >>> .subsections = (const VMStateDescription*[]) { > >>> &vmstate_memhp_state, > >>> &vmstate_tco_io_state, > >>> + &vmstate_cpuhp_state, > >>> NULL > >>> } > >>> }; > >>> @@ -275,7 +294,10 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, > >>> > >>> if (pm->cpu_hotplug_legacy) { > >>> legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), > >>> - OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); > >>> + OBJECT(lpc_pci), &pm->cpuhp.legacy, ICH9_CPU_HOTPLUG_IO_BASE); > >>> + } else { > >>> + cpu_hotplug_hw_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), > >>> + &pm->cpuhp.state, ICH9_CPU_HOTPLUG_IO_BASE); > >>> } > >>> > >>> if (pm->acpi_memory_hotplug.is_enabled) { > >>> @@ -414,7 +436,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp) > >>> { > >>> static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; > >>> pm->acpi_memory_hotplug.is_enabled = true; > >>> - pm->cpu_hotplug_legacy = true; > >> > >> Maybe is too soon to disable legacy CPU hotplug? Will the new cpu hotplug mechanism > >> work from this patch on, or it will break git bisect? > > it doesn't break bisect compile wise nor 'make check' wise, > > but it's hotplug won't be functional till > > acpi: add CPU hotplug methods to DSDT > > perhaps I need to move it there or into a separate patch after it. > > > > Exactly, I would move the "enabling" code after the new hotplug mechanism > is functional. The same for the next patch for piix4. ok, will do on v2 respin. > > Thanks, > Marcel > > > >> > >> Thanks, > >> Marcel > >> > >>> pm->disable_s3 = 0; > >>> pm->disable_s4 = 0; > >>> pm->s4_val = 2; > >>> @@ -461,9 +482,13 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > >>> object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > >>> acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, > >>> dev, errp); > >>> - } else if (lpc->pm.cpu_hotplug_legacy && > >>> - object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > >>> - legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp); > >>> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > >>> + if (lpc->pm.cpu_hotplug_legacy) { > >>> + legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.legacy, dev, > >>> + errp); > >>> + } else { > >>> + acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.state, dev, errp); > >>> + } > >>> } else { > >>> error_setg(errp, "acpi: device plug request for not supported device" > >>> " type: %s", object_get_typename(OBJECT(dev))); > >>> @@ -480,6 +505,10 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, > >>> acpi_memory_unplug_request_cb(hotplug_dev, > >>> &lpc->pm.acpi_memory_hotplug, dev, > >>> errp); > >>> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && > >>> + !lpc->pm.cpu_hotplug_legacy) { > >>> + acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp.state, > >>> + dev, errp); > >>> } else { > >>> error_setg(errp, "acpi: device unplug request for not supported device" > >>> " type: %s", object_get_typename(OBJECT(dev))); > >>> @@ -494,6 +523,9 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > >>> if (lpc->pm.acpi_memory_hotplug.is_enabled && > >>> 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) { > >>> + acpi_cpu_unplug_cb(&lpc->pm.cpuhp.state, dev, errp); > >>> } else { > >>> error_setg(errp, "acpi: device unplug for not supported device" > >>> " type: %s", object_get_typename(OBJECT(dev))); > >>> diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h > >>> index e29a856..198c017 100644 > >>> --- a/include/hw/acpi/ich9.h > >>> +++ b/include/hw/acpi/ich9.h > >>> @@ -23,6 +23,7 @@ > >>> > >>> #include "hw/acpi/acpi.h" > >>> #include "hw/acpi/cpu_hotplug.h" > >>> +#include "hw/acpi/cpu.h" > >>> #include "hw/acpi/memory_hotplug.h" > >>> #include "hw/acpi/acpi_dev_interface.h" > >>> #include "hw/acpi/tco.h" > >>> @@ -49,7 +50,10 @@ typedef struct ICH9LPCPMRegs { > >>> Notifier powerdown_notifier; > >>> > >>> bool cpu_hotplug_legacy; > >>> - AcpiCpuHotplug gpe_cpu; > >>> + union { > >>> + AcpiCpuHotplug legacy; /* used for keeping legacy state */ > >>> + CPUHotplugState state; > >>> + } cpuhp; > >>> > >>> MemHotplugState acpi_memory_hotplug; > >>> > >>> diff --git a/include/hw/compat.h b/include/hw/compat.h > >>> index 636befe..a65d9d2 100644 > >>> --- a/include/hw/compat.h > >>> +++ b/include/hw/compat.h > >>> @@ -2,7 +2,11 @@ > >>> #define HW_COMPAT_H > >>> > >>> #define HW_COMPAT_2_6 \ > >>> - /* empty */ > >>> + {\ > >>> + .driver = "ICH9-LPC",\ > >>> + .property = "cpu-hotplug-legacy",\ > >>> + .value = "on",\ > >>> + },\ > >>> > >>> #define HW_COMPAT_2_5 \ > >>> {\ > >>> > >> > > >
On Tue, May 31, 2016 at 02:51:03PM +0200, Igor Mammedov wrote: > On Tue, 31 May 2016 13:21:20 +0300 > Marcel Apfelbaum <marcel@redhat.com> wrote: > > > On 05/31/2016 01:06 PM, Igor Mammedov wrote: > > > On Mon, 30 May 2016 22:02:31 +0300 > > > Marcel Apfelbaum <marcel@redhat.com> wrote: > > > > > >> On 05/17/2016 05:43 PM, Igor Mammedov wrote: > > >>> add necessary wiring to init new CPU hotplug hardware > > >>> if ICH9-LPC.cpu-hotplug-legacy is "off". > > >>> Set ICH9-LPC.cpu-hotplug-legacy to "off" by default and > > >>> switch legacy hotplug to enabled only for 2.6 and older > > >>> machine types. > > >>> > > >>> Signed-off-by: Igor Mammedov <imammedo@redhat.com> > > >>> --- > > >>> v1: > > >>> - drop ICH9-LPC.cpu-hotplug property > > >>> --- > > >>> hw/acpi/ich9.c | 42 +++++++++++++++++++++++++++++++++++++----- > > >>> include/hw/acpi/ich9.h | 6 +++++- > > >>> include/hw/compat.h | 6 +++++- > > >>> 3 files changed, 47 insertions(+), 7 deletions(-) > > >>> > > >>> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c > > >>> index 121e30c..b0285b9 100644 > > >>> --- a/hw/acpi/ich9.c > > >>> +++ b/hw/acpi/ich9.c > > >>> @@ -170,6 +170,24 @@ static const VMStateDescription vmstate_memhp_state = { > > >>> } > > >>> }; > > >>> > > >>> +static bool vmstate_test_use_cpuhp(void *opaque) > > >>> +{ > > >>> + ICH9LPCPMRegs *s = opaque; > > >>> + return !s->cpu_hotplug_legacy; > > >>> +} > > >>> + > > >>> +static const VMStateDescription vmstate_cpuhp_state = { > > >>> + .name = "ich9_pm/cpuhp", > > >>> + .version_id = 1, > > >>> + .minimum_version_id = 1, > > >>> + .minimum_version_id_old = 1, > > >>> + .needed = vmstate_test_use_cpuhp, > > >>> + .fields = (VMStateField[]) { > > >>> + VMSTATE_CPU_HOTPLUG(cpuhp.state, ICH9LPCPMRegs), > > >>> + VMSTATE_END_OF_LIST() > > >>> + } > > >>> +}; > > >>> + > > >>> static bool vmstate_test_use_tco(void *opaque) > > >>> { > > >>> ICH9LPCPMRegs *s = opaque; > > >>> @@ -209,6 +227,7 @@ const VMStateDescription vmstate_ich9_pm = { > > >>> .subsections = (const VMStateDescription*[]) { > > >>> &vmstate_memhp_state, > > >>> &vmstate_tco_io_state, > > >>> + &vmstate_cpuhp_state, > > >>> NULL > > >>> } > > >>> }; > > >>> @@ -275,7 +294,10 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, > > >>> > > >>> if (pm->cpu_hotplug_legacy) { > > >>> legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), > > >>> - OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); > > >>> + OBJECT(lpc_pci), &pm->cpuhp.legacy, ICH9_CPU_HOTPLUG_IO_BASE); > > >>> + } else { > > >>> + cpu_hotplug_hw_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), > > >>> + &pm->cpuhp.state, ICH9_CPU_HOTPLUG_IO_BASE); > > >>> } > > >>> > > >>> if (pm->acpi_memory_hotplug.is_enabled) { > > >>> @@ -414,7 +436,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp) > > >>> { > > >>> static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; > > >>> pm->acpi_memory_hotplug.is_enabled = true; > > >>> - pm->cpu_hotplug_legacy = true; > > >> > > >> Maybe is too soon to disable legacy CPU hotplug? Will the new cpu hotplug mechanism > > >> work from this patch on, or it will break git bisect? > > > it doesn't break bisect compile wise nor 'make check' wise, > > > but it's hotplug won't be functional till > > > acpi: add CPU hotplug methods to DSDT > > > perhaps I need to move it there or into a separate patch after it. > > > > > > > Exactly, I would move the "enabling" code after the new hotplug mechanism > > is functional. The same for the next patch for piix4. > ok, will do on v2 respin. I have everything up to pc: use AcpiDeviceIfClass.send_event to issue GPE events tentatively in my tree - do you plan to rework any of these? > > > > Thanks, > > Marcel > > > > > > >> > > >> Thanks, > > >> Marcel > > >> > > >>> pm->disable_s3 = 0; > > >>> pm->disable_s4 = 0; > > >>> pm->s4_val = 2; > > >>> @@ -461,9 +482,13 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > > >>> object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > > >>> acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, > > >>> dev, errp); > > >>> - } else if (lpc->pm.cpu_hotplug_legacy && > > >>> - object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > > >>> - legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp); > > >>> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > > >>> + if (lpc->pm.cpu_hotplug_legacy) { > > >>> + legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.legacy, dev, > > >>> + errp); > > >>> + } else { > > >>> + acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.state, dev, errp); > > >>> + } > > >>> } else { > > >>> error_setg(errp, "acpi: device plug request for not supported device" > > >>> " type: %s", object_get_typename(OBJECT(dev))); > > >>> @@ -480,6 +505,10 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, > > >>> acpi_memory_unplug_request_cb(hotplug_dev, > > >>> &lpc->pm.acpi_memory_hotplug, dev, > > >>> errp); > > >>> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && > > >>> + !lpc->pm.cpu_hotplug_legacy) { > > >>> + acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp.state, > > >>> + dev, errp); > > >>> } else { > > >>> error_setg(errp, "acpi: device unplug request for not supported device" > > >>> " type: %s", object_get_typename(OBJECT(dev))); > > >>> @@ -494,6 +523,9 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > > >>> if (lpc->pm.acpi_memory_hotplug.is_enabled && > > >>> 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) { > > >>> + acpi_cpu_unplug_cb(&lpc->pm.cpuhp.state, dev, errp); > > >>> } else { > > >>> error_setg(errp, "acpi: device unplug for not supported device" > > >>> " type: %s", object_get_typename(OBJECT(dev))); > > >>> diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h > > >>> index e29a856..198c017 100644 > > >>> --- a/include/hw/acpi/ich9.h > > >>> +++ b/include/hw/acpi/ich9.h > > >>> @@ -23,6 +23,7 @@ > > >>> > > >>> #include "hw/acpi/acpi.h" > > >>> #include "hw/acpi/cpu_hotplug.h" > > >>> +#include "hw/acpi/cpu.h" > > >>> #include "hw/acpi/memory_hotplug.h" > > >>> #include "hw/acpi/acpi_dev_interface.h" > > >>> #include "hw/acpi/tco.h" > > >>> @@ -49,7 +50,10 @@ typedef struct ICH9LPCPMRegs { > > >>> Notifier powerdown_notifier; > > >>> > > >>> bool cpu_hotplug_legacy; > > >>> - AcpiCpuHotplug gpe_cpu; > > >>> + union { > > >>> + AcpiCpuHotplug legacy; /* used for keeping legacy state */ > > >>> + CPUHotplugState state; > > >>> + } cpuhp; > > >>> > > >>> MemHotplugState acpi_memory_hotplug; > > >>> > > >>> diff --git a/include/hw/compat.h b/include/hw/compat.h > > >>> index 636befe..a65d9d2 100644 > > >>> --- a/include/hw/compat.h > > >>> +++ b/include/hw/compat.h > > >>> @@ -2,7 +2,11 @@ > > >>> #define HW_COMPAT_H > > >>> > > >>> #define HW_COMPAT_2_6 \ > > >>> - /* empty */ > > >>> + {\ > > >>> + .driver = "ICH9-LPC",\ > > >>> + .property = "cpu-hotplug-legacy",\ > > >>> + .value = "on",\ > > >>> + },\ > > >>> > > >>> #define HW_COMPAT_2_5 \ > > >>> {\ > > >>> > > >> > > > > >
On Tue, 31 May 2016 15:52:35 +0300 "Michael S. Tsirkin" <mst@redhat.com> wrote: > On Tue, May 31, 2016 at 02:51:03PM +0200, Igor Mammedov wrote: > > On Tue, 31 May 2016 13:21:20 +0300 > > Marcel Apfelbaum <marcel@redhat.com> wrote: > > > > > On 05/31/2016 01:06 PM, Igor Mammedov wrote: > > > > On Mon, 30 May 2016 22:02:31 +0300 > > > > Marcel Apfelbaum <marcel@redhat.com> wrote: > > > > > > > >> On 05/17/2016 05:43 PM, Igor Mammedov wrote: > > > >>> add necessary wiring to init new CPU hotplug hardware > > > >>> if ICH9-LPC.cpu-hotplug-legacy is "off". > > > >>> Set ICH9-LPC.cpu-hotplug-legacy to "off" by default and > > > >>> switch legacy hotplug to enabled only for 2.6 and older > > > >>> machine types. > > > >>> > > > >>> Signed-off-by: Igor Mammedov <imammedo@redhat.com> > > > >>> --- > > > >>> v1: > > > >>> - drop ICH9-LPC.cpu-hotplug property > > > >>> --- > > > >>> hw/acpi/ich9.c | 42 +++++++++++++++++++++++++++++++++++++----- > > > >>> include/hw/acpi/ich9.h | 6 +++++- > > > >>> include/hw/compat.h | 6 +++++- > > > >>> 3 files changed, 47 insertions(+), 7 deletions(-) > > > >>> > > > >>> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c > > > >>> index 121e30c..b0285b9 100644 > > > >>> --- a/hw/acpi/ich9.c > > > >>> +++ b/hw/acpi/ich9.c > > > >>> @@ -170,6 +170,24 @@ static const VMStateDescription vmstate_memhp_state = { > > > >>> } > > > >>> }; > > > >>> > > > >>> +static bool vmstate_test_use_cpuhp(void *opaque) > > > >>> +{ > > > >>> + ICH9LPCPMRegs *s = opaque; > > > >>> + return !s->cpu_hotplug_legacy; > > > >>> +} > > > >>> + > > > >>> +static const VMStateDescription vmstate_cpuhp_state = { > > > >>> + .name = "ich9_pm/cpuhp", > > > >>> + .version_id = 1, > > > >>> + .minimum_version_id = 1, > > > >>> + .minimum_version_id_old = 1, > > > >>> + .needed = vmstate_test_use_cpuhp, > > > >>> + .fields = (VMStateField[]) { > > > >>> + VMSTATE_CPU_HOTPLUG(cpuhp.state, ICH9LPCPMRegs), > > > >>> + VMSTATE_END_OF_LIST() > > > >>> + } > > > >>> +}; > > > >>> + > > > >>> static bool vmstate_test_use_tco(void *opaque) > > > >>> { > > > >>> ICH9LPCPMRegs *s = opaque; > > > >>> @@ -209,6 +227,7 @@ const VMStateDescription vmstate_ich9_pm = { > > > >>> .subsections = (const VMStateDescription*[]) { > > > >>> &vmstate_memhp_state, > > > >>> &vmstate_tco_io_state, > > > >>> + &vmstate_cpuhp_state, > > > >>> NULL > > > >>> } > > > >>> }; > > > >>> @@ -275,7 +294,10 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, > > > >>> > > > >>> if (pm->cpu_hotplug_legacy) { > > > >>> legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), > > > >>> - OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); > > > >>> + OBJECT(lpc_pci), &pm->cpuhp.legacy, ICH9_CPU_HOTPLUG_IO_BASE); > > > >>> + } else { > > > >>> + cpu_hotplug_hw_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), > > > >>> + &pm->cpuhp.state, ICH9_CPU_HOTPLUG_IO_BASE); > > > >>> } > > > >>> > > > >>> if (pm->acpi_memory_hotplug.is_enabled) { > > > >>> @@ -414,7 +436,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp) > > > >>> { > > > >>> static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; > > > >>> pm->acpi_memory_hotplug.is_enabled = true; > > > >>> - pm->cpu_hotplug_legacy = true; > > > >> > > > >> Maybe is too soon to disable legacy CPU hotplug? Will the new cpu hotplug mechanism > > > >> work from this patch on, or it will break git bisect? > > > > it doesn't break bisect compile wise nor 'make check' wise, > > > > but it's hotplug won't be functional till > > > > acpi: add CPU hotplug methods to DSDT > > > > perhaps I need to move it there or into a separate patch after it. > > > > > > > > > > Exactly, I would move the "enabling" code after the new hotplug mechanism > > > is functional. The same for the next patch for piix4. > > ok, will do on v2 respin. > > I have everything up to > pc: use AcpiDeviceIfClass.send_event to issue GPE events > tentatively in my tree - do you plan to rework any of these? I don't plan to rework any of those. I'll respin v2 on top of your tree starting from: [PATCH 15/33] docs: update ACPI CPU hotplug spec with new protocol depending on outcome of reviews. > > > > > > > Thanks, > > > Marcel > > > > > > > > > >> > > > >> Thanks, > > > >> Marcel > > > >> > > > >>> pm->disable_s3 = 0; > > > >>> pm->disable_s4 = 0; > > > >>> pm->s4_val = 2; > > > >>> @@ -461,9 +482,13 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > > > >>> object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { > > > >>> acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, > > > >>> dev, errp); > > > >>> - } else if (lpc->pm.cpu_hotplug_legacy && > > > >>> - object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > > > >>> - legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp); > > > >>> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > > > >>> + if (lpc->pm.cpu_hotplug_legacy) { > > > >>> + legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.legacy, dev, > > > >>> + errp); > > > >>> + } else { > > > >>> + acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.state, dev, errp); > > > >>> + } > > > >>> } else { > > > >>> error_setg(errp, "acpi: device plug request for not supported device" > > > >>> " type: %s", object_get_typename(OBJECT(dev))); > > > >>> @@ -480,6 +505,10 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, > > > >>> acpi_memory_unplug_request_cb(hotplug_dev, > > > >>> &lpc->pm.acpi_memory_hotplug, dev, > > > >>> errp); > > > >>> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && > > > >>> + !lpc->pm.cpu_hotplug_legacy) { > > > >>> + acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp.state, > > > >>> + dev, errp); > > > >>> } else { > > > >>> error_setg(errp, "acpi: device unplug request for not supported device" > > > >>> " type: %s", object_get_typename(OBJECT(dev))); > > > >>> @@ -494,6 +523,9 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, > > > >>> if (lpc->pm.acpi_memory_hotplug.is_enabled && > > > >>> 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) { > > > >>> + acpi_cpu_unplug_cb(&lpc->pm.cpuhp.state, dev, errp); > > > >>> } else { > > > >>> error_setg(errp, "acpi: device unplug for not supported device" > > > >>> " type: %s", object_get_typename(OBJECT(dev))); > > > >>> diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h > > > >>> index e29a856..198c017 100644 > > > >>> --- a/include/hw/acpi/ich9.h > > > >>> +++ b/include/hw/acpi/ich9.h > > > >>> @@ -23,6 +23,7 @@ > > > >>> > > > >>> #include "hw/acpi/acpi.h" > > > >>> #include "hw/acpi/cpu_hotplug.h" > > > >>> +#include "hw/acpi/cpu.h" > > > >>> #include "hw/acpi/memory_hotplug.h" > > > >>> #include "hw/acpi/acpi_dev_interface.h" > > > >>> #include "hw/acpi/tco.h" > > > >>> @@ -49,7 +50,10 @@ typedef struct ICH9LPCPMRegs { > > > >>> Notifier powerdown_notifier; > > > >>> > > > >>> bool cpu_hotplug_legacy; > > > >>> - AcpiCpuHotplug gpe_cpu; > > > >>> + union { > > > >>> + AcpiCpuHotplug legacy; /* used for keeping legacy state */ > > > >>> + CPUHotplugState state; > > > >>> + } cpuhp; > > > >>> > > > >>> MemHotplugState acpi_memory_hotplug; > > > >>> > > > >>> diff --git a/include/hw/compat.h b/include/hw/compat.h > > > >>> index 636befe..a65d9d2 100644 > > > >>> --- a/include/hw/compat.h > > > >>> +++ b/include/hw/compat.h > > > >>> @@ -2,7 +2,11 @@ > > > >>> #define HW_COMPAT_H > > > >>> > > > >>> #define HW_COMPAT_2_6 \ > > > >>> - /* empty */ > > > >>> + {\ > > > >>> + .driver = "ICH9-LPC",\ > > > >>> + .property = "cpu-hotplug-legacy",\ > > > >>> + .value = "on",\ > > > >>> + },\ > > > >>> > > > >>> #define HW_COMPAT_2_5 \ > > > >>> {\ > > > >>> > > > >> > > > > > > >
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 121e30c..b0285b9 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -170,6 +170,24 @@ static const VMStateDescription vmstate_memhp_state = { } }; +static bool vmstate_test_use_cpuhp(void *opaque) +{ + ICH9LPCPMRegs *s = opaque; + return !s->cpu_hotplug_legacy; +} + +static const VMStateDescription vmstate_cpuhp_state = { + .name = "ich9_pm/cpuhp", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .needed = vmstate_test_use_cpuhp, + .fields = (VMStateField[]) { + VMSTATE_CPU_HOTPLUG(cpuhp.state, ICH9LPCPMRegs), + VMSTATE_END_OF_LIST() + } +}; + static bool vmstate_test_use_tco(void *opaque) { ICH9LPCPMRegs *s = opaque; @@ -209,6 +227,7 @@ const VMStateDescription vmstate_ich9_pm = { .subsections = (const VMStateDescription*[]) { &vmstate_memhp_state, &vmstate_tco_io_state, + &vmstate_cpuhp_state, NULL } }; @@ -275,7 +294,10 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, if (pm->cpu_hotplug_legacy) { legacy_acpi_cpu_hotplug_init(pci_address_space_io(lpc_pci), - OBJECT(lpc_pci), &pm->gpe_cpu, ICH9_CPU_HOTPLUG_IO_BASE); + OBJECT(lpc_pci), &pm->cpuhp.legacy, ICH9_CPU_HOTPLUG_IO_BASE); + } else { + cpu_hotplug_hw_init(pci_address_space_io(lpc_pci), OBJECT(lpc_pci), + &pm->cpuhp.state, ICH9_CPU_HOTPLUG_IO_BASE); } if (pm->acpi_memory_hotplug.is_enabled) { @@ -414,7 +436,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp) { static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; pm->acpi_memory_hotplug.is_enabled = true; - pm->cpu_hotplug_legacy = true; pm->disable_s3 = 0; pm->disable_s4 = 0; pm->s4_val = 2; @@ -461,9 +482,13 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, dev, errp); - } else if (lpc->pm.cpu_hotplug_legacy && - object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { - legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp); + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { + if (lpc->pm.cpu_hotplug_legacy) { + legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.legacy, dev, + errp); + } else { + acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp.state, dev, errp); + } } else { error_setg(errp, "acpi: device plug request for not supported device" " type: %s", object_get_typename(OBJECT(dev))); @@ -480,6 +505,10 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, acpi_memory_unplug_request_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug, dev, errp); + } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) && + !lpc->pm.cpu_hotplug_legacy) { + acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp.state, + dev, errp); } else { error_setg(errp, "acpi: device unplug request for not supported device" " type: %s", object_get_typename(OBJECT(dev))); @@ -494,6 +523,9 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, if (lpc->pm.acpi_memory_hotplug.is_enabled && 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) { + acpi_cpu_unplug_cb(&lpc->pm.cpuhp.state, dev, errp); } else { error_setg(errp, "acpi: device unplug for not supported device" " type: %s", object_get_typename(OBJECT(dev))); diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index e29a856..198c017 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -23,6 +23,7 @@ #include "hw/acpi/acpi.h" #include "hw/acpi/cpu_hotplug.h" +#include "hw/acpi/cpu.h" #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/acpi_dev_interface.h" #include "hw/acpi/tco.h" @@ -49,7 +50,10 @@ typedef struct ICH9LPCPMRegs { Notifier powerdown_notifier; bool cpu_hotplug_legacy; - AcpiCpuHotplug gpe_cpu; + union { + AcpiCpuHotplug legacy; /* used for keeping legacy state */ + CPUHotplugState state; + } cpuhp; MemHotplugState acpi_memory_hotplug; diff --git a/include/hw/compat.h b/include/hw/compat.h index 636befe..a65d9d2 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -2,7 +2,11 @@ #define HW_COMPAT_H #define HW_COMPAT_2_6 \ - /* empty */ + {\ + .driver = "ICH9-LPC",\ + .property = "cpu-hotplug-legacy",\ + .value = "on",\ + },\ #define HW_COMPAT_2_5 \ {\
add necessary wiring to init new CPU hotplug hardware if ICH9-LPC.cpu-hotplug-legacy is "off". Set ICH9-LPC.cpu-hotplug-legacy to "off" by default and switch legacy hotplug to enabled only for 2.6 and older machine types. Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- v1: - drop ICH9-LPC.cpu-hotplug property --- hw/acpi/ich9.c | 42 +++++++++++++++++++++++++++++++++++++----- include/hw/acpi/ich9.h | 6 +++++- include/hw/compat.h | 6 +++++- 3 files changed, 47 insertions(+), 7 deletions(-)