habanalabs: fix bug when mapping very large memory area
authorOmer Shpigelman <oshpigelman@habana.ai>
Thu, 7 Mar 2019 13:47:19 +0000 (15:47 +0200)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 7 Mar 2019 13:47:19 +0000 (15:47 +0200)
commit4eb1d1253ddd95e985c57fc99e9de6802dd2d867
tree0581e05df1e0e33c9816290f2d56f6708c972df7
parentbfb1ce1259ca201b50aa4ab5ec7e19266ef46896
habanalabs: fix bug when mapping very large memory area

This patch fixes a bug of allocating a too big memory size with kmalloc,
which causes a failure.
In case of mapping a large memory block, an array of the relevant physical
page addresses is allocated. If there are many pages the array might be
too big to allocate with kmalloc, hence changing to kvmalloc.

Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/misc/habanalabs/memory.c