summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vm.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/vm.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vm.c b/drivers/gpu/nvgpu/common/linux/vm.c
index 45058321..b686d616 100644
--- a/drivers/gpu/nvgpu/common/linux/vm.c
+++ b/drivers/gpu/nvgpu/common/linux/vm.c
@@ -24,7 +24,6 @@
24#include <nvgpu/nvgpu_mem.h> 24#include <nvgpu/nvgpu_mem.h>
25#include <nvgpu/page_allocator.h> 25#include <nvgpu/page_allocator.h>
26#include <nvgpu/vidmem.h> 26#include <nvgpu/vidmem.h>
27#include <nvgpu/enabled.h>
28 27
29#include <nvgpu/linux/vidmem.h> 28#include <nvgpu/linux/vidmem.h>
30#include <nvgpu/linux/nvgpu_mem.h> 29#include <nvgpu/linux/nvgpu_mem.h>
@@ -36,33 +35,7 @@
36 35
37#include "vm_priv.h" 36#include "vm_priv.h"
38#include "os_linux.h" 37#include "os_linux.h"
39 38#include "dmabuf.h"
40/*
41 * Temporary location for this code until a dmabuf.c file exists.
42 */
43enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g,
44 struct dma_buf *dmabuf)
45{
46 struct gk20a *buf_owner = nvgpu_vidmem_buf_owner(dmabuf);
47 bool unified_memory = nvgpu_is_enabled(g, NVGPU_MM_UNIFIED_MEMORY);
48
49 if (buf_owner == NULL) {
50 /* Not nvgpu-allocated, assume system memory */
51 return APERTURE_SYSMEM;
52 } else if (WARN_ON(buf_owner == g && unified_memory)) {
53 /* Looks like our video memory, but this gpu doesn't support
54 * it. Warn about a bug and bail out */
55 nvgpu_warn(g,
56 "dmabuf is our vidmem but we don't have local vidmem");
57 return APERTURE_INVALID;
58 } else if (buf_owner != g) {
59 /* Someone else's vidmem */
60 return APERTURE_INVALID;
61 } else {
62 /* Yay, buf_owner == g */
63 return APERTURE_VIDMEM;
64 }
65}
66 39
67static struct nvgpu_mapped_buf *__nvgpu_vm_find_mapped_buf_reverse( 40static struct nvgpu_mapped_buf *__nvgpu_vm_find_mapped_buf_reverse(
68 struct vm_gk20a *vm, struct dma_buf *dmabuf, u32 kind) 41 struct vm_gk20a *vm, struct dma_buf *dmabuf, u32 kind)