summaryrefslogtreecommitdiffstats
path: root/drivers/accel
diff options
context:
space:
mode:
authorTomer Tayar <ttayar@habana.ai>2023-08-04 16:12:58 +0200
committerOded Gabbay <ogabbay@kernel.org>2023-10-09 11:37:21 +0200
commitdfdbc55a9c8c5ab00ae2d5963ac1199fdc9da2d3 (patch)
treee4bc2068000a5c3a67450682e1e93cd475d22c9f /drivers/accel
parentaccel/habanalabs: prevent sending heartbeat before events are enabled (diff)
downloadlinux-dfdbc55a9c8c5ab00ae2d5963ac1199fdc9da2d3.tar.xz
linux-dfdbc55a9c8c5ab00ae2d5963ac1199fdc9da2d3.zip
accel/habanalabs: always pass exported size to alloc_sgt_from_device_pages()
For Gaudi1 the exported dma-buf is always composed of a single page, and therefore the exported size is equal to this page's size. When calling alloc_sgt_from_device_pages(), we pass 0 as the exported size and internally calculate it as "number of pages * page size". This makes alloc_sgt_from_device_pages() less clear, because the exported size parameter is not understood as a restriction on the pages' size. Modify to always pass the exported size explicitly. Signed-off-by: Tomer Tayar <ttayar@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/accel')
-rw-r--r--drivers/accel/habanalabs/common/memory.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/accel/habanalabs/common/memory.c b/drivers/accel/habanalabs/common/memory.c
index 1b1b4256b011..c7e49cb383cf 100644
--- a/drivers/accel/habanalabs/common/memory.c
+++ b/drivers/accel/habanalabs/common/memory.c
@@ -1561,8 +1561,7 @@ static struct sg_table *alloc_sgt_from_device_pages(struct hl_device *hdev, u64
if (!sgt)
return ERR_PTR(-ENOMEM);
- /* remove export size restrictions in case not explicitly defined */
- cur_size_to_export = exported_size ? exported_size : (npages * page_size);
+ cur_size_to_export = exported_size;
/* If the size of each page is larger than the dma max segment size,
* then we can't combine pages and the number of entries in the SGL
@@ -1728,7 +1727,7 @@ static struct sg_table *hl_map_dmabuf(struct dma_buf_attachment *attachment,
&hl_dmabuf->device_address,
1,
hl_dmabuf->dmabuf->size,
- 0,
+ hl_dmabuf->dmabuf->size,
attachment->dev,
dir);