[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v4 24/24] pc: support for virtio-pmem
From: |
David Hildenbrand |
Subject: |
[Qemu-ppc] [PATCH v4 24/24] pc: support for virtio-pmem |
Date: |
Wed, 26 Sep 2018 11:42:19 +0200 |
Compile virtio-pmem for x86 and properly hotplug virtio-pmem devices
(memory-device part) from our pc machine hotplug handler.
Signed-off-by: David Hildenbrand <address@hidden>
---
default-configs/i386-softmmu.mak | 1 +
hw/i386/pc.c | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 4c1637338b..dfb1e6d63a 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -51,6 +51,7 @@ CONFIG_APIC=y
CONFIG_IOAPIC=y
CONFIG_PVPANIC=y
CONFIG_MEM_DEVICE=y
+CONFIG_VIRTIO_PMEM=y
CONFIG_DIMM=y
CONFIG_NVDIMM=y
CONFIG_ACPI_NVDIMM=y
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 86c16f9aaf..78e3295390 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -74,6 +74,7 @@
#include "hw/nmi.h"
#include "hw/i386/intel_iommu.h"
#include "hw/net/ne2000-isa.h"
+#include "hw/virtio/virtio-pmem.h"
/* debug PC/ISA interrupts */
//#define DEBUG_IRQ
@@ -2013,6 +2014,8 @@ static void pc_machine_device_pre_plug_cb(HotplugHandler
*hotplug_dev,
pc_memory_pre_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
pc_cpu_pre_plug(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM)) {
+ virtio_pmem_pre_plug(VIRTIO_PMEM(dev), MACHINE(hotplug_dev), errp);
}
}
@@ -2023,6 +2026,8 @@ static void pc_machine_device_plug_cb(HotplugHandler
*hotplug_dev,
pc_memory_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
pc_cpu_plug(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM)) {
+ virtio_pmem_plug(VIRTIO_PMEM(dev), MACHINE(hotplug_dev), errp);
}
}
@@ -2052,11 +2057,20 @@ static void pc_machine_device_unplug_cb(HotplugHandler
*hotplug_dev,
}
}
+static void pc_machine_device_do_unplug_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev)
+{
+ if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM)) {
+ virtio_pmem_do_unplug(VIRTIO_PMEM(dev), MACHINE(hotplug_dev));
+ }
+}
+
static HotplugHandler *pc_get_hotpug_handler(MachineState *machine,
DeviceState *dev)
{
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) ||
- object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+ object_dynamic_cast(OBJECT(dev), TYPE_CPU) ||
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM)) {
return HOTPLUG_HANDLER(machine);
}
@@ -2395,6 +2409,7 @@ static void pc_machine_class_init(ObjectClass *oc, void
*data)
hc->pre_plug = pc_machine_device_pre_plug_cb;
hc->plug = pc_machine_device_plug_cb;
hc->unplug_request = pc_machine_device_unplug_request_cb;
+ hc->do_unplug = pc_machine_device_do_unplug_cb;
hc->unplug = pc_machine_device_unplug_cb;
nc->nmi_monitor_handler = x86_nmi;
mc->default_cpu_type = TARGET_DEFAULT_CPU_TYPE;
--
2.17.1
- Re: [Qemu-ppc] [PATCH v4 17/24] memory-device: add class function get_device_id(), (continued)
- [Qemu-ppc] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler, David Hildenbrand, 2018/09/26
- [Qemu-ppc] [PATCH v4 19/24] virtio-pmem: prototype, David Hildenbrand, 2018/09/26
- [Qemu-ppc] [PATCH v4 20/24] virtio-pci: proxy for virtio-pmem, David Hildenbrand, 2018/09/26
- [Qemu-ppc] [PATCH v4 21/24] hmp: handle virtio-pmem when printing memory device infos, David Hildenbrand, 2018/09/26
- [Qemu-ppc] [PATCH v4 22/24] numa: handle virtio-pmem in NUMA stats, David Hildenbrand, 2018/09/26
- [Qemu-ppc] [PATCH v4 23/24] virtio-pmem: hotplug support functions, David Hildenbrand, 2018/09/26
- [Qemu-ppc] [PATCH v4 24/24] pc: support for virtio-pmem,
David Hildenbrand <=