From ba1245d8f74816189af0fc3e0d0d1c642f87cdf2 Mon Sep 17 00:00:00 2001 From: Nicolas Benech Date: Thu, 30 Aug 2018 13:55:37 -0400 Subject: gpu: nvgpu: Add return code to fb.tlb_invalidate As part of MISRA 17.7 fixes for a different GPU, the tlb_invalidate needs to return an error code. Change-Id: I3b8b9f112708c17457855dd1fb151168791bc6bf Signed-off-by: Nicolas Benech Reviewed-on: https://git-master.nvidia.com/r/1810106 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fb/fb_gm20b.c | 7 +++++-- drivers/gpu/nvgpu/common/fb/fb_gm20b.h | 2 +- drivers/gpu/nvgpu/gk20a/gk20a.h | 2 +- drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 3 ++- drivers/gpu/nvgpu/vgpu/mm_vgpu.h | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nvgpu/common/fb/fb_gm20b.c b/drivers/gpu/nvgpu/common/fb/fb_gm20b.c index b4756546..65b7336c 100644 --- a/drivers/gpu/nvgpu/common/fb/fb_gm20b.c +++ b/drivers/gpu/nvgpu/common/fb/fb_gm20b.c @@ -60,11 +60,12 @@ void gm20b_fb_init_hw(struct gk20a *g) gk20a_writel(g, fb_niso_flush_sysmem_addr_r(), addr); } -void gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) +int gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) { struct nvgpu_timeout timeout; u32 addr_lo; u32 data; + int err = 0; nvgpu_log_fn(g, " "); @@ -75,7 +76,7 @@ void gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) power is turned off */ if (!g->power_on) { - return; + return err; } addr_lo = u64_lo32(nvgpu_mem_get_addr(g, pdb) >> 12); @@ -96,6 +97,7 @@ void gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) "wait mmu fifo space")); if (nvgpu_timeout_peek_expired(&timeout)) { + err = -ETIMEDOUT; goto out; } @@ -126,6 +128,7 @@ void gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) out: nvgpu_mutex_release(&g->mm.tlb_lock); + return err; } void fb_gm20b_init_fs_state(struct gk20a *g) diff --git a/drivers/gpu/nvgpu/common/fb/fb_gm20b.h b/drivers/gpu/nvgpu/common/fb/fb_gm20b.h index 95991432..bc240ae3 100644 --- a/drivers/gpu/nvgpu/common/fb/fb_gm20b.h +++ b/drivers/gpu/nvgpu/common/fb/fb_gm20b.h @@ -33,7 +33,7 @@ struct nvgpu_mem; void gm20b_fb_reset(struct gk20a *g); void gm20b_fb_init_hw(struct gk20a *g); -void gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb); +int gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb); void fb_gm20b_init_fs_state(struct gk20a *g); void gm20b_fb_set_mmu_page_size(struct gk20a *g); bool gm20b_fb_set_use_full_comp_tag_line(struct gk20a *g); diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 20f07c6c..2b8e8b0a 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -551,7 +551,7 @@ struct gpu_ops { struct wpr_carveout_info *inf); bool (*is_debug_mode_enabled)(struct gk20a *g); void (*set_debug_mode)(struct gk20a *g, bool enable); - void (*tlb_invalidate)(struct gk20a *g, struct nvgpu_mem *pdb); + int (*tlb_invalidate)(struct gk20a *g, struct nvgpu_mem *pdb); void (*hub_isr)(struct gk20a *g); void (*handle_replayable_fault)(struct gk20a *g); int (*mem_unlock)(struct gk20a *g); diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index 837508bb..ae35cafc 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c @@ -250,11 +250,12 @@ void vgpu_mm_l2_flush(struct gk20a *g, bool invalidate) vgpu_cache_maint(vgpu_get_handle(g), op); } -void vgpu_mm_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) +int vgpu_mm_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) { nvgpu_log_fn(g, " "); nvgpu_err(g, "call to RM server not supported"); + return 0; } void vgpu_mm_mmu_set_debug_mode(struct gk20a *g, bool enable) diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.h b/drivers/gpu/nvgpu/vgpu/mm_vgpu.h index 41bae96d..491700fc 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.h +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.h @@ -43,6 +43,6 @@ int vgpu_vm_bind_channel(struct vm_gk20a *vm, int vgpu_mm_fb_flush(struct gk20a *g); void vgpu_mm_l2_invalidate(struct gk20a *g); void vgpu_mm_l2_flush(struct gk20a *g, bool invalidate); -void vgpu_mm_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb); +int vgpu_mm_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb); void vgpu_mm_mmu_set_debug_mode(struct gk20a *g, bool enable); #endif -- cgit v1.2.2