[dpdk-dev] [PATCH v4 09/14] virtio: ethdev: check for vfio interface

Santosh Shukla sshukla at mvista.com
Fri Jan 15 13:37:30 CET 2016


On Fri, Jan 15, 2016 at 12:05 PM, Yuanhan Liu
<yuanhan.liu at linux.intel.com> wrote:
> On Thu, Jan 14, 2016 at 06:58:32PM +0530, Santosh Shukla wrote:
>> Introducing api to check interface type is vfio or not, if interface is vfio
>> then update struct virtio_vfio_dev {}.
>>
>> Those two apis are:
>> - virtio_chk_for_vfio
>> - virtio_hw_init_by_vfio
>>
>> Signed-off-by: Santosh Shukla <sshukla at mvista.com>
> ..
>> +/* Init virtio by vfio-way */
>> +static int virtio_hw_init_by_vfio(struct virtio_hw *hw,
>> +                               struct rte_pci_device *pci_dev)
>> +{
>> +     struct virtio_vfio_dev *vdev;
>> +
>> +     vdev = &hw->dev;
>> +     if (virtio_chk_for_vfio(pci_dev) < 0) {
>> +             vdev->is_vfio = false;
>> +             vdev->pci_dev = NULL;
>> +             return -1;
>> +     }
>> +
>> +     /* .. So attached interface is vfio */
>> +     vdev->is_vfio = true;
>> +     vdev->pci_dev = pci_dev;
>
> Normally, I don't like the way of adding yet another "virtio_hw_init_by_xxx".
>
> As suggested in another reply, would pci_dev->kdrv checking be enough?
> If so, do it in simple way.
>

No, It wont be enough, Virtio could only work for vfio for _noiommu_
mode and for that user need to preset -noiommu parameter, therefore
virtio need to check that parame. pci_dev->kdrv check not enough,
Hence not used.

>         --ylu


More information about the dev mailing list