From c6b9177cfff8a41c3c3c78f5c47c7df677ced58c Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 6 Nov 2017 05:44:23 -0800 Subject: gpu: nvgpu: define error_notifiers in common code All the linux specific error_notifier codes are defined in linux specific header file and used in all the common driver But since they are defined in linux specific file, we need to move all the uses of those error_notifiers in linux specific code only Hence define new error_notifiers in include/nvgpu/error_notifier.h and use them in the common code Add new API nvgpu_error_notifier_to_channel_notifier() to convert common error_notifier of the form NVGPU_ERR_NOTIFIER_* to linux specific error notifier of the form NVGPU_CHANNEL_* Any future additions to error notifiers requires update to both the form of error notifiers Move all error notifier related metadata from channel_gk20a (common code) to linux specific structure nvgpu_channel_linux Update all accesses to this data from new structure instead of channel_gk20a Move and rename below APIs to linux specific file and declare them in error_notifier.h nvgpu_set_error_notifier_locked() nvgpu_set_error_notifier() nvgpu_is_error_notifier_set() Add below new API and use it in fifo_vgpu.c nvgpu_set_error_notifier_if_empty() Include wherever new error_notifier codes are used NVGPU-426 Change-Id: Iaa5bfc150e6e9ec17d797d445c2d6407afe9f4bd Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/1593361 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c') diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c index cdcecca5..7a2a02e9 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c @@ -25,10 +25,13 @@ #include #include #include +#include #include "vgpu.h" #include "fifo_vgpu.h" +#include "common/linux/channel.h" + #include #include @@ -691,7 +694,7 @@ int vgpu_fifo_force_reset_ch(struct channel_gk20a *ch, list_for_each_entry(ch_tsg, &tsg->ch_list, ch_entry) { if (gk20a_channel_get(ch_tsg)) { - gk20a_set_error_notifier(ch_tsg, err_code); + nvgpu_set_error_notifier(ch_tsg, err_code); ch_tsg->has_timedout = true; gk20a_channel_put(ch_tsg); } @@ -699,7 +702,7 @@ int vgpu_fifo_force_reset_ch(struct channel_gk20a *ch, nvgpu_rwsem_up_read(&tsg->ch_list_lock); } else { - gk20a_set_error_notifier(ch, err_code); + nvgpu_set_error_notifier(ch, err_code); ch->has_timedout = true; } @@ -716,19 +719,14 @@ int vgpu_fifo_force_reset_ch(struct channel_gk20a *ch, static void vgpu_fifo_set_ctx_mmu_error_ch(struct gk20a *g, struct channel_gk20a *ch) { - nvgpu_mutex_acquire(&ch->error_notifier_mutex); - if (ch->error_notifier_ref) { - if (ch->error_notifier->status == 0xffff) { - /* If error code is already set, this mmu fault - * was triggered as part of recovery from other - * error condition. - * Don't overwrite error flag. */ - } else { - gk20a_set_error_notifier_locked(ch, - NVGPU_CHANNEL_FIFO_ERROR_MMU_ERR_FLT); - } - } - nvgpu_mutex_release(&ch->error_notifier_mutex); + /* + * If error code is already set, this mmu fault + * was triggered as part of recovery from other + * error condition. + * Don't overwrite error flag. + */ + nvgpu_set_error_notifier_if_empty(ch, + NVGPU_ERR_NOTIFIER_FIFO_ERROR_MMU_ERR_FLT); /* mark channel as faulted */ ch->has_timedout = true; @@ -778,11 +776,11 @@ int vgpu_fifo_isr(struct gk20a *g, struct tegra_vgpu_fifo_intr_info *info) switch (info->type) { case TEGRA_VGPU_FIFO_INTR_PBDMA: - gk20a_set_error_notifier(ch, NVGPU_CHANNEL_PBDMA_ERROR); + nvgpu_set_error_notifier(ch, NVGPU_ERR_NOTIFIER_PBDMA_ERROR); break; case TEGRA_VGPU_FIFO_INTR_CTXSW_TIMEOUT: - gk20a_set_error_notifier(ch, - NVGPU_CHANNEL_FIFO_ERROR_IDLE_TIMEOUT); + nvgpu_set_error_notifier(ch, + NVGPU_ERR_NOTIFIER_FIFO_ERROR_IDLE_TIMEOUT); break; case TEGRA_VGPU_FIFO_INTR_MMU_FAULT: vgpu_fifo_set_ctx_mmu_error_ch_tsg(g, ch); -- cgit v1.2.2