summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/ioctl_dbg.c')
-rw-r--r--drivers/gpu/nvgpu/os/linux/ioctl_dbg.c50
1 files changed, 9 insertions, 41 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c b/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c
index 953b7168..fa33b6e0 100644
--- a/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c
+++ b/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c
@@ -154,10 +154,6 @@ static int dbg_unbind_all_channels_gk20a(struct dbg_session_gk20a *dbg_s);
154static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, 154static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
155 struct file *filp, bool is_profiler); 155 struct file *filp, bool is_profiler);
156 156
157static int nvgpu_set_sm_exception_type_mask_locked(
158 struct dbg_session_gk20a *dbg_s,
159 u32 exception_mask);
160
161unsigned int gk20a_dbg_gpu_dev_poll(struct file *filep, poll_table *wait) 157unsigned int gk20a_dbg_gpu_dev_poll(struct file *filep, poll_table *wait)
162{ 158{
163 unsigned int mask = 0; 159 unsigned int mask = 0;
@@ -1808,44 +1804,13 @@ out:
1808 return err; 1804 return err;
1809} 1805}
1810 1806
1811static int nvgpu_set_sm_exception_type_mask_locked( 1807static int nvgpu_dbg_gpu_set_sm_exception_type_mask(struct dbg_session_gk20a *dbg_s,
1812 struct dbg_session_gk20a *dbg_s,
1813 u32 exception_mask)
1814{
1815 struct gk20a *g = dbg_s->g;
1816 int err = 0;
1817 struct channel_gk20a *ch = NULL;
1818
1819 /*
1820 * Obtain the fisrt channel from the channel list in
1821 * dbg_session, find the context associated with channel
1822 * and set the sm_mask_type to that context
1823 */
1824 ch = nvgpu_dbg_gpu_get_session_channel(dbg_s);
1825 if (ch != NULL) {
1826 struct tsg_gk20a *tsg;
1827
1828 tsg = tsg_gk20a_from_ch(ch);
1829 if (tsg != NULL) {
1830 tsg->sm_exception_mask_type = exception_mask;
1831 goto type_mask_end;
1832 }
1833 }
1834
1835 nvgpu_log_fn(g, "unable to find the TSG\n");
1836 err = -EINVAL;
1837
1838type_mask_end:
1839 return err;
1840}
1841
1842static int nvgpu_dbg_gpu_set_sm_exception_type_mask(
1843 struct dbg_session_gk20a *dbg_s,
1844 struct nvgpu_dbg_gpu_set_sm_exception_type_mask_args *args) 1808 struct nvgpu_dbg_gpu_set_sm_exception_type_mask_args *args)
1845{ 1809{
1846 int err = 0; 1810 int err = 0;
1847 struct gk20a *g = dbg_s->g; 1811 struct gk20a *g = dbg_s->g;
1848 u32 sm_exception_mask_type = NVGPU_SM_EXCEPTION_TYPE_MASK_NONE; 1812 u32 sm_exception_mask_type = NVGPU_SM_EXCEPTION_TYPE_MASK_NONE;
1813 struct channel_gk20a *ch = NULL;
1849 1814
1850 switch (args->exception_type_mask) { 1815 switch (args->exception_type_mask) {
1851 case NVGPU_DBG_GPU_IOCTL_SET_SM_EXCEPTION_TYPE_MASK_FATAL: 1816 case NVGPU_DBG_GPU_IOCTL_SET_SM_EXCEPTION_TYPE_MASK_FATAL:
@@ -1866,10 +1831,13 @@ static int nvgpu_dbg_gpu_set_sm_exception_type_mask(
1866 return err; 1831 return err;
1867 } 1832 }
1868 1833
1869 nvgpu_mutex_acquire(&g->dbg_sessions_lock); 1834 ch = nvgpu_dbg_gpu_get_session_channel(dbg_s);
1870 err = nvgpu_set_sm_exception_type_mask_locked(dbg_s, 1835 if (ch != NULL) {
1871 sm_exception_mask_type); 1836 err = g->ops.fifo.set_sm_exception_type_mask(ch,
1872 nvgpu_mutex_release(&g->dbg_sessions_lock); 1837 sm_exception_mask_type);
1838 } else {
1839 err = -EINVAL;
1840 }
1873 1841
1874 return err; 1842 return err;
1875} 1843}