* David Hildenbrand (da...@redhat.com) wrote: > 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 <da...@redhat.com>
I see a few other places in the pc subdir that have checks for TYPE_NVDIMM; can you just explain why they are untouched: i386/pc.c: pc_memory_unplug_request acpi/ich9.c: ich9_pm_device_plug_cb acpi/piix4.c:piix4_device_plug_cb (Not that I understand the detail of those paths, but I just followed where the existing nvdimm code goes) Dave > --- > default-configs/i386-softmmu.mak | 1 + > hw/i386/pc.c | 10 +++++++++- > 2 files changed, 10 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 03148450c8..bea043fe23 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); > } > } > > @@ -2046,6 +2051,8 @@ static void pc_machine_device_unplug_cb(HotplugHandler > *hotplug_dev, > pc_memory_unplug(hotplug_dev, dev, errp); > } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { > pc_cpu_unplug_cb(hotplug_dev, dev, errp); > + } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM)) { > + virtio_pmem_unplug(VIRTIO_PMEM(dev), MACHINE(hotplug_dev), errp); > } else { > error_setg(errp, "acpi: device unplug for not supported device" > " type: %s", object_get_typename(OBJECT(dev))); > @@ -2056,7 +2063,8 @@ 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); > } > > -- > 2.17.1 > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK