[PATCH v1] virtio-mem-pci: force virtio version 1

David Hildenbrand posted 1 patch 3 years, 8 months ago
Test checkpatch passed
Test docker-mingw@fedora passed
Test FreeBSD passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200708143619.38743-1-david@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, David Hildenbrand <david@redhat.com>
There is a newer version of this series
hw/virtio/virtio-mem-pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH v1] virtio-mem-pci: force virtio version 1
Posted by David Hildenbrand 3 years, 8 months ago
Let's 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")
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 1a8e854123..831022aa86 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), true, "realized", 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


Re: [PATCH v1] virtio-mem-pci: force virtio version 1
Posted by David Hildenbrand 3 years, 8 months ago
On 08.07.20 16:36, David Hildenbrand wrote:
> Let's 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")
> 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 1a8e854123..831022aa86 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), true, "realized", 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,
> 

Ping @mst

-- 
Thanks,

David / dhildenb


Re: [PATCH v1] virtio-mem-pci: force virtio version 1
Posted by David Hildenbrand 3 years, 8 months ago
On 22.07.20 16:22, David Hildenbrand wrote:
> On 08.07.20 16:36, David Hildenbrand wrote:
>> Let's 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")
>> 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 1a8e854123..831022aa86 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), true, "realized", 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,
>>
> 
> Ping @mst
> 

With Conny's patches in, simple virtio-mem examples currently fail 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

So we really want this in QEMU 5.1

-- 
Thanks,

David / dhildenb


Re: [PATCH v1] virtio-mem-pci: force virtio version 1
Posted by Michael S. Tsirkin 3 years, 8 months ago
On Mon, Jul 27, 2020 at 01:42:56PM +0200, David Hildenbrand wrote:
> On 22.07.20 16:22, David Hildenbrand wrote:
> > On 08.07.20 16:36, David Hildenbrand wrote:
> >> Let's 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")
> >> 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 1a8e854123..831022aa86 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), true, "realized", 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,
> >>
> > 
> > Ping @mst
> > 
> 
> With Conny's patches in, simple virtio-mem examples currently fail 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
> 
> So we really want this in QEMU 5.1
> 
> -- 
> Thanks,
> 
> David / dhildenb

That's something to note in the commit log btw.


-- 
MST


Re: [PATCH v1] virtio-mem-pci: force virtio version 1
Posted by Michael S. Tsirkin 3 years, 8 months ago
On Mon, Jul 27, 2020 at 07:49:12AM -0400, Michael S. Tsirkin wrote:
> On Mon, Jul 27, 2020 at 01:42:56PM +0200, David Hildenbrand wrote:
> > On 22.07.20 16:22, David Hildenbrand wrote:
> > > On 08.07.20 16:36, David Hildenbrand wrote:
> > >> Let's 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")
> > >> 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 1a8e854123..831022aa86 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), true, "realized", 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,
> > >>
> > > 
> > > Ping @mst
> > > 
> > 
> > With Conny's patches in, simple virtio-mem examples currently fail 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
> > 
> > So we really want this in QEMU 5.1
> > 
> > -- 
> > Thanks,
> > 
> > David / dhildenb
> 
> That's something to note in the commit log btw.


Sorry, could you rebase pls? You could include the above
in the commit log then. Thanks and sorry about the delay!

> 
> -- 
> MST


Re: [PATCH v1] virtio-mem-pci: force virtio version 1
Posted by Cornelia Huck 3 years, 8 months ago
On Wed,  8 Jul 2020 16:36:19 +0200
David Hildenbrand <david@redhat.com> wrote:

> Let's force virtio version 1. While at it, use qdev_realize() to set
> the parent bus and realize - like most other virtio-*-pci
> implementations.

Yes, there's recently been a mass conversion to qdev_realize().

> 
> Fixes: 0b9a2443a48b ("virtio-pci: Proxy for virtio-mem")
> 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 1a8e854123..831022aa86 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), true, "realized", 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,

Reviewed-by: Cornelia Huck <cohuck@redhat.com>