habanalabs: fix PCIe access to SRAM via debugfs
authorTomer Tayar <ttayar@habana.ai>
Sun, 23 Oct 2022 22:14:18 +0000 (01:14 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Wed, 23 Nov 2022 14:13:45 +0000 (16:13 +0200)
commitfc69aa8640f8baf9c1246c17ca858bab9aea98b0
tree2ffb2bdc767044076e48229daebbd6bf9699b5e1
parent679e968908a4997d02c2a7df294e97b066f9149f
habanalabs: fix PCIe access to SRAM via debugfs

hl_access_sram_dram_region() uses a region base which is set within the
hl_set_dram_bar() function. However, for SRAM access this function is
not called, and we end up with a wrong value of region base and with a
bad calculated address.
Fix it by initializing the region base value independently of whether
hl_set_dram_bar() is called or not.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/device.c