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

Liu, Yi L
2020-10-20T09:40:47Z

> From: Jason Wang <jasowang@redhat.com>
> Sent: Tuesday, October 20, 2020 5:20 PM
>
> 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.

If you have multiple devices assigned to a VM, you won't expect to bind all
of them to a PASID in a single bind operation, right? you may want to bind
only the devices you really mean. This manner should be more flexible and
reasonable. :-)

>
> >
> >>>>> 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.

L2 table sharing is not mandatory. The mapping is the same, but no need to
assume L2 tables are shared. Especially for VFIO/vDPA devices. Even within
a passthru framework, like VFIO, if the attributes of backend IOMMU are not
the same, the L2 page table are not shared, but the mapping is the same.

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

yes, but this is not a functional issue, right? If we want to solve it, we
should have a single uAPI set which can handle both L1 and L2 management.
That's also why you proposed to replace type1 driver. right?

Regards,
Yi Liu

>
> Thanks
>
>
> >
> > Regards,
> > Yi Liu
> >