]> git.baikalelectronics.ru Git - kernel.git/commit
habanalabs: wrong VA size calculation
authorYuri Nudelman <ynudelman@habana.ai>
Thu, 14 Oct 2021 07:33:27 +0000 (10:33 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Sun, 26 Dec 2021 06:59:04 +0000 (08:59 +0200)
commitc5297eadc7d0614ca19b77aa04965c52ea9a5562
tree55f1f4cec63c8007d06874c8912d38badc5ecf50
parent7128b1bd79daa5ec492e3b3cd6afd42d1621072e
habanalabs: wrong VA size calculation

VA blocks are currently stored in an inconsistent way. Sometimes block
end is inclusive, sometimes exclusive. This leads to wrong size
calculations in certain cases, plus could lead to a segmentation fault
in case mapping process fails in the middle and we try to roll it back.
Need to make this consistent - start inclusive till end inclusive.

For example, the regions table may now look like this:
    0x0000 - 0x1fff : allocated
    0x2000 - 0x2fff : free
    0x3000 - 0x3fff : allocated

Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/command_buffer.c
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/common/memory.c