Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

Jason Wang
2020-10-20T09:20:45Z

Hi Yi:

On 2020/10/20 下午4:19, Liu, Yi L wrote:
>> Yes, but since PASID is a global identifier now, I think kernel should
>> track the a device list per PASID?
> We have such track. It's done in iommu driver. You can refer to the
> struct intel_svm. PASID is a global identifier, but it doesn’t affect that
> the PASID table is per-device.
>
>> So for such binding, PASID should be
>> sufficient for uAPI.
> not quite get it. PASID may be bound to multiple devices, how do
> you figure out the target device if you don’t provide such info.

I may miss soemthing but is there any reason that userspace need to
figure out the target device? PASID is about address space not a
specific device I think.

>
>>>>> The binding request is initiated by the virtual IOMMU, when capturing
>>>>> guest attempt of binding page table to a virtual PASID entry for a
>>>>> given device.
>>>> And for L2 page table programming, if PASID is use by both e.g VFIO and
>>>> vDPA, user need to choose one of uAPI to build l2 mappings?
>>> for L2 page table mappings, it's done by VFIO MAP/UNMAP. for vdpa, I guess
>>> it is tlb flush. so you are right. Keeping L1/L2 page table management in
>>> a single uAPI set is also a reason for my current series which extends VFIO
>>> for L1 management.
>> I'm afraid that would introduce confusing to userspace. E.g:
>>
>> 1) when having only vDPA device, it uses vDPA uAPI to do l2 management
>> 2) when vDPA shares PASID with VFIO, it will use VFIO uAPI to do the l2
>> management?
> I think vDPA will still use its own l2 for the l2 mappings. not sure why you
> need vDPA use VFIO's l2 management. I don't think it is the case.

See previous discussion with Kevin. If I understand correctly, you
expect a shared L2 table if vDPA and VFIO device are using the same PASID.

In this case, if l2 is still managed separately, there will be
duplicated request of map and unmap.

Thanks

>
> Regards,
> Yi Liu