]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
NTB: core: Add .get_dma_dev() callback to ntb_dev_ops
authorKoichiro Den <den@valinux.co.jp>
Fri, 6 Mar 2026 03:14:41 +0000 (12:14 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 27 Mar 2026 15:56:05 +0000 (10:56 -0500)
commit362a4549f2acfb03390ddfcd91041e65a11a739f
tree38d20395b0ea3dce0cd70060005f54bd71c9a8fc
parent396d44dcaf8d367ed15ecec30e2f69c62f93306c
NTB: core: Add .get_dma_dev() callback to ntb_dev_ops

Some NTB implementations are backed by a PCI function that is not the right
struct device to use with DMA API helpers (e.g. due to IOMMU topology, or
because the NTB device is virtual).

Add an optional .get_dma_dev() callback to struct ntb_dev_ops and provide a
helper, ntb_get_dma_dev(), so NTB clients can use the appropriate struct
device for DMA allocations and mappings.

If the callback is not implemented, ntb_get_dma_dev() returns the current
default (ntb->dev.parent). Drivers that implement .get_dma_dev() must
return a non-NULL device.

Suggested-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
[bhelgaas: format doc]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260306031443.1911860-2-den@valinux.co.jp
include/linux/ntb.h