[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2 15/25] qemu: Support hostdev model=virtio-{non-}transitional



On Wed, 2019-01-23 at 16:32 -0500, Cole Robinson wrote:
[...]
> @@ -479,12 +479,20 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
>              ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL;
>              break;
>  
> +        case VIR_DOMAIN_DEVICE_HOSTDEV:
> +            if (device.data.hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST)
> +                return 0;
> +            has_tmodel = device.data.hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL;
> +            has_ntmodel = device.data.hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL;
> +            tmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL;
> +            ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL;
> +            break;

Same comment as for disks, and this time it would make even more
sense considering just how incredibly long some of the lines get
when you have to traverse the entire structure all in one go...

[...]
> @@ -785,11 +785,14 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
>              return pcieFlags;
>  
>          /* according to pbonzini, from the guest PoV vhost-scsi devices
> -         * are the same as virtio-scsi, so they should use virtioFlags
> -         * (same as virtio-scsi) to determine Express vs. legacy placement
> +         * are the same as virtio-scsi, so they should follow virtio logic
>           */
> -        if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST)
> +        if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) {
> +            /* Transitional devices only work in conventional PCI slots */
> +            if (hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL)
> +                return pciFlags;
>              return virtioFlags;
> +        }

Using a switch statement here would be nice too.

-- 
Andrea Bolognani / Red Hat / Virtualization


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]