* Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf [not found] ` <20260324234615.3731237-2-zhipingz@meta.com> @ 2026-03-25 8:25 ` Leon Romanovsky 2026-03-26 22:41 ` Keith Busch 0 siblings, 1 reply; 3+ messages in thread From: Leon Romanovsky @ 2026-03-25 8:25 UTC (permalink / raw) To: Zhiping Zhang Cc: Jason Gunthorpe, Bjorn Helgaas, linux-rdma, linux-pci, netdev, dri-devel, Keith Busch, Yochai Cohen, Yishai Hadas, Bjorn Helgaas On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote: > This patch adds a callback to get the tph info on DMA buffer exporters. > The tph info includes both the steering tag and the process hint (ph). > > The steering tag and ph are encoded in the flags field of > vfio_device_feature_dma_buf instead of adding new fields to the uapi > struct, to preserve ABI compatibility. > > Signed-off-by: Zhiping Zhang <zhipingz@meta.com> > --- > drivers/vfio/pci/vfio_pci_dmabuf.c | 26 ++++++++++++++++++++++++-- > include/linux/dma-buf.h | 30 ++++++++++++++++++++++++++++++ > include/uapi/linux/vfio.h | 9 +++++++-- > 3 files changed, 61 insertions(+), 4 deletions(-) <...> > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > index bb7b89330d35..e2a8962641d2 100644 > --- a/include/uapi/linux/vfio.h > +++ b/include/uapi/linux/vfio.h > @@ -1505,8 +1505,13 @@ struct vfio_region_dma_range { > struct vfio_device_feature_dma_buf { > __u32 region_index; > __u32 open_flags; > - __u32 flags; > - __u32 nr_ranges; > + __u32 flags; > +#define VFIO_DMABUF_FL_TPH (1U << 0) /* TPH info is present */ > +#define VFIO_DMABUF_TPH_PH_SHIFT 1 /* bits 1-2: PH (2-bit) */ > +#define VFIO_DMABUF_TPH_PH_MASK 0x6U > +#define VFIO_DMABUF_TPH_ST_SHIFT 16 /* bits 16-31: steering tag */ > +#define VFIO_DMABUF_TPH_ST_MASK 0xffff0000U This extension of flags is basically kills future extension of this struct for anything that includes TPH. Add new enum vfio_device_feature_dma_buf_flags { VFIO_DMABUF_FL_TPH = 1 << 0 } > + __u32 nr_ranges; add your "__u16 steering_tag" and "__u8 ph" fields here. > struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges); > }; > > -- > 2.52.0 > > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf 2026-03-25 8:25 ` [RFC v2 1/2] vfio: add callback to get tph info for dmabuf Leon Romanovsky @ 2026-03-26 22:41 ` Keith Busch 2026-03-26 22:55 ` Zhiping Zhang 0 siblings, 1 reply; 3+ messages in thread From: Keith Busch @ 2026-03-26 22:41 UTC (permalink / raw) To: Leon Romanovsky Cc: Zhiping Zhang, Jason Gunthorpe, Bjorn Helgaas, linux-rdma, linux-pci, netdev, dri-devel, Yochai Cohen, Yishai Hadas, Bjorn Helgaas On Wed, Mar 25, 2026 at 10:25:34AM +0200, Leon Romanovsky wrote: > On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote: > > struct vfio_device_feature_dma_buf { > > __u32 region_index; > > __u32 open_flags; > > - __u32 flags; > > - __u32 nr_ranges; > > + __u32 flags; > > +#define VFIO_DMABUF_FL_TPH (1U << 0) /* TPH info is present */ > > +#define VFIO_DMABUF_TPH_PH_SHIFT 1 /* bits 1-2: PH (2-bit) */ > > +#define VFIO_DMABUF_TPH_PH_MASK 0x6U > > +#define VFIO_DMABUF_TPH_ST_SHIFT 16 /* bits 16-31: steering tag */ > > +#define VFIO_DMABUF_TPH_ST_MASK 0xffff0000U > > This extension of flags is basically kills future extension of this > struct for anything that includes TPH. > > Add new > enum vfio_device_feature_dma_buf_flags { > VFIO_DMABUF_FL_TPH = 1 << 0 > } > > > + __u32 nr_ranges; > > add your "__u16 steering_tag" and "__u8 ph" fields here. You're suggesting that Ziping append the new fields to the end of this struct? I don't think we can modify the layout of a uapi. If we can't carve the space for this out of the existing unused flags field, I think we'd have to introduce a new vfio device feature that basically copies VFIO_DEVICE_FEATURE_DMA_BUF with the extra hints fields. > > struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges); > > }; ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC v2 1/2] vfio: add callback to get tph info for dmabuf 2026-03-26 22:41 ` Keith Busch @ 2026-03-26 22:55 ` Zhiping Zhang 0 siblings, 0 replies; 3+ messages in thread From: Zhiping Zhang @ 2026-03-26 22:55 UTC (permalink / raw) To: Keith Busch Cc: Leon Romanovsky, Jason Gunthorpe, Bjorn Helgaas, linux-rdma, linux-pci, netdev, dri-devel, Yochai Cohen, Yishai Hadas, Bjorn Helgaas On Thu, Mar 26, 2026 at 3:41 PM Keith Busch <kbusch@kernel.org> wrote: > > > > On Wed, Mar 25, 2026 at 10:25:34AM +0200, Leon Romanovsky wrote: > > On Tue, Mar 24, 2026 at 04:46:02PM -0700, Zhiping Zhang wrote: > > > struct vfio_device_feature_dma_buf { > > > __u32 region_index; > > > __u32 open_flags; > > > - __u32 flags; > > > - __u32 nr_ranges; > > > + __u32 flags; > > > +#define VFIO_DMABUF_FL_TPH (1U << 0) /* TPH info is present */ > > > +#define VFIO_DMABUF_TPH_PH_SHIFT 1 /* bits 1-2: PH (2-bit) */ > > > +#define VFIO_DMABUF_TPH_PH_MASK 0x6U > > > +#define VFIO_DMABUF_TPH_ST_SHIFT 16 /* bits 16-31: steering tag */ > > > +#define VFIO_DMABUF_TPH_ST_MASK 0xffff0000U > > > > This extension of flags is basically kills future extension of this > > struct for anything that includes TPH. > > > > Add new > > enum vfio_device_feature_dma_buf_flags { > > VFIO_DMABUF_FL_TPH = 1 << 0 > > } yes we can do that. > > > > > + __u32 nr_ranges; > > > > add your "__u16 steering_tag" and "__u8 ph" fields here. > That is what I did in V1, Leon. > You're suggesting that Ziping append the new fields to the end of this > struct? I don't think we can modify the layout of a uapi. > > If we can't carve the space for this out of the existing unused flags > field, I think we'd have to introduce a new vfio device feature that > basically copies VFIO_DEVICE_FEATURE_DMA_BUF with the extra hints > fields. > if not using the fields in the flag, then we probably have to introduce a new vfio device feature. > > > struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges); > > > }; ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-26 22:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260324234615.3731237-1-zhipingz@meta.com>
[not found] ` <20260324234615.3731237-2-zhipingz@meta.com>
2026-03-25 8:25 ` [RFC v2 1/2] vfio: add callback to get tph info for dmabuf Leon Romanovsky
2026-03-26 22:41 ` Keith Busch
2026-03-26 22:55 ` Zhiping Zhang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox