pc: memhp: move nvdimm hotplug out of memory hotplug
as they use completely different way to handle hotplug event
Suggested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 70f6451..ec4e64b 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -2,7 +2,6 @@
#include "hw/acpi/memory_hotplug.h"
#include "hw/acpi/pc-hotplug.h"
#include "hw/mem/pc-dimm.h"
-#include "hw/mem/nvdimm.h"
#include "hw/boards.h"
#include "hw/qdev-core.h"
#include "trace.h"
@@ -233,8 +232,11 @@
DeviceState *dev, Error **errp)
{
MemStatus *mdev;
- AcpiEventStatusBits event;
- bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
+ DeviceClass *dc = DEVICE_GET_CLASS(dev);
+
+ if (!dc->hotpluggable) {
+ return;
+ }
mdev = acpi_memory_slot_status(mem_st, dev, errp);
if (!mdev) {
@@ -242,23 +244,10 @@
}
mdev->dimm = dev;
-
- /*
- * do not set is_enabled and is_inserting if the slot is plugged with
- * a nvdimm device to stop OSPM inquires memory region from the slot.
- */
- if (is_nvdimm) {
- event = ACPI_NVDIMM_HOTPLUG_STATUS;
- } else {
- mdev->is_enabled = true;
- event = ACPI_MEMORY_HOTPLUG_STATUS;
- }
-
+ mdev->is_enabled = true;
if (dev->hotplugged) {
- if (!is_nvdimm) {
- mdev->is_inserting = true;
- }
- acpi_send_event(DEVICE(hotplug_dev), event);
+ mdev->is_inserting = true;
+ acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
}
}
@@ -273,8 +262,6 @@
return;
}
- /* nvdimm device hot unplug is not supported yet. */
- assert(!object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM));
mdev->is_removing = true;
acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
}
@@ -289,8 +276,6 @@
return;
}
- /* nvdimm device hot unplug is not supported yet. */
- assert(!object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM));
mdev->is_enabled = false;
mdev->dimm = NULL;
}