[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251204100333.1034767-1-arnd@kernel.org>
Date: Thu, 4 Dec 2025 11:03:29 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Jason Gunthorpe <jgg@...pe.ca>,
Kevin Tian <kevin.tian@...el.com>,
Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>,
Nicolin Chen <nicolinc@...dia.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Robin Murphy <robin.murphy@....com>,
Lu Baolu <baolu.lu@...ux.intel.com>,
Alex Mastro <amastro@...com>,
iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH] iommufd: fix building without dmabuf
From: Arnd Bergmann <arnd@...db.de>
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: 44ebaa1744fd ("iommufd: Accept a DMABUF through IOMMU_IOAS_MAP_FILE")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/iommu/iommufd/io_pagetable.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommufd/io_pagetable.c b/drivers/iommu/iommufd/io_pagetable.c
index 54cf4d856179..d22e86de03e9 100644
--- a/drivers/iommu/iommufd/io_pagetable.c
+++ b/drivers/iommu/iommufd/io_pagetable.c
@@ -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);
- dmabuf = dma_buf_get(fd);
+ if (IS_ENABLED(CONFIG_DMABUF_HEAPS))
+ 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,
--
2.39.5
Powered by blists - more mailing lists