On Wed, 19 Jun 2019 15:19:04 +0530 Pankaj Gupta <pagu...@redhat.com> wrote:
> We need a proxy device for virtio-pmem, and this device has to be the > actual memory device so we can cleanly hotplug it. > > Forward memory device class functions either to the actual device or use > properties of the virtio-pmem device to implement these in the proxy. > > virtio-pmem will only be compiled for selected, supported architectures > (that can deal with virtio/pci devices being memory devices). An > architecture that is prepared for that can simply enable > CONFIG_VIRTIO_PMEM to make it work. > > As not all architectures support memory devices (and CONFIG_VIRTIO_PMEM > will be enabled per supported architecture), we have to move the PCI proxy > to a separate file. > > Signed-off-by: Pankaj Gupta <pagu...@redhat.com> > [ split up patches, memory-device changes, move pci proxy] > Signed-off-by: David Hildenbrand <da...@redhat.com> > --- > hw/virtio/Makefile.objs | 1 + > hw/virtio/virtio-pmem-pci.c | 131 > ++++++++++++++++++++++++++++++++++++++++++++ > hw/virtio/virtio-pmem-pci.h | 34 ++++++++++++ > include/hw/pci/pci.h | 1 + > 4 files changed, 167 insertions(+) > create mode 100644 hw/virtio/virtio-pmem-pci.c > create mode 100644 hw/virtio/virtio-pmem-pci.h (...) > +static const VirtioPCIDeviceTypeInfo virtio_pmem_pci_info = { > + .base_name = TYPE_VIRTIO_PMEM_PCI, > + .generic_name = "virtio-pmem-pci", > + .transitional_name = "virtio-pmem-pci-transitional", Do we even have a transitional device for this? I.e., do we have a legacy version? I don't think that makes sense for new devices. > + .non_transitional_name = "virtio-pmem-pci-non-transitional", > + .instance_size = sizeof(VirtIOPMEMPCI), > + .instance_init = virtio_pmem_pci_instance_init, > + .class_init = virtio_pmem_pci_class_init, > + .interfaces = (InterfaceInfo[]) { > + { TYPE_MEMORY_DEVICE }, > + { } > + }, > +}; (...)