gpu: nvgpu: add linux REMAP support

Add REMAP ioctl and accompanying support to the linux nvgpu driver.

REMAP support provides per-page control over sparse VM areas using the
concept of a virtual memory pool.

The REMAP ioctl accepts a list of operations (each a map or unmap) that
modify the VM area pages tracked by the virtual mmemory pool.

Inclusion of REMAP support in the nvgpu build is controlled by the new
CONFIG_NVGPU_REMAP flag.  This flag is enabled by default for linux builds.
A new NVGPU_GPU_FLAGS_SUPPORT_REMAP characteristics flag is added for use
in detecting when REMAP support is available.

When a VM allocation tagged with NVGPU_VM_AREA_ALLOC_SPARSE is made the
base virtual memory pool resources are allocated.  Per-page resources are
later allocated when the NVGPU_AS_IOCTL_REMAP ioctl is issued.  All REMAP
resources are released when the corresponding VM area is freed.

Jira NVGPU-6804

Change-Id: I1f2cdc0c06c1698a62640c1c6fbcb2f9db24a0bc
Signed-off-by: scottl <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2542178
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
scottl
2021-06-08 23:59:08 -07:00
committed by mobile promotions
parent cecb0666f6
commit 3cd256b344
20 changed files with 1761 additions and 12 deletions

View File

@@ -675,6 +675,12 @@ mm:
include/nvgpu/vm_area.h ]
deps: [ ]
tags: unit-testable
vm_remap:
safe: no
sources: [ common/mm/vm_remap.c,
include/nvgpu/vm_remap.h ]
deps: [ ]
tags: unit-testable
vm:
safe: yes
sources: [ common/mm/vm.c,

View File

@@ -228,7 +228,8 @@ vgpu:
os/linux/vgpu/vgpu_linux.h ]
vm:
sources: [ os/linux/vm.c ]
sources: [ os/linux/vm.c,
os/linux/vm_remap.c ]
cic:
sources: [ os/linux/cic/cic_stub.c ]
@@ -252,7 +253,8 @@ headers:
include/nvgpu/linux/thread.h,
include/nvgpu/linux/log.h,
include/nvgpu/linux/utils.h,
include/nvgpu/linux/vm.h ]
include/nvgpu/linux/vm.h,
include/nvgpu/linux/vm_remap.h ]
# An extra unit to lump all the unclassified Linux files.
extra:

View File

@@ -22,6 +22,7 @@ all:
os/posix/posix-nvgpu_mem.c,
os/posix/posix-tsg.c,
os/posix/posix-vm.c,
os/posix/posix-vm_remap.c,
os/posix/soc.c,
os/posix/bsearch.c,
os/posix/posix-clk_arb.c,
@@ -51,6 +52,7 @@ headers:
include/nvgpu/posix/probe.h,
include/nvgpu/posix/soc_fuse.h,
include/nvgpu/posix/vm.h,
include/nvgpu/posix/posix-vm_remap.h,
include/nvgpu/posix/posix_vidmem.h,
include/nvgpu/posix/posix-nvhost.h,
include/nvgpu/posix/trace_gk20a.h ]