On Thu, 23 May 2019 15:54:43 +0530 Pankaj Gupta <pagu...@redhat.com> wrote:
> This is the implementation of virtio-pmem device. Support will require > machine changes for the architectures that will support it, so it will > not yet be compiled. It can be unlocked with VIRTIO_PMEM_SUPPORTED per > machine and disabled globally via VIRTIO_PMEM. > > We cannot use the "addr" property as that is already used e.g. for > virtio-pci/pci devices. And we will have e.g. virtio-pmem-pci as a proxy. > So we have to choose a different one (unfortunately). "memaddr" it is. > That name should ideally be used by all other virtio-* based memory > devices in the future. > -device virtio-pmem-pci,id=p0,bus=bux0,addr=0x01,memaddr=0x1000000... > > Acked-by: Markus Armbruster <arm...@redhat.com> > [ QAPI bits ] > Signed-off-by: Pankaj Gupta <pagu...@redhat.com> > [ MemoryDevice/MemoryRegion changes, cleanups, addr property "memaddr", > split up patches, unplug handler ] > Signed-off-by: David Hildenbrand <da...@redhat.com> > --- > hw/virtio/Kconfig | 10 +++ > hw/virtio/Makefile.objs | 1 + > hw/virtio/virtio-pmem.c | 190 > ++++++++++++++++++++++++++++++++++++++++ > include/hw/virtio/virtio-pmem.h | 49 +++++++++++ > qapi/misc.json | 28 +++++- > 5 files changed, 277 insertions(+), 1 deletion(-) > create mode 100644 hw/virtio/virtio-pmem.c > create mode 100644 include/hw/virtio/virtio-pmem.h > diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c > new file mode 100644 > index 0000000000..c462d2c942 > --- /dev/null > +++ b/hw/virtio/virtio-pmem.c > @@ -0,0 +1,190 @@ > +static void virtio_pmem_unrealize(DeviceState *dev, Error **errp) > +{ > + VirtIODevice *vdev = VIRTIO_DEVICE(dev); > + VirtIOPMEM *pmem = VIRTIO_PMEM(dev); > + > + host_memory_backend_set_mapped(pmem->memdev, false); > + pmem->rq_vq = virtio_add_queue(vdev, 128, virtio_pmem_flush); Adding a queue during unrealize looks weird... copy/paste error? > + virtio_cleanup(vdev); > +}