From 87abec1ed9d03cec8e8833477d45537025a41945 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Tue, 14 Jan 2020 16:05:37 -0500 Subject: [PATCH] gpu: nvgpu: pbdma_status in preempt poll gm20b_pbdma_handle_intr is only initializing pbdma_status when either pbdma_intr_0 or pbdma_intr_1 is pending. This could lead to using non-initialized chsw_status in gv11b_fifo_preempt_poll_pbdma, and causing unexpected failures in unit tests. Read pbdma_status before checking for pbdma interrupts, to make sure pbdma_status contains valid data. Jira NVGPU-4887 Change-Id: If1bdb24ae04b58e85e4217c9c0854c01ca65525b Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2279111 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/hal/fifo/preempt_gv11b_fusa.c | 4 ++++ drivers/gpu/nvgpu/include/nvgpu/gops_pbdma.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/hal/fifo/preempt_gv11b_fusa.c b/drivers/gpu/nvgpu/hal/fifo/preempt_gv11b_fusa.c index c50fe11e6..0a8fb5cc5 100644 --- a/drivers/gpu/nvgpu/hal/fifo/preempt_gv11b_fusa.c +++ b/drivers/gpu/nvgpu/hal/fifo/preempt_gv11b_fusa.c @@ -197,6 +197,10 @@ int gv11b_fifo_preempt_poll_pbdma(struct gk20a *g, u32 tsgid, } loop_count++; } + + g->ops.pbdma_status.read_pbdma_status_info(g, + pbdma_id, &pbdma_status); + /* * If the PBDMA has a stalling interrupt and receives a NACK, * the PBDMA won't save out until the STALLING interrupt is diff --git a/drivers/gpu/nvgpu/include/nvgpu/gops_pbdma.h b/drivers/gpu/nvgpu/include/nvgpu/gops_pbdma.h index 6c40f957d..c330404b0 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gops_pbdma.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gops_pbdma.h @@ -35,7 +35,7 @@ struct nvgpu_debug_context; struct gops_pbdma_status { void (*read_pbdma_status_info)(struct gk20a *g, - u32 engine_id, struct nvgpu_pbdma_status_info *status); + u32 pbdma_id, struct nvgpu_pbdma_status_info *status); }; struct gops_pbdma {