gpu: nvgpu: Consume L3 map flag even if L3 not supported

This patch fixes a bug where GPU mappings with the L3 hint
would fail. The failure happens because the L3 map flag does
not get consumed if L3 allocations are disabled. The fix
is to consume the flag.

Bug 3717951
Bug 3486025

Change-Id: Ib10ee58cc060318c810f86013de7311f73c25729
Signed-off-by: Martin Radev <mradev@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2750419
(cherry picked from commit cb768ff133)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2750903
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Martin Radev
2022-07-25 13:00:55 +03:00
committed by mobile promotions
parent e4b3499850
commit eb5d644536

View File

@@ -66,10 +66,11 @@ static int nvgpu_vm_translate_linux_flags(struct gk20a *g, u32 flags, u32 *out_c
core_flags |= NVGPU_VM_MAP_UNMAPPED_PTE;
consumed_flags |= NVGPU_AS_MAP_BUFFER_FLAGS_UNMAPPED_PTE;
}
if ((flags & NVGPU_AS_MAP_BUFFER_FLAGS_L3_ALLOC) != 0U &&
!nvgpu_is_enabled(g, NVGPU_DISABLE_L3_SUPPORT)) {
core_flags |= NVGPU_VM_MAP_L3_ALLOC;
if ((flags & NVGPU_AS_MAP_BUFFER_FLAGS_L3_ALLOC) != 0U) {
/* Consume the flag even if the core flag cannot be set */
consumed_flags |= NVGPU_AS_MAP_BUFFER_FLAGS_L3_ALLOC;
if (!nvgpu_is_enabled(g, NVGPU_DISABLE_L3_SUPPORT))
core_flags |= NVGPU_VM_MAP_L3_ALLOC;
}
if ((flags & NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL) != 0U) {
core_flags |= NVGPU_VM_MAP_DIRECT_KIND_CTRL;