Skip to content

Commit 69dc538

Browse files
arndbjgunthorpe
authored andcommitted
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: 44ebaa1 ("iommufd: Accept a DMABUF through IOMMU_IOAS_MAP_FILE") Link: https://patch.msgid.link/r/20251204100333.1034767-1-arnd@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 8f0b4cc commit 69dc538

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/iommu/iommufd/io_pagetable.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,11 @@ int iopt_map_file_pages(struct iommufd_ctx *ictx, struct io_pagetable *iopt,
495495
return -EOVERFLOW;
496496

497497
start_byte = start - ALIGN_DOWN(start, PAGE_SIZE);
498-
dmabuf = dma_buf_get(fd);
498+
if (IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
499+
dmabuf = dma_buf_get(fd);
500+
else
501+
dmabuf = ERR_PTR(-ENXIO);
502+
499503
if (!IS_ERR(dmabuf)) {
500504
pages = iopt_alloc_dmabuf_pages(ictx, dmabuf, start_byte, start,
501505
length,

0 commit comments

Comments
 (0)