summaryrefslogtreecommitdiffstats
path: root/drivers/misc/habanalabs/common/habanalabs_ioctl.c
diff options
context:
space:
mode:
authorAlon Mizrahi <amizrahi@habana.ai>2020-12-23 16:53:17 +0100
committerOded Gabbay <ogabbay@kernel.org>2021-01-27 20:03:49 +0100
commit9402a3362462d080b998e00ed33fc193c12adbbf (patch)
tree4a7902df2f6ef5e6a3850fbd050a177f12c266ea /drivers/misc/habanalabs/common/habanalabs_ioctl.c
parenthabanalabs: update to latest hl_boot_if.h (diff)
downloadlinux-9402a3362462d080b998e00ed33fc193c12adbbf.tar.xz
linux-9402a3362462d080b998e00ed33fc193c12adbbf.zip
habanalabs: return dram virtual address in info ioctl
When working with DRAM MMU, we should supply the userspace with the virtual start address of the DRAM instead of the physical one. This is because the physical one has no meaning for the user as he only knows the virtual address range. Signed-off-by: Alon Mizrahi <amizrahi@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/habanalabs/common/habanalabs_ioctl.c')
-rw-r--r--drivers/misc/habanalabs/common/habanalabs_ioctl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/misc/habanalabs/common/habanalabs_ioctl.c b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
index 394a2e1767ce..018320e0331b 100644
--- a/drivers/misc/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
@@ -57,7 +57,9 @@ static int hw_ip_info(struct hl_device *hdev, struct hl_info_args *args)
hw_ip.device_id = hdev->asic_funcs->get_pci_id(hdev);
hw_ip.sram_base_address = prop->sram_user_base_address;
- hw_ip.dram_base_address = prop->dram_user_base_address;
+ hw_ip.dram_base_address =
+ hdev->mmu_enable && prop->dram_supports_virtual_memory ?
+ prop->dmmu.start_addr : prop->dram_user_base_address;
hw_ip.tpc_enabled_mask = prop->tpc_enabled_mask;
hw_ip.sram_size = prop->sram_size - sram_kmd_size;
hw_ip.dram_size = prop->dram_size - dram_kmd_size;