iommufd: fix building without dmabuf
PATCH 1/1 iommufd: fix building without dmabuf
From: Arnd Bergmann <[email protected]>
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'
--- drivers/iommu/iommufd/io_pagetable.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/iommufd/io_pagetable.c +5 -1
@@ -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,
Signature · 1 line
2.39.5
Quoted 19 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
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 <[email protected]>--- drivers/iommu/iommufd/io_pagetable.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/iommu/iommufd/io_pagetable.c +0
-0
drivers/iommu/iommufd/io_pagetable.c int iopt_map_file_pages(struct iommufd_ctx *ictx, struct io_pagetable *iopt, · line 501
Quoted 8 lines
drivers/iommu/iommufd/io_pagetable.c +4
-1@@ -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 );
Shouldn't this be fixed in include/linux/dma-buf.h with a stub always fail inline?
Jason
Quoted 8 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
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'
Quoted 5 lines
Fixes 44ebaa1744fd ("iommufd: Accept a DMABUF through IOMMU_IOAS_MAP_FILE")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/iommu/iommufd/io_pagetable.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
I picked this up anyhow since it looked like adding #ifdef stubs to dma_buf.h was going to be a bigger thing
drivers/iommu/iommufd/io_pagetable.c int iopt_map_file_pages(struct iommufd_ctx *ictx, struct io_pagetable *iopt, · line 499
Quoted 2 lines
drivers/iommu/iommufd/io_pagetable.c +2
-0+if (IS_ENABLED (CONFIG_DMABUF_HEAPS )) + dmabuf =dma_buf_get (fd);
But this needs to be:
if (IS_ENABLED(CONFIG_DMA_SHARED_BUFFER)) dmabuf = dma_buf_get(fd);
I fixed it
Thanks,
Jason
Quoted 9 lines · Jason Gunthorpe
I picked this up anyhow since it looked like adding #ifdef stubs to
dma_buf.hwas going to be a bigger thingdrivers/iommu/iommufd/io_pagetable.c int iopt_map_file_pages(struct iommufd_ctx *ictx, struct io_pagetable *iopt, · line 499
Quoted 2 lines
drivers/iommu/iommufd/io_pagetable.c +2
-0+if (IS_ENABLED (CONFIG_DMABUF_HEAPS )) + dmabuf =dma_buf_get (fd);But this needs to be:
Quoted 4 lines
if (IS_ENABLED(CONFIG_DMA_SHARED_BUFFER)) dmabuf = dma_buf_get(fd);I fixed it
Ok, thanks a lot!
Arnd