habanalabs: fix dma_addr passed to dma_mmap_coherent
authorOded Gabbay <ogabbay@kernel.org>
Mon, 11 Jan 2021 11:49:38 +0000 (13:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Feb 2021 14:37:14 +0000 (15:37 +0100)
commit2f2a4c04b8893de70f9d6ccc3fe9e2ccad9eb209
tree11d82fc742198b045b9b331a3c32ab1b699ead7e
parenta55c4bf2c8f0363a55c307ecc181466a7916c3ba
habanalabs: fix dma_addr passed to dma_mmap_coherent

[ Upstream commit a9d4ef643430d638de1910377f50e0d492d85a43 ]

When doing dma_alloc_coherent in the driver, we add a certain hard-coded
offset to the DMA address before returning to the callee function. This
offset is needed when our device use this DMA address to perform
outbound transactions to the host.

However, if we want to map the DMA'able memory to the user via
dma_mmap_coherent(), we need to pass the original dma address, without
this offset. Otherwise, we will get erronouos mapping.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/goya/goya.c