Re: [PATCH v13 4/5] vfio/pci: implement get_pci_tph and DMA_BUF_TPH feature
[email protected] Fri, 31 Jul 2026 21:38:24 +0000
| Newsgroups | org.kernel.vger.linux-pci,org.freedesktop.lists.dri-devel,org.kernel.vger.kvm |
|---|---|
| Message-ID | <[email protected]> |
> Implement dma-buf get_pci_tph for vfio-pci exported dma-bufs and add > VFIO_DEVICE_FEATURE_DMA_BUF_TPH so userspace can publish TPH metadata > for a VFIO-owned device. > > 8-bit ST and 16-bit Extended ST are distinct PCIe TPH namespaces; the > uAPI carries both with explicit validity flags, and get_pci_tph() > returns the value matching the importer's requested namespace or > -EOPNOTSUPP. > > Publish and read the TPH descriptor under dmabuf->resv, matching the > locking used for other importer-visible dma-buf state. The SET ioctl > takes dma_resv_lock_interruptible(), while the callback runs under > DMA-buf's asserted resv lock. > > Hold memory_lock in the SET path while checking that the dma-buf still > [ ... ] > supported on a device that advertises TPH Completer support but cannot > export a vfio dma-buf at all, so no dma-buf can ever exist to carry the > metadata and every SET would fail later at the ownership check. > > Signed-off-by: Zhiping Zhang <[email protected]> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=4