[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 19/42] pc: add generic CPU unplug callbacks
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [RFC 19/42] pc: add generic CPU unplug callbacks |
Date: |
Mon, 2 May 2016 14:33:28 +0200 |
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/i386/pc.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 99437e0..1cad132 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1713,6 +1713,49 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
out:
error_propagate(errp, local_err);
}
+static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ HotplugHandlerClass *hhc;
+ Error *local_err = NULL;
+ PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+
+ hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
+ hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
+
+ if (local_err) {
+ goto out;
+ }
+
+ out:
+ error_propagate(errp, local_err);
+
+}
+
+static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ HotplugHandlerClass *hhc;
+ Error *local_err = NULL;
+ PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+
+ hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
+ hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
+
+ if (local_err) {
+ goto out;
+ }
+
+ /*
+ * TODO: enable unplug once generic CPU remove bits land
+ * for now guest will be able to eject CPU ACPI wise but
+ * it will come back again on machine reset.
+ */
+ /* object_unparent(OBJECT(dev)); */
+
+ out:
+ error_propagate(errp, local_err);
+}
static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
@@ -1729,6 +1772,8 @@ static void
pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
{
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
pc_dimm_unplug_request(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+ pc_cpu_unplug_request_cb(hotplug_dev, dev, errp);
} else {
error_setg(errp, "acpi: device unplug request for not supported device"
" type: %s", object_get_typename(OBJECT(dev)));
@@ -1740,6 +1785,8 @@ static void pc_machine_device_unplug_cb(HotplugHandler
*hotplug_dev,
{
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
pc_dimm_unplug(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+ pc_cpu_unplug_cb(hotplug_dev, dev, errp);
} else {
error_setg(errp, "acpi: device unplug for not supported device"
" type: %s", object_get_typename(OBJECT(dev)));
--
1.8.3.1
- [Qemu-devel] [RFC 16/42] pc: use AcpiDeviceIfClass.send_event to issue GPE events, (continued)
- [Qemu-devel] [RFC 13/42] tests: bios-tables-test: update tables with CPHP turned off by default, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 10/42] pc: piix4/ich9: add 'cpu-hotplug-legacy' property, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 19/42] pc: add generic CPU unplug callbacks,
Igor Mammedov <=
- [Qemu-devel] [RFC 18/42] acpi: hardware side of CPU hotplug, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 22/42] pc: piix4: initialize new CPU hotplug hw, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 21/42] pc: q35: initialize new CPU hotplug hw, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 25/42] tests: acpi: update cphp_legacy case with new ProcessorID values, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 26/42] pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 24/42] pc: acpi: cpuhp-legacy: switch ProcessorID to possible_cpus idx, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 31/42] pc: numa: replace node_cpu indexing by apic_id with possible_cpus index, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 27/42] acpi: add CPU devices AML to DSDT, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 28/42] acpi: add CPU hotplug methods to DSDT, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 32/42] pc: set X86CPU.node property if QEMU starts with numa enabled, Igor Mammedov, 2016/05/02