summaryrefslogtreecommitdiff
path: root/drivers/accel/habanalabs/common/memory.c
diff options
context:
space:
mode:
authorTomer Tayar <ttayar@habana.ai>2023-08-20 14:17:06 +0300
committerOded Gabbay <ogabbay@kernel.org>2023-10-09 12:37:22 +0300
commit878ebc14db049ae85225756b187fec81df8108b3 (patch)
tree0b43afc58ae260494126b9342cd287bdfe74a547 /drivers/accel/habanalabs/common/memory.c
parentbb644f61970ad44147c9466b0cb99a028de02138 (diff)
downloadlinux-878ebc14db049ae85225756b187fec81df8108b3.tar.xz
accel/habanalabs: set hl_dmabuf_priv.device_address only when needed
The device_address member of 'struct hl_dmabuf_priv' is used only when virtual device memory is not supported and dma-buf is exported from address. Set the value of this field only when it is relevant, and add "phys" to its name so it would be clearer that it can't be a device virtual address. 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/habanalabs/common/memory.c')
-rw-r--r--drivers/accel/habanalabs/common/memory.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/accel/habanalabs/common/memory.c b/drivers/accel/habanalabs/common/memory.c
index f42cb04b578b..fe896edc18ac 100644
--- a/drivers/accel/habanalabs/common/memory.c
+++ b/drivers/accel/habanalabs/common/memory.c
@@ -1731,7 +1731,7 @@ static struct sg_table *hl_map_dmabuf(struct dma_buf_attachment *attachment,
npages = phys_pg_pack->npages;
page_size = phys_pg_pack->page_size;
} else {
- pages = &hl_dmabuf->device_address;
+ pages = &hl_dmabuf->device_phys_addr;
npages = 1;
page_size = hl_dmabuf->dmabuf->size;
}
@@ -2064,9 +2064,9 @@ static int export_dmabuf_from_addr(struct hl_ctx *ctx, u64 addr, u64 size, u64 o
rc = validate_export_params_no_mmu(hdev, export_addr, size);
if (rc)
goto err_free_dmabuf_wrapper;
- }
- hl_dmabuf->device_address = export_addr;
+ hl_dmabuf->device_phys_addr = export_addr;
+ }
rc = export_dmabuf(ctx, hl_dmabuf, size, flags, dmabuf_fd);
if (rc)