Commit 69dc538a authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jason Gunthorpe
Browse files

iommufd: Fix building without dmabuf

When DMABUF is disabled, trying to use it causes a link failure:

x86_64-linux-ld: drivers/iommu/iommufd/io_pagetable.o: in function `iopt_map_file_pages':
io_pagetable.c:(.text+0x1735): undefined reference to `dma_buf_get'
x86_64-linux-ld: io_pagetable.c:(.text+0x1775): undefined reference to `dma_buf_put'

Fixes: 44ebaa17 ("iommufd: Accept a DMABUF through IOMMU_IOAS_MAP_FILE")
Link: https://patch.msgid.link/r/20251204100333.1034767-1-arnd@kernel.org


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 8f0b4cce
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -495,7 +495,11 @@ int iopt_map_file_pages(struct iommufd_ctx *ictx, struct io_pagetable *iopt,
		return -EOVERFLOW;

	start_byte = start - ALIGN_DOWN(start, PAGE_SIZE);
	if (IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
		dmabuf = dma_buf_get(fd);
	else
		dmabuf = ERR_PTR(-ENXIO);

	if (!IS_ERR(dmabuf)) {
		pages = iopt_alloc_dmabuf_pages(ictx, dmabuf, start_byte, start,
						length,