diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2014-07-30 10:20:22 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:10:46 -0400 |
commit | ae3ba04955966f371447dfa96d05564418882021 (patch) | |
tree | 951444c20934c8e20cfa681ba4e4d1e90f7f30fc /drivers/gpu/nvgpu | |
parent | 478e659ae466d870889bda8ccba008c6bd27399e (diff) |
gpu: nvgpu: verify runnable channel count in TSG
In runlist we first write channel count in TSG entry and then
follow those many channel entries
If no. of channel entries does not match to count then it is
considered as error
To detect this, add a counter while adding channel entries and
give warning if channel count does not match with this counter
bug 1470692
Change-Id: I4bbfd9b696fbfafa25dffb27979373f057a7f35a
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/449228
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 2089482a..73de3607 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |||
@@ -1701,6 +1701,7 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, | |||
1701 | struct channel_gk20a *ch = NULL; | 1701 | struct channel_gk20a *ch = NULL; |
1702 | struct tsg_gk20a *tsg = NULL; | 1702 | struct tsg_gk20a *tsg = NULL; |
1703 | u32 count = 0; | 1703 | u32 count = 0; |
1704 | u32 count_channels_in_tsg; | ||
1704 | runlist = &f->runlist_info[runlist_id]; | 1705 | runlist = &f->runlist_info[runlist_id]; |
1705 | 1706 | ||
1706 | /* valid channel, add/remove it from active list. | 1707 | /* valid channel, add/remove it from active list. |
@@ -1784,6 +1785,7 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, | |||
1784 | count++; | 1785 | count++; |
1785 | 1786 | ||
1786 | /* add runnable channels bound to this TSG */ | 1787 | /* add runnable channels bound to this TSG */ |
1788 | count_channels_in_tsg = 0; | ||
1787 | mutex_lock(&tsg->ch_list_lock); | 1789 | mutex_lock(&tsg->ch_list_lock); |
1788 | list_for_each_entry(ch, &tsg->ch_list, ch_entry) { | 1790 | list_for_each_entry(ch, &tsg->ch_list, ch_entry) { |
1789 | if (!test_bit(ch->hw_chid, | 1791 | if (!test_bit(ch->hw_chid, |
@@ -1796,8 +1798,12 @@ static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, | |||
1796 | runlist_entry[1] = 0; | 1798 | runlist_entry[1] = 0; |
1797 | runlist_entry += 2; | 1799 | runlist_entry += 2; |
1798 | count++; | 1800 | count++; |
1801 | count_channels_in_tsg++; | ||
1799 | } | 1802 | } |
1800 | mutex_unlock(&tsg->ch_list_lock); | 1803 | mutex_unlock(&tsg->ch_list_lock); |
1804 | |||
1805 | WARN_ON(tsg->num_active_channels != | ||
1806 | count_channels_in_tsg); | ||
1801 | } | 1807 | } |
1802 | mutex_unlock(&f->tsg_inuse_mutex); | 1808 | mutex_unlock(&f->tsg_inuse_mutex); |
1803 | } else /* suspend to remove all channels */ | 1809 | } else /* suspend to remove all channels */ |