diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index bf4a8f579..4005d5f48 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); }