Re: [PATCH] vhost/vsock: add IOTLB API support

Stefano Garzarella
2020-10-30T10:54:37Z

On Fri, Oct 30, 2020 at 06:02:18PM +0800, Jason Wang wrote:
>
>On 2020/10/30 上午1:43, Stefano Garzarella wrote:
>>This patch enables the IOTLB API support for vhost-vsock devices,
>>allowing the userspace to emulate an IOMMU for the guest.
>>
>>These changes were made following vhost-net, in details this patch:
>>- exposes VIRTIO_F_ACCESS_PLATFORM feature and inits the iotlb
>> device if the feature is acked
>>- implements VHOST_GET_BACKEND_FEATURES and
>> VHOST_SET_BACKEND_FEATURES ioctls
>>- calls vq_meta_prefetch() before vq processing to prefetch vq
>> metadata address in IOTLB
>>- provides .read_iter, .write_iter, and .poll callbacks for the
>> chardev; they are used by the userspace to exchange IOTLB messages
>>
>>This patch was tested with QEMU and a patch applied [1] to fix a
>>simple issue:
>> $ qemu -M q35,accel=kvm,kernel-irqchip=split \
>> -drive file=fedora.qcow2,format=qcow2,if=virtio \
>> -device intel-iommu,intremap=on \
>> -device vhost-vsock-pci,guest-cid=3,iommu_platform=on
>
>
>Patch looks good, but a question:
>
>It looks to me you don't enable ATS which means vhost won't get any
>invalidation request or did I miss anything?
>

You're right, I didn't see invalidation requests, only miss and updates.
Now I have tried to enable 'ats' and 'device-iotlb' but I still don't
see any invalidation.

How can I test it? (Sorry but I don't have much experience yet with
vIOMMU)

Thanks,
Stefano