On Sun, 1 Mar 2026 13:55:51 -0400, Jason Gunthorpe wrote:
> On Thu, Feb 26, 2026 at 06:21:28PM -0700, Keith Busch wrote:
> > On Tue, Feb 10, 2026 at 11:39:55AM -0800, Zhiping Zhang wrote:
> > > +static void get_tph_mr_dmabuf(struct mlx5_ib_dev *dev, int fd, u16
> > > *st_index,
> > > + u8 *ph)
> > > +{
> > > + int ret;
> > > + struct dma_buf *dmabuf;
> > > +
> > > + dmabuf = dma_buf_get(fd);
> > > + if (IS_ERR(dmabuf))
> > > + return;
> > > +
> > > + if (!dif there's any implication mabuf->ops->get_tph)
> > > + goto end_dbuf_put;
> > > +
> > > + ret = dmabuf->ops->get_tph(dmabuf, st_index, ph);
> >
> > You defined the "get_tph" function to take a pointer to a raw steering
> > tag value, but you're passing in the steering index to it's table.
>
> Yeah that's weird, there should be one TPH for a DMABUF, not many.
>
Good catch, I'll fix it.
> > But in general, since you're letting the user put whatever they want in
> > the vfio private area, should there be some validation that it's in the
> > valid range? I'm also not quite sure how user space comes to know what
> > steering tag to use, or what harm might happen if the wrong one is used.
>
> If the device is VFIO compatible then it needs to ensure that whatever
> it does with its steering tags fit the security model of VFIO. You
> can't harm the device - you can't reach outside the VFIO sandbox (eg
> into another VF or something) and so on.
>
> Under these conditions the kernel doesn't care what TPH is used, just
> let userspace specify the raw bits on the wire.
>
> Jason
thanks for clarification, that matches my understanding of how VFIO and
userspace drivers work.
Zhiping