[libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Bjoern Walk posted 1 patch 3 weeks ago
Test syntax-check passed
Failed in applying to current master (apply log)
src/qemu/qemu_hotplug.c | 6 ++++++
1 file changed, 6 insertions(+)

[libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Posted by Bjoern Walk 3 weeks ago
When attaching a mediated host device of model vfio-ccw without
specifying a guest-address, none is generated by libvirt. Let's fix this
and make sure to generate a device address during live-hotplug.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
---
 src/qemu/qemu_hotplug.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index fd4bafef..7b775159 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2790,6 +2790,8 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
 {
     int ret = -1;
     g_autofree char *devstr = NULL;
+    char *devName = NULL;
+    bool releaseaddr = false;
     bool added = false;
     bool teardowncgroup = false;
     bool teardownlabel = false;
@@ -2805,6 +2807,10 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
             return -1;
         break;
     case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
+        devName = hostdev->source.subsys.u.mdev.uuidstr;
+        if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, devName) < 0)
+            return -1;
+        break;
     case VIR_MDEV_MODEL_TYPE_LAST:
         break;
     }
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Posted by Ján Tomko 1 week ago
On Mon, Oct 28, 2019 at 09:06:13AM +0100, Bjoern Walk wrote:
>When attaching a mediated host device of model vfio-ccw without
>specifying a guest-address, none is generated by libvirt. Let's fix this
>and make sure to generate a device address during live-hotplug.
>
>Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
>Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
>---
> src/qemu/qemu_hotplug.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
>index fd4bafef..7b775159 100644
>--- a/src/qemu/qemu_hotplug.c
>+++ b/src/qemu/qemu_hotplug.c
>@@ -2790,6 +2790,8 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
> {
>     int ret = -1;
>     g_autofree char *devstr = NULL;
>+    char *devName = NULL;
>+    bool releaseaddr = false;
>     bool added = false;
>     bool teardowncgroup = false;
>     bool teardownlabel = false;
>@@ -2805,6 +2807,10 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
>             return -1;
>         break;
>     case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
>+        devName = hostdev->source.subsys.u.mdev.uuidstr;
>+        if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, devName) < 0)

vfio-ccw is not really a virtio device, is it?

Jano

>+            return -1;
>+        break;
>     case VIR_MDEV_MODEL_TYPE_LAST:
>         break;
>     }
>-- 
>2.21.0
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Posted by Bjoern Walk 1 week ago
Ján Tomko <jtomko@redhat.com> [2019-11-12, 10:47AM +0100]:
> > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> > index fd4bafef..7b775159 100644
> > --- a/src/qemu/qemu_hotplug.c
> > +++ b/src/qemu/qemu_hotplug.c
> > @@ -2790,6 +2790,8 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
> > {
> >     int ret = -1;
> >     g_autofree char *devstr = NULL;
> > +    char *devName = NULL;
> > +    bool releaseaddr = false;
> >     bool added = false;
> >     bool teardowncgroup = false;
> >     bool teardownlabel = false;
> > @@ -2805,6 +2807,10 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
> >             return -1;
> >         break;
> >     case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
> > +        devName = hostdev->source.subsys.u.mdev.uuidstr;
> > +        if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, devName) < 0)
> 
> vfio-ccw is not really a virtio device, is it?

The naming of that function is rather odd and misleading. It sets the
address type of the device if not set and generates the correct address,
exactly what we need here.

Somewhere on my TODO-list I have a point to go over the address
generation for CCW and clean it up. For now, this must suffice.

-- 
IBM Systems
Linux on Z & Virtualization Development
--------------------------------------------------
IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819
--------------------------------------------------
Vorsitzende des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Posted by Ján Tomko 1 week ago
On Tue, Nov 12, 2019 at 12:06:46PM +0100, Bjoern Walk wrote:
>Ján Tomko <jtomko@redhat.com> [2019-11-12, 10:47AM +0100]:
>> > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
>> > index fd4bafef..7b775159 100644
>> > --- a/src/qemu/qemu_hotplug.c
>> > +++ b/src/qemu/qemu_hotplug.c
>> > @@ -2790,6 +2790,8 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
>> > {
>> >     int ret = -1;
>> >     g_autofree char *devstr = NULL;
>> > +    char *devName = NULL;
>> > +    bool releaseaddr = false;

Having these scoped for the whole function is excessive. Especially the
misleading releaseaddr, which is never used.

>> >     bool added = false;
>> >     bool teardowncgroup = false;
>> >     bool teardownlabel = false;
>> > @@ -2805,6 +2807,10 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
>> >             return -1;
>> >         break;
>> >     case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
>> > +        devName = hostdev->source.subsys.u.mdev.uuidstr;
>> > +        if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, devName) < 0)
>>
>> vfio-ccw is not really a virtio device, is it?
>
>The naming of that function is rather odd and misleading. It sets the
>address type of the device if not set and generates the correct address,
>exactly what we need here.
>

Oh right, not even VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 seems to
be virtio-related.

>Somewhere on my TODO-list I have a point to go over the address
>generation for CCW and clean it up. For now, this must suffice.

It does seem to be more complicated than it needs to be.

With the declarations moved into the switch case:
Reviewed-by: Ján Tomko <jtomko@redhat.com>

and pushed.

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Posted by Bjoern Walk 1 week ago
Ján Tomko <jtomko@redhat.com> [2019-11-12, 04:45PM +0100]:
> On Tue, Nov 12, 2019 at 12:06:46PM +0100, Bjoern Walk wrote:
> > Somewhere on my TODO-list I have a point to go over the address
> > generation for CCW and clean it up. For now, this must suffice.
> 
> It does seem to be more complicated than it needs to be.

Yes, indeed.

> 
> With the declarations moved into the switch case:
> Reviewed-by: Ján Tomko <jtomko@redhat.com>
> 
> and pushed.

Thank you!

-- 
IBM Systems
Linux on Z & Virtualization Development
--------------------------------------------------
IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819
--------------------------------------------------
Vorsitzende des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Posted by Daniel Henrique Barboza 1 week ago

On 10/28/19 5:06 AM, Bjoern Walk wrote:
> When attaching a mediated host device of model vfio-ccw without
> specifying a guest-address, none is generated by libvirt. Let's fix this
> and make sure to generate a device address during live-hotplug.
> 
> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Posted by Bjoern Walk 1 week ago
ping...

-- 
IBM Systems
Linux on Z & Virtualization Development
--------------------------------------------------
IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819
--------------------------------------------------
Vorsitzende des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: hotplug: ensure address generation for vfio-ccw

Posted by Bjoern Walk 2 weeks ago
Bjoern Walk <bwalk@linux.ibm.com> [2019-10-28, 09:06AM +0100]:
> When attaching a mediated host device of model vfio-ccw without
> specifying a guest-address, none is generated by libvirt. Let's fix this
> and make sure to generate a device address during live-hotplug.

I know we are already in freeze, but it still would be good to have this
fix for S390 in 5.9 if possible.

-- 
IBM Systems
Linux on Z & Virtualization Development
--------------------------------------------------
IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819
--------------------------------------------------
Vorsitzende des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list