diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-11-06 08:44:23 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-27 12:23:11 -0500 |
commit | c6b9177cfff8a41c3c3c78f5c47c7df677ced58c (patch) | |
tree | b402ccda611d85ec88f8557cb26d949617d92466 /drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c | |
parent | a0cea295e7b7f917c6b52221ab34c3a6111fb224 (diff) |
gpu: nvgpu: define error_notifiers in common code
All the linux specific error_notifier codes are defined in linux specific
header file <uapi/linux/nvgpu.h> 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 <nvgpu/error_notifier.h> wherever new error_notifier codes are used
NVGPU-426
Change-Id: Iaa5bfc150e6e9ec17d797d445c2d6407afe9f4bd
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1593361
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c | 34 |
1 files changed, 16 insertions, 18 deletions
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 @@ | |||
25 | #include <nvgpu/atomic.h> | 25 | #include <nvgpu/atomic.h> |
26 | #include <nvgpu/bug.h> | 26 | #include <nvgpu/bug.h> |
27 | #include <nvgpu/barrier.h> | 27 | #include <nvgpu/barrier.h> |
28 | #include <nvgpu/error_notifier.h> | ||
28 | 29 | ||
29 | #include "vgpu.h" | 30 | #include "vgpu.h" |
30 | #include "fifo_vgpu.h" | 31 | #include "fifo_vgpu.h" |
31 | 32 | ||
33 | #include "common/linux/channel.h" | ||
34 | |||
32 | #include <nvgpu/hw/gk20a/hw_fifo_gk20a.h> | 35 | #include <nvgpu/hw/gk20a/hw_fifo_gk20a.h> |
33 | #include <nvgpu/hw/gk20a/hw_ram_gk20a.h> | 36 | #include <nvgpu/hw/gk20a/hw_ram_gk20a.h> |
34 | 37 | ||
@@ -691,7 +694,7 @@ int vgpu_fifo_force_reset_ch(struct channel_gk20a *ch, | |||
691 | 694 | ||
692 | list_for_each_entry(ch_tsg, &tsg->ch_list, ch_entry) { | 695 | list_for_each_entry(ch_tsg, &tsg->ch_list, ch_entry) { |
693 | if (gk20a_channel_get(ch_tsg)) { | 696 | if (gk20a_channel_get(ch_tsg)) { |
694 | gk20a_set_error_notifier(ch_tsg, err_code); | 697 | nvgpu_set_error_notifier(ch_tsg, err_code); |
695 | ch_tsg->has_timedout = true; | 698 | ch_tsg->has_timedout = true; |
696 | gk20a_channel_put(ch_tsg); | 699 | gk20a_channel_put(ch_tsg); |
697 | } | 700 | } |
@@ -699,7 +702,7 @@ int vgpu_fifo_force_reset_ch(struct channel_gk20a *ch, | |||
699 | 702 | ||
700 | nvgpu_rwsem_up_read(&tsg->ch_list_lock); | 703 | nvgpu_rwsem_up_read(&tsg->ch_list_lock); |
701 | } else { | 704 | } else { |
702 | gk20a_set_error_notifier(ch, err_code); | 705 | nvgpu_set_error_notifier(ch, err_code); |
703 | ch->has_timedout = true; | 706 | ch->has_timedout = true; |
704 | } | 707 | } |
705 | 708 | ||
@@ -716,19 +719,14 @@ int vgpu_fifo_force_reset_ch(struct channel_gk20a *ch, | |||
716 | static void vgpu_fifo_set_ctx_mmu_error_ch(struct gk20a *g, | 719 | static void vgpu_fifo_set_ctx_mmu_error_ch(struct gk20a *g, |
717 | struct channel_gk20a *ch) | 720 | struct channel_gk20a *ch) |
718 | { | 721 | { |
719 | nvgpu_mutex_acquire(&ch->error_notifier_mutex); | 722 | /* |
720 | if (ch->error_notifier_ref) { | 723 | * If error code is already set, this mmu fault |
721 | if (ch->error_notifier->status == 0xffff) { | 724 | * was triggered as part of recovery from other |
722 | /* If error code is already set, this mmu fault | 725 | * error condition. |
723 | * was triggered as part of recovery from other | 726 | * Don't overwrite error flag. |
724 | * error condition. | 727 | */ |
725 | * Don't overwrite error flag. */ | 728 | nvgpu_set_error_notifier_if_empty(ch, |
726 | } else { | 729 | NVGPU_ERR_NOTIFIER_FIFO_ERROR_MMU_ERR_FLT); |
727 | gk20a_set_error_notifier_locked(ch, | ||
728 | NVGPU_CHANNEL_FIFO_ERROR_MMU_ERR_FLT); | ||
729 | } | ||
730 | } | ||
731 | nvgpu_mutex_release(&ch->error_notifier_mutex); | ||
732 | 730 | ||
733 | /* mark channel as faulted */ | 731 | /* mark channel as faulted */ |
734 | ch->has_timedout = true; | 732 | ch->has_timedout = true; |
@@ -778,11 +776,11 @@ int vgpu_fifo_isr(struct gk20a *g, struct tegra_vgpu_fifo_intr_info *info) | |||
778 | 776 | ||
779 | switch (info->type) { | 777 | switch (info->type) { |
780 | case TEGRA_VGPU_FIFO_INTR_PBDMA: | 778 | case TEGRA_VGPU_FIFO_INTR_PBDMA: |
781 | gk20a_set_error_notifier(ch, NVGPU_CHANNEL_PBDMA_ERROR); | 779 | nvgpu_set_error_notifier(ch, NVGPU_ERR_NOTIFIER_PBDMA_ERROR); |
782 | break; | 780 | break; |
783 | case TEGRA_VGPU_FIFO_INTR_CTXSW_TIMEOUT: | 781 | case TEGRA_VGPU_FIFO_INTR_CTXSW_TIMEOUT: |
784 | gk20a_set_error_notifier(ch, | 782 | nvgpu_set_error_notifier(ch, |
785 | NVGPU_CHANNEL_FIFO_ERROR_IDLE_TIMEOUT); | 783 | NVGPU_ERR_NOTIFIER_FIFO_ERROR_IDLE_TIMEOUT); |
786 | break; | 784 | break; |
787 | case TEGRA_VGPU_FIFO_INTR_MMU_FAULT: | 785 | case TEGRA_VGPU_FIFO_INTR_MMU_FAULT: |
788 | vgpu_fifo_set_ctx_mmu_error_ch_tsg(g, ch); | 786 | vgpu_fifo_set_ctx_mmu_error_ch_tsg(g, ch); |