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>
This commit is contained in:
parent
12f86b5b3e
commit
75f2749822
@ -17,6 +17,7 @@ CONFIG_FDC=y
|
|||||||
CONFIG_ACPI=y
|
CONFIG_ACPI=y
|
||||||
CONFIG_ACPI_X86=y
|
CONFIG_ACPI_X86=y
|
||||||
CONFIG_ACPI_MEMORY_HOTPLUG=y
|
CONFIG_ACPI_MEMORY_HOTPLUG=y
|
||||||
|
CONFIG_ACPI_NVDIMM=y
|
||||||
CONFIG_ACPI_CPU_HOTPLUG=y
|
CONFIG_ACPI_CPU_HOTPLUG=y
|
||||||
CONFIG_APM=y
|
CONFIG_APM=y
|
||||||
CONFIG_I8257=y
|
CONFIG_I8257=y
|
||||||
|
@ -4,9 +4,6 @@ QEMU<->ACPI BIOS memory hotplug interface
|
|||||||
ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add
|
ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add
|
||||||
and hot-remove events.
|
and hot-remove events.
|
||||||
|
|
||||||
ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device
|
|
||||||
hot-add and hot-remove events.
|
|
||||||
|
|
||||||
Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access):
|
Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access):
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
0xa00:
|
0xa00:
|
||||||
|
@ -127,6 +127,11 @@ _DSM process diagram:
|
|||||||
| result from the page | | |
|
| result from the page | | |
|
||||||
+--------------------------+ +--------------+
|
+--------------------------+ +--------------+
|
||||||
|
|
||||||
|
NVDIMM hotplug
|
||||||
|
--------------
|
||||||
|
ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device
|
||||||
|
hot-add event.
|
||||||
|
|
||||||
Device Handle Reservation
|
Device Handle Reservation
|
||||||
-------------------------
|
-------------------------
|
||||||
As we mentioned above, byte 0 ~ byte 3 in the DSM memory save NVDIMM device
|
As we mentioned above, byte 0 ~ byte 3 in the DSM memory save NVDIMM device
|
||||||
|
@ -490,8 +490,12 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|||||||
|
|
||||||
if (lpc->pm.acpi_memory_hotplug.is_enabled &&
|
if (lpc->pm.acpi_memory_hotplug.is_enabled &&
|
||||||
object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
|
object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
|
||||||
acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug,
|
if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
|
||||||
dev, errp);
|
nvdimm_acpi_plug_cb(hotplug_dev, dev);
|
||||||
|
} else {
|
||||||
|
acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug,
|
||||||
|
dev, errp);
|
||||||
|
}
|
||||||
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
|
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
|
||||||
if (lpc->pm.cpu_hotplug_legacy) {
|
if (lpc->pm.cpu_hotplug_legacy) {
|
||||||
legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp);
|
legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include "hw/acpi/memory_hotplug.h"
|
#include "hw/acpi/memory_hotplug.h"
|
||||||
#include "hw/acpi/pc-hotplug.h"
|
#include "hw/acpi/pc-hotplug.h"
|
||||||
#include "hw/mem/pc-dimm.h"
|
#include "hw/mem/pc-dimm.h"
|
||||||
#include "hw/mem/nvdimm.h"
|
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/qdev-core.h"
|
#include "hw/qdev-core.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
@ -233,8 +232,11 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
|
|||||||
DeviceState *dev, Error **errp)
|
DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
MemStatus *mdev;
|
MemStatus *mdev;
|
||||||
AcpiEventStatusBits event;
|
DeviceClass *dc = DEVICE_GET_CLASS(dev);
|
||||||
bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
|
|
||||||
|
if (!dc->hotpluggable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mdev = acpi_memory_slot_status(mem_st, dev, errp);
|
mdev = acpi_memory_slot_status(mem_st, dev, errp);
|
||||||
if (!mdev) {
|
if (!mdev) {
|
||||||
@ -242,23 +244,10 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mdev->dimm = dev;
|
mdev->dimm = dev;
|
||||||
|
mdev->is_enabled = true;
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev->hotplugged) {
|
if (dev->hotplugged) {
|
||||||
if (!is_nvdimm) {
|
mdev->is_inserting = true;
|
||||||
mdev->is_inserting = true;
|
acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
|
||||||
}
|
|
||||||
acpi_send_event(DEVICE(hotplug_dev), event);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,8 +262,6 @@ void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nvdimm device hot unplug is not supported yet. */
|
|
||||||
assert(!object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM));
|
|
||||||
mdev->is_removing = true;
|
mdev->is_removing = true;
|
||||||
acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
|
acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS);
|
||||||
}
|
}
|
||||||
@ -289,8 +276,6 @@ void acpi_memory_unplug_cb(MemHotplugState *mem_st,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nvdimm device hot unplug is not supported yet. */
|
|
||||||
assert(!object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM));
|
|
||||||
mdev->is_enabled = false;
|
mdev->is_enabled = false;
|
||||||
mdev->dimm = NULL;
|
mdev->dimm = NULL;
|
||||||
}
|
}
|
||||||
|
@ -868,6 +868,13 @@ static const MemoryRegionOps nvdimm_dsm_ops = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev)
|
||||||
|
{
|
||||||
|
if (dev->hotplugged) {
|
||||||
|
acpi_send_event(DEVICE(hotplug_dev), ACPI_NVDIMM_HOTPLUG_STATUS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void nvdimm_init_acpi_state(AcpiNVDIMMState *state, MemoryRegion *io,
|
void nvdimm_init_acpi_state(AcpiNVDIMMState *state, MemoryRegion *io,
|
||||||
FWCfgState *fw_cfg, Object *owner)
|
FWCfgState *fw_cfg, Object *owner)
|
||||||
{
|
{
|
||||||
|
@ -378,7 +378,12 @@ static void piix4_device_plug_cb(HotplugHandler *hotplug_dev,
|
|||||||
|
|
||||||
if (s->acpi_memory_hotplug.is_enabled &&
|
if (s->acpi_memory_hotplug.is_enabled &&
|
||||||
object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
|
object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
|
||||||
acpi_memory_plug_cb(hotplug_dev, &s->acpi_memory_hotplug, dev, errp);
|
if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
|
||||||
|
nvdimm_acpi_plug_cb(hotplug_dev, dev);
|
||||||
|
} else {
|
||||||
|
acpi_memory_plug_cb(hotplug_dev, &s->acpi_memory_hotplug,
|
||||||
|
dev, errp);
|
||||||
|
}
|
||||||
} else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
|
} else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
|
||||||
acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp);
|
acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp);
|
||||||
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
|
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
|
||||||
|
@ -131,4 +131,5 @@ void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data,
|
|||||||
BIOSLinker *linker, AcpiNVDIMMState *state,
|
BIOSLinker *linker, AcpiNVDIMMState *state,
|
||||||
uint32_t ram_slots);
|
uint32_t ram_slots);
|
||||||
void nvdimm_acpi_hotplug(AcpiNVDIMMState *state);
|
void nvdimm_acpi_hotplug(AcpiNVDIMMState *state);
|
||||||
|
void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user