diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index c91acbd2..c95e744e 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -2061,19 +2061,26 @@ static u64 gk20a_vm_map_duplicate_locked(struct vm_gk20a *vm, | |||
2061 | struct gk20a *g = gk20a_from_vm(vm); | 2061 | struct gk20a *g = gk20a_from_vm(vm); |
2062 | struct mapped_buffer_node *mapped_buffer = NULL; | 2062 | struct mapped_buffer_node *mapped_buffer = NULL; |
2063 | 2063 | ||
2064 | mapped_buffer = | 2064 | if (flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET) { |
2065 | find_mapped_buffer_reverse_locked(&vm->mapped_buffers, | 2065 | mapped_buffer = find_mapped_buffer_locked(&vm->mapped_buffers, |
2066 | offset_align); | ||
2067 | if (!mapped_buffer) | ||
2068 | return 0; | ||
2069 | |||
2070 | if (mapped_buffer->dmabuf != dmabuf || | ||
2071 | mapped_buffer->kind != (u32)kind) | ||
2072 | return 0; | ||
2073 | } else { | ||
2074 | mapped_buffer = | ||
2075 | find_mapped_buffer_reverse_locked(&vm->mapped_buffers, | ||
2066 | dmabuf, kind); | 2076 | dmabuf, kind); |
2067 | if (!mapped_buffer) | 2077 | if (!mapped_buffer) |
2068 | return 0; | 2078 | return 0; |
2079 | } | ||
2069 | 2080 | ||
2070 | if (mapped_buffer->flags != flags) | 2081 | if (mapped_buffer->flags != flags) |
2071 | return 0; | 2082 | return 0; |
2072 | 2083 | ||
2073 | if (flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET && | ||
2074 | mapped_buffer->addr != offset_align) | ||
2075 | return 0; | ||
2076 | |||
2077 | BUG_ON(mapped_buffer->vm != vm); | 2084 | BUG_ON(mapped_buffer->vm != vm); |
2078 | 2085 | ||
2079 | /* mark the buffer as used */ | 2086 | /* mark the buffer as used */ |