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/ioctl_channel.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/ioctl_channel.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 0ac50140..67bec31b 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <nvgpu/list.h> | 30 | #include <nvgpu/list.h> |
31 | #include <nvgpu/debug.h> | 31 | #include <nvgpu/debug.h> |
32 | #include <nvgpu/enabled.h> | 32 | #include <nvgpu/enabled.h> |
33 | #include <nvgpu/error_notifier.h> | ||
33 | 34 | ||
34 | #include "gk20a/gk20a.h" | 35 | #include "gk20a/gk20a.h" |
35 | #include "gk20a/dbg_gpu_gk20a.h" | 36 | #include "gk20a/dbg_gpu_gk20a.h" |
@@ -227,15 +228,17 @@ static int gk20a_channel_set_wdt_status(struct channel_gk20a *ch, | |||
227 | 228 | ||
228 | static void gk20a_channel_free_error_notifiers(struct channel_gk20a *ch) | 229 | static void gk20a_channel_free_error_notifiers(struct channel_gk20a *ch) |
229 | { | 230 | { |
230 | nvgpu_mutex_acquire(&ch->error_notifier_mutex); | 231 | struct nvgpu_channel_linux *priv = ch->os_priv; |
231 | if (ch->error_notifier_ref) { | 232 | |
232 | dma_buf_vunmap(ch->error_notifier_ref, ch->error_notifier_va); | 233 | nvgpu_mutex_acquire(&priv->error_notifier.mutex); |
233 | dma_buf_put(ch->error_notifier_ref); | 234 | if (priv->error_notifier.dmabuf) { |
234 | ch->error_notifier_ref = NULL; | 235 | dma_buf_vunmap(priv->error_notifier.dmabuf, priv->error_notifier.vaddr); |
235 | ch->error_notifier = NULL; | 236 | dma_buf_put(priv->error_notifier.dmabuf); |
236 | ch->error_notifier_va = NULL; | 237 | priv->error_notifier.dmabuf = NULL; |
238 | priv->error_notifier.notification = NULL; | ||
239 | priv->error_notifier.vaddr = NULL; | ||
237 | } | 240 | } |
238 | nvgpu_mutex_release(&ch->error_notifier_mutex); | 241 | nvgpu_mutex_release(&priv->error_notifier.mutex); |
239 | } | 242 | } |
240 | 243 | ||
241 | static int gk20a_init_error_notifier(struct channel_gk20a *ch, | 244 | static int gk20a_init_error_notifier(struct channel_gk20a *ch, |
@@ -244,6 +247,7 @@ static int gk20a_init_error_notifier(struct channel_gk20a *ch, | |||
244 | struct dma_buf *dmabuf; | 247 | struct dma_buf *dmabuf; |
245 | void *va; | 248 | void *va; |
246 | u64 end = args->offset + sizeof(struct nvgpu_notification); | 249 | u64 end = args->offset + sizeof(struct nvgpu_notification); |
250 | struct nvgpu_channel_linux *priv = ch->os_priv; | ||
247 | 251 | ||
248 | if (!args->mem) { | 252 | if (!args->mem) { |
249 | pr_err("gk20a_init_error_notifier: invalid memory handle\n"); | 253 | pr_err("gk20a_init_error_notifier: invalid memory handle\n"); |
@@ -273,14 +277,15 @@ static int gk20a_init_error_notifier(struct channel_gk20a *ch, | |||
273 | return -ENOMEM; | 277 | return -ENOMEM; |
274 | } | 278 | } |
275 | 279 | ||
276 | ch->error_notifier = va + args->offset; | 280 | priv->error_notifier.notification = va + args->offset; |
277 | ch->error_notifier_va = va; | 281 | priv->error_notifier.vaddr = va; |
278 | memset(ch->error_notifier, 0, sizeof(struct nvgpu_notification)); | 282 | memset(priv->error_notifier.notification, 0, |
283 | sizeof(struct nvgpu_notification)); | ||
279 | 284 | ||
280 | /* set channel notifiers pointer */ | 285 | /* set channel notifiers pointer */ |
281 | nvgpu_mutex_acquire(&ch->error_notifier_mutex); | 286 | nvgpu_mutex_acquire(&priv->error_notifier.mutex); |
282 | ch->error_notifier_ref = dmabuf; | 287 | priv->error_notifier.dmabuf = dmabuf; |
283 | nvgpu_mutex_release(&ch->error_notifier_mutex); | 288 | nvgpu_mutex_release(&priv->error_notifier.mutex); |
284 | 289 | ||
285 | return 0; | 290 | return 0; |
286 | } | 291 | } |
@@ -1361,7 +1366,7 @@ long gk20a_channel_ioctl(struct file *filp, | |||
1361 | break; | 1366 | break; |
1362 | } | 1367 | } |
1363 | err = ch->g->ops.fifo.force_reset_ch(ch, | 1368 | err = ch->g->ops.fifo.force_reset_ch(ch, |
1364 | NVGPU_CHANNEL_RESETCHANNEL_VERIF_ERROR, true); | 1369 | NVGPU_ERR_NOTIFIER_RESETCHANNEL_VERIF_ERROR, true); |
1365 | gk20a_idle(ch->g); | 1370 | gk20a_idle(ch->g); |
1366 | break; | 1371 | break; |
1367 | case NVGPU_IOCTL_CHANNEL_EVENT_ID_CTRL: | 1372 | case NVGPU_IOCTL_CHANNEL_EVENT_ID_CTRL: |