lkml.org 
[lkml]   [2021]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v11 03/13] vfio: VFIO_IOMMU_SET_MSI_BINDING
    From
    Date
    Hi Eric,

    On 2020/11/16 19:00, Eric Auger wrote:
    > This patch adds the VFIO_IOMMU_SET_MSI_BINDING ioctl which aim
    > to (un)register the guest MSI binding to the host. This latter
    > then can use those stage 1 bindings to build a nested stage
    > binding targeting the physical MSIs.
    [...]

    > +static int vfio_iommu_type1_set_msi_binding(struct vfio_iommu *iommu,
    > + unsigned long arg)
    > +{
    > + struct vfio_iommu_type1_set_msi_binding msi_binding;
    > + unsigned long minsz;
    > + int ret = -EINVAL;
    > +
    > + minsz = offsetofend(struct vfio_iommu_type1_set_msi_binding,
    > + size);
    > +
    > + if (copy_from_user(&msi_binding, (void __user *)arg, minsz))
    > + return -EFAULT;
    > +
    > + if (msi_binding.argsz < minsz)
    > + return -EINVAL;
    We can check BIND and UNBIND are not set simultaneously, just like VFIO_IOMMU_SET_PASID_TABLE.

    > +
    > + if (msi_binding.flags == VFIO_IOMMU_UNBIND_MSI) {
    > + vfio_unbind_msi(iommu, msi_binding.iova);
    > + ret = 0;
    > + } else if (msi_binding.flags == VFIO_IOMMU_BIND_MSI) {
    > + ret = vfio_bind_msi(iommu, msi_binding.iova,
    > + msi_binding.gpa, msi_binding.size);
    > + }
    > + return ret;
    > +}
    > +

    Thanks,
    Keqian

    \
     
     \ /
      Last update: 2021-02-02 13:11    [W:4.109 / U:0.096 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site