habanalabs: add virtual memory and MMU modules
authorOmer Shpigelman <oshpigelman@habana.ai>
Fri, 15 Feb 2019 22:39:22 +0000 (00:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Feb 2019 08:46:46 +0000 (09:46 +0100)
commit0feaf86d4e69507ab9b2af7dcc63a6886352d5db
tree9340f1c492c53b9c92dc0753f9b9c15402fa406f
parenteff6f4a0e70b7bcf4674f471a768860a74e638a6
habanalabs: add virtual memory and MMU modules

This patch adds the Virtual Memory and MMU modules.

Goya has an internal MMU which provides process isolation on the internal
DDR. The internal MMU also performs translations for transactions that go
from Goya to the Host.

The driver is responsible for allocating and freeing memory on the DDR
upon user request. It also provides an interface to map and unmap DDR and
Host memory to the device address space.

The MMU in Goya supports 3-level and 4-level page tables. With 3-level, the
size of each page is 2MB, while with 4-level the size of each page is 4KB.

In the DDR, the physical pages are always 2MB.

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 files changed:
drivers/misc/habanalabs/Makefile
drivers/misc/habanalabs/context.c
drivers/misc/habanalabs/device.c
drivers/misc/habanalabs/goya/goya.c
drivers/misc/habanalabs/habanalabs.h
drivers/misc/habanalabs/habanalabs_drv.c
drivers/misc/habanalabs/habanalabs_ioctl.c
drivers/misc/habanalabs/include/hw_ip/mmu/mmu_general.h [new file with mode: 0644]
drivers/misc/habanalabs/include/hw_ip/mmu/mmu_v1_0.h [new file with mode: 0644]
drivers/misc/habanalabs/memory.c
drivers/misc/habanalabs/mmu.c [new file with mode: 0644]
include/uapi/misc/habanalabs.h