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

Ján Tomko jtomko at redhat.com
Tue Nov 12 15:45:07 UTC 2019


On Tue, Nov 12, 2019 at 12:06:46PM +0100, Bjoern Walk wrote:
>Ján Tomko <jtomko at 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 at redhat.com>

and pushed.

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191112/a0c04b2d/attachment-0001.sig>


More information about the libvir-list mailing list