diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 452d3e9c..31fad8ae 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -1990,18 +1990,24 @@ int gk20a_vm_map_compbits(struct vm_gk20a *vm, | |||
1990 | return 0; | 1990 | return 0; |
1991 | } | 1991 | } |
1992 | 1992 | ||
1993 | u64 gk20a_gmmu_map(struct vm_gk20a *vm, | 1993 | /* |
1994 | struct sg_table **sgt, | 1994 | * Core GMMU map function for the kernel to use. If @addr is 0 then the GPU |
1995 | u64 size, | 1995 | * VA will be allocated for you. If addr is non-zero then the buffer will be |
1996 | u32 flags, | 1996 | * mapped at @addr. |
1997 | int rw_flag, | 1997 | */ |
1998 | bool priv) | 1998 | static u64 __gk20a_gmmu_map(struct vm_gk20a *vm, |
1999 | struct sg_table **sgt, | ||
2000 | u64 addr, | ||
2001 | u64 size, | ||
2002 | u32 flags, | ||
2003 | int rw_flag, | ||
2004 | bool priv) | ||
1999 | { | 2005 | { |
2000 | struct gk20a *g = gk20a_from_vm(vm); | 2006 | struct gk20a *g = gk20a_from_vm(vm); |
2001 | u64 vaddr; | 2007 | u64 vaddr; |
2002 | 2008 | ||
2003 | mutex_lock(&vm->update_gmmu_lock); | 2009 | mutex_lock(&vm->update_gmmu_lock); |
2004 | vaddr = g->ops.mm.gmmu_map(vm, 0, /* already mapped? - No */ | 2010 | vaddr = g->ops.mm.gmmu_map(vm, addr, |
2005 | *sgt, /* sg table */ | 2011 | *sgt, /* sg table */ |
2006 | 0, /* sg offset */ | 2012 | 0, /* sg offset */ |
2007 | size, | 2013 | size, |
@@ -2022,6 +2028,30 @@ u64 gk20a_gmmu_map(struct vm_gk20a *vm, | |||
2022 | return vaddr; | 2028 | return vaddr; |
2023 | } | 2029 | } |
2024 | 2030 | ||
2031 | u64 gk20a_gmmu_map(struct vm_gk20a *vm, | ||
2032 | struct sg_table **sgt, | ||
2033 | u64 size, | ||
2034 | u32 flags, | ||
2035 | int rw_flag, | ||
2036 | bool priv) | ||
2037 | { | ||
2038 | return __gk20a_gmmu_map(vm, sgt, 0, size, flags, rw_flag, priv); | ||
2039 | } | ||
2040 | |||
2041 | /* | ||
2042 | * Like gk20a_gmmu_map() except it works on a fixed address instead. | ||
2043 | */ | ||
2044 | u64 gk20a_gmmu_fixed_map(struct vm_gk20a *vm, | ||
2045 | struct sg_table **sgt, | ||
2046 | u64 addr, | ||
2047 | u64 size, | ||
2048 | u32 flags, | ||
2049 | int rw_flag, | ||
2050 | bool priv) | ||
2051 | { | ||
2052 | return __gk20a_gmmu_map(vm, sgt, addr, size, flags, rw_flag, priv); | ||
2053 | } | ||
2054 | |||
2025 | int gk20a_gmmu_alloc(struct gk20a *g, size_t size, struct mem_desc *mem) | 2055 | int gk20a_gmmu_alloc(struct gk20a *g, size_t size, struct mem_desc *mem) |
2026 | { | 2056 | { |
2027 | return gk20a_gmmu_alloc_attr(g, 0, size, mem); | 2057 | return gk20a_gmmu_alloc_attr(g, 0, size, mem); |