On 06.07.20 17:28, Cornelia Huck wrote: > On Fri, 26 Jun 2020 09:22:38 +0200 > David Hildenbrand <david@xxxxxxxxxx> wrote: > >> Let's add a proxy for virtio-mem, make it a memory device, and >> pass-through the properties. >> >> Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@xxxxxxxxx> >> Cc: "Michael S. Tsirkin" <mst@xxxxxxxxxx> >> Cc: Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx> >> Cc: "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx> >> Cc: Igor Mammedov <imammedo@xxxxxxxxxx> >> Signed-off-by: David Hildenbrand <david@xxxxxxxxxx> >> --- >> hw/virtio/Makefile.objs | 1 + >> hw/virtio/virtio-mem-pci.c | 129 +++++++++++++++++++++++++++++++++++++ >> hw/virtio/virtio-mem-pci.h | 33 ++++++++++ >> include/hw/pci/pci.h | 1 + >> 4 files changed, 164 insertions(+) >> create mode 100644 hw/virtio/virtio-mem-pci.c >> create mode 100644 hw/virtio/virtio-mem-pci.h > > (...) > >> diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c >> new file mode 100644 >> index 0000000000..b325303b32 >> --- /dev/null >> +++ b/hw/virtio/virtio-mem-pci.c >> @@ -0,0 +1,129 @@ >> +/* >> + * Virtio MEM PCI device >> + * >> + * Copyright (C) 2020 Red Hat, Inc. >> + * >> + * Authors: >> + * David Hildenbrand <david@xxxxxxxxxx> >> + * >> + * This work is licensed under the terms of the GNU GPL, version 2. >> + * See the COPYING file in the top-level directory. >> + */ >> + >> +#include "qemu/osdep.h" >> +#include "virtio-mem-pci.h" >> +#include "hw/mem/memory-device.h" >> +#include "qapi/error.h" >> + >> +static void virtio_mem_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) >> +{ >> + VirtIOMEMPCI *mem_pci = VIRTIO_MEM_PCI(vpci_dev); >> + DeviceState *vdev = DEVICE(&mem_pci->vdev); >> + > > As we were having that discussion for other devices recently: I think > you want to use > > virtio_pci_force_virtio_1(vpci_dev); > > here. (Or do it via the names in the type, as virtio-fs does, but I > think I like forcing it better.) Interesting. There is a PULL request pending which includes virtio-mem, so I'll send that as an addon. Thanks! -- Thanks, David / dhildenb