From 1a63ca3a657fb65dfb8390aa7440f34d0b3d743b Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 6 Sep 2016 11:18:51 +0300 Subject: gpu: nvgpu: fall back to sysmem for generic allocs In gk20a_gmmu_alloc_attr(), which is used for in-kernel allocations, fall back to attempting to allocate sysmem when vidmem allocation fails. Bug 1809939 Change-Id: I0397026fd1b3bc803f6d8bb7409e05ab31ec961d Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1215447 (cherry picked from commit 3ec37992b830cee917e8ad35ede50e048907014a) Reviewed-on: http://git-master/r/1217687 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index bf4a8f57..4005d5f4 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -2793,8 +2793,16 @@ int gk20a_gmmu_alloc(struct gk20a *g, size_t size, struct mem_desc *mem) int gk20a_gmmu_alloc_attr(struct gk20a *g, enum dma_attr attr, size_t size, struct mem_desc *mem) { - if (g->mm.vidmem_is_vidmem) - return gk20a_gmmu_alloc_attr_vid(g, attr, size, mem); + if (g->mm.vidmem_is_vidmem) { + int err = gk20a_gmmu_alloc_attr_vid(g, attr, size, mem); + + if (!err) + return 0; + /* + * Fall back to sysmem (which may then also fail) in case + * vidmem is exhausted. + */ + } return gk20a_gmmu_alloc_attr_sys(g, attr, size, mem); } -- cgit v1.2.2