summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-01-11 19:58:14 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-03 13:34:43 -0500
commit3966efc2e58f1802411f44fd00967dde448f278d (patch)
treeb6cf822abc638b79acbd12b749a97ab5507a6fe9 /drivers/gpu/nvgpu/gk20a/channel_gk20a.c
parent76b78b6fdcb0bbed72645aaa85de6013e2b135c3 (diff)
gpu: nvgpu: Give nvgpu_kalloc a less generic name
Change nvgpu_kalloc() to nvgpu_big_[mz]alloc(). This is necessary since the natural free function name for this is nvgpu_kfree() but that conflicts with nvgpu_k[mz]alloc() (implemented in a subsequent patch). This API exists becasue not all allocation sizes can be determined at compile time and in some cases sizes may vary across the system page size. Thus always using kmalloc() could lead to OOM errors due to fragmentation. But always using vmalloc() is wastful of memory for small allocations. This API tries to alleviate those problems. Bug 1799159 Bug 1823380 Change-Id: I49ec5292ce13bcdecf112afbb4a0cfffeeb5ecfc Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1283827 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 6eb1cb06..f228110e 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -30,6 +30,8 @@
30#include <linux/circ_buf.h> 30#include <linux/circ_buf.h>
31 31
32#include <nvgpu/semaphore.h> 32#include <nvgpu/semaphore.h>
33#include <nvgpu/timers.h>
34#include <nvgpu/kmem.h>
33 35
34#include "gk20a.h" 36#include "gk20a.h"
35#include "debug_gk20a.h" 37#include "debug_gk20a.h"
@@ -37,8 +39,6 @@
37#include "dbg_gpu_gk20a.h" 39#include "dbg_gpu_gk20a.h"
38#include "fence_gk20a.h" 40#include "fence_gk20a.h"
39 41
40#include <nvgpu/timers.h>
41
42#include <nvgpu/hw/gk20a/hw_ram_gk20a.h> 42#include <nvgpu/hw/gk20a/hw_ram_gk20a.h>
43#include <nvgpu/hw/gk20a/hw_fifo_gk20a.h> 43#include <nvgpu/hw/gk20a/hw_fifo_gk20a.h>
44#include <nvgpu/hw/gk20a/hw_pbdma_gk20a.h> 44#include <nvgpu/hw/gk20a/hw_pbdma_gk20a.h>
@@ -986,7 +986,7 @@ static void gk20a_free_channel(struct channel_gk20a *ch, bool force)
986 memset(&ch->ramfc, 0, sizeof(struct mem_desc_sub)); 986 memset(&ch->ramfc, 0, sizeof(struct mem_desc_sub));
987 987
988 gk20a_gmmu_unmap_free(ch_vm, &ch->gpfifo.mem); 988 gk20a_gmmu_unmap_free(ch_vm, &ch->gpfifo.mem);
989 nvgpu_kfree(ch->gpfifo.pipe); 989 nvgpu_big_free(ch->gpfifo.pipe);
990 memset(&ch->gpfifo, 0, sizeof(struct gpfifo_desc)); 990 memset(&ch->gpfifo, 0, sizeof(struct gpfifo_desc));
991 991
992#if defined(CONFIG_GK20A_CYCLE_STATS) 992#if defined(CONFIG_GK20A_CYCLE_STATS)
@@ -1856,9 +1856,8 @@ int gk20a_alloc_channel_gpfifo(struct channel_gk20a *c,
1856 } 1856 }
1857 1857
1858 if (c->gpfifo.mem.aperture == APERTURE_VIDMEM || g->mm.force_pramin) { 1858 if (c->gpfifo.mem.aperture == APERTURE_VIDMEM || g->mm.force_pramin) {
1859 c->gpfifo.pipe = nvgpu_kalloc( 1859 c->gpfifo.pipe = nvgpu_big_malloc(
1860 gpfifo_size * sizeof(struct nvgpu_gpfifo), 1860 gpfifo_size * sizeof(struct nvgpu_gpfifo));
1861 false);
1862 if (!c->gpfifo.pipe) { 1861 if (!c->gpfifo.pipe) {
1863 err = -ENOMEM; 1862 err = -ENOMEM;
1864 goto clean_up_unmap; 1863 goto clean_up_unmap;
@@ -1928,7 +1927,7 @@ clean_up_sync:
1928 c->sync = NULL; 1927 c->sync = NULL;
1929 } 1928 }
1930clean_up_unmap: 1929clean_up_unmap:
1931 nvgpu_kfree(c->gpfifo.pipe); 1930 nvgpu_big_free(c->gpfifo.pipe);
1932 gk20a_gmmu_unmap_free(ch_vm, &c->gpfifo.mem); 1931 gk20a_gmmu_unmap_free(ch_vm, &c->gpfifo.mem);
1933clean_up: 1932clean_up:
1934 memset(&c->gpfifo, 0, sizeof(struct gpfifo_desc)); 1933 memset(&c->gpfifo, 0, sizeof(struct gpfifo_desc));
@@ -2058,12 +2057,12 @@ static void trace_write_pushbuffer_range(struct channel_gk20a *c,
2058 if (!g) { 2057 if (!g) {
2059 size = count * sizeof(struct nvgpu_gpfifo); 2058 size = count * sizeof(struct nvgpu_gpfifo);
2060 if (size) { 2059 if (size) {
2061 g = nvgpu_kalloc(size, false); 2060 g = nvgpu_big_malloc(size);
2062 if (!g) 2061 if (!g)
2063 return; 2062 return;
2064 2063
2065 if (copy_from_user(g, user_gpfifo, size)) { 2064 if (copy_from_user(g, user_gpfifo, size)) {
2066 nvgpu_kfree(g); 2065 nvgpu_big_free(g);
2067 return; 2066 return;
2068 } 2067 }
2069 } 2068 }
@@ -2075,7 +2074,7 @@ static void trace_write_pushbuffer_range(struct channel_gk20a *c,
2075 trace_write_pushbuffer(c, gp); 2074 trace_write_pushbuffer(c, gp);
2076 2075
2077 if (gpfifo_allocated) 2076 if (gpfifo_allocated)
2078 nvgpu_kfree(g); 2077 nvgpu_big_free(g);
2079} 2078}
2080 2079
2081static void __gk20a_channel_timeout_start(struct channel_gk20a *ch) 2080static void __gk20a_channel_timeout_start(struct channel_gk20a *ch)