qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] virtio-mem-pci: force virtio version 1
@ 2020-07-27 11:59 David Hildenbrand
  2020-07-27 13:06 ` Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: David Hildenbrand @ 2020-07-27 11:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cornelia Huck, Michael S. Tsirkin, David Hildenbrand

Trying to run simple virtio-mem-pci examples currently fails with
    qemu-system-x86_64: -device virtio-mem-pci,id=vm0,memdev=mem0,node=0,
    requested-size=300M: device is modern-only, use disable-legacy=on
due to the added safety checks in 9b3a35ec8236 ("virtio: verify that legacy
support is not accidentally on").

As noted by Conny, we have to force virtio version 1. While at it, use
qdev_realize() to set the parent bus and realize - like most other
virtio-*-pci implementations.

Fixes: 0b9a2443a48b ("virtio-pci: Proxy for virtio-mem")
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 hw/virtio/virtio-mem-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c
index d375280ee1..590cec041b 100644
--- a/hw/virtio/virtio-mem-pci.c
+++ b/hw/virtio/virtio-mem-pci.c
@@ -21,8 +21,8 @@ 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);
 
-    qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
-    object_property_set_bool(OBJECT(vdev), "realized", true, errp);
+    virtio_pci_force_virtio_1(vpci_dev);
+    qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
 }
 
 static void virtio_mem_pci_set_addr(MemoryDeviceState *md, uint64_t addr,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] virtio-mem-pci: force virtio version 1
  2020-07-27 11:59 [PATCH v2] virtio-mem-pci: force virtio version 1 David Hildenbrand
@ 2020-07-27 13:06 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2020-07-27 13:06 UTC (permalink / raw)
  To: David Hildenbrand; +Cc: Cornelia Huck, qemu-devel

On Mon, Jul 27, 2020 at 01:59:05PM +0200, David Hildenbrand wrote:
> Trying to run simple virtio-mem-pci examples currently fails with
>     qemu-system-x86_64: -device virtio-mem-pci,id=vm0,memdev=mem0,node=0,
>     requested-size=300M: device is modern-only, use disable-legacy=on
> due to the added safety checks in 9b3a35ec8236 ("virtio: verify that legacy
> support is not accidentally on").
> 
> As noted by Conny, we have to force virtio version 1. While at it, use
> qdev_realize() to set the parent bus and realize - like most other
> virtio-*-pci implementations.
> 
> Fixes: 0b9a2443a48b ("virtio-pci: Proxy for virtio-mem")
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---


In the future, pls add a changelog here.
E.g.
changes from v1:
- rebased on master
- updated commit log to address mst's comments

Anyway, queued.

Thanks!

>  hw/virtio/virtio-mem-pci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c
> index d375280ee1..590cec041b 100644
> --- a/hw/virtio/virtio-mem-pci.c
> +++ b/hw/virtio/virtio-mem-pci.c
> @@ -21,8 +21,8 @@ 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);
>  
> -    qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
> -    object_property_set_bool(OBJECT(vdev), "realized", true, errp);
> +    virtio_pci_force_virtio_1(vpci_dev);
> +    qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
>  }
>  
>  static void virtio_mem_pci_set_addr(MemoryDeviceState *md, uint64_t addr,
> -- 
> 2.26.2



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-27 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-27 11:59 [PATCH v2] virtio-mem-pci: force virtio version 1 David Hildenbrand
2020-07-27 13:06 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).