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/gk20a/channel_gk20a.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/gk20a/channel_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 65 |
1 files changed, 15 insertions, 50 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index e01d6cdb..a0415861 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <nvgpu/ltc.h> | 44 | #include <nvgpu/ltc.h> |
45 | #include <nvgpu/barrier.h> | 45 | #include <nvgpu/barrier.h> |
46 | #include <nvgpu/ctxsw_trace.h> | 46 | #include <nvgpu/ctxsw_trace.h> |
47 | #include <nvgpu/error_notifier.h> | ||
47 | 48 | ||
48 | #include "gk20a.h" | 49 | #include "gk20a.h" |
49 | #include "dbg_gpu_gk20a.h" | 50 | #include "dbg_gpu_gk20a.h" |
@@ -339,37 +340,6 @@ int gk20a_channel_set_runlist_interleave(struct channel_gk20a *ch, | |||
339 | return ret ? ret : g->ops.fifo.update_runlist(g, ch->runlist_id, ~0, true, true); | 340 | return ret ? ret : g->ops.fifo.update_runlist(g, ch->runlist_id, ~0, true, true); |
340 | } | 341 | } |
341 | 342 | ||
342 | /** | ||
343 | * gk20a_set_error_notifier_locked() | ||
344 | * Should be called with ch->error_notifier_mutex held | ||
345 | */ | ||
346 | void gk20a_set_error_notifier_locked(struct channel_gk20a *ch, __u32 error) | ||
347 | { | ||
348 | if (ch->error_notifier_ref) { | ||
349 | struct timespec time_data; | ||
350 | u64 nsec; | ||
351 | getnstimeofday(&time_data); | ||
352 | nsec = ((u64)time_data.tv_sec) * 1000000000u + | ||
353 | (u64)time_data.tv_nsec; | ||
354 | ch->error_notifier->time_stamp.nanoseconds[0] = | ||
355 | (u32)nsec; | ||
356 | ch->error_notifier->time_stamp.nanoseconds[1] = | ||
357 | (u32)(nsec >> 32); | ||
358 | ch->error_notifier->info32 = error; | ||
359 | ch->error_notifier->status = 0xffff; | ||
360 | |||
361 | nvgpu_err(ch->g, | ||
362 | "error notifier set to %d for ch %d", error, ch->chid); | ||
363 | } | ||
364 | } | ||
365 | |||
366 | void gk20a_set_error_notifier(struct channel_gk20a *ch, __u32 error) | ||
367 | { | ||
368 | nvgpu_mutex_acquire(&ch->error_notifier_mutex); | ||
369 | gk20a_set_error_notifier_locked(ch, error); | ||
370 | nvgpu_mutex_release(&ch->error_notifier_mutex); | ||
371 | } | ||
372 | |||
373 | static void gk20a_wait_until_counter_is_N( | 343 | static void gk20a_wait_until_counter_is_N( |
374 | struct channel_gk20a *ch, nvgpu_atomic_t *counter, int wait_value, | 344 | struct channel_gk20a *ch, nvgpu_atomic_t *counter, int wait_value, |
375 | struct nvgpu_cond *c, const char *caller, const char *counter_name) | 345 | struct nvgpu_cond *c, const char *caller, const char *counter_name) |
@@ -1550,7 +1520,7 @@ static void gk20a_channel_timeout_handler(struct channel_gk20a *ch) | |||
1550 | gk20a_gr_debug_dump(g); | 1520 | gk20a_gr_debug_dump(g); |
1551 | 1521 | ||
1552 | g->ops.fifo.force_reset_ch(ch, | 1522 | g->ops.fifo.force_reset_ch(ch, |
1553 | NVGPU_CHANNEL_FIFO_ERROR_IDLE_TIMEOUT, true); | 1523 | NVGPU_ERR_NOTIFIER_FIFO_ERROR_IDLE_TIMEOUT, true); |
1554 | } | 1524 | } |
1555 | 1525 | ||
1556 | /** | 1526 | /** |
@@ -2210,53 +2180,48 @@ int gk20a_init_channel_support(struct gk20a *g, u32 chid) | |||
2210 | err = nvgpu_mutex_init(&c->ioctl_lock); | 2180 | err = nvgpu_mutex_init(&c->ioctl_lock); |
2211 | if (err) | 2181 | if (err) |
2212 | return err; | 2182 | return err; |
2213 | err = nvgpu_mutex_init(&c->error_notifier_mutex); | ||
2214 | if (err) | ||
2215 | goto fail_1; | ||
2216 | err = nvgpu_mutex_init(&c->joblist.cleanup_lock); | 2183 | err = nvgpu_mutex_init(&c->joblist.cleanup_lock); |
2217 | if (err) | 2184 | if (err) |
2218 | goto fail_2; | 2185 | goto fail_1; |
2219 | err = nvgpu_mutex_init(&c->joblist.pre_alloc.read_lock); | 2186 | err = nvgpu_mutex_init(&c->joblist.pre_alloc.read_lock); |
2220 | if (err) | 2187 | if (err) |
2221 | goto fail_3; | 2188 | goto fail_2; |
2222 | err = nvgpu_mutex_init(&c->sync_lock); | 2189 | err = nvgpu_mutex_init(&c->sync_lock); |
2223 | if (err) | 2190 | if (err) |
2224 | goto fail_4; | 2191 | goto fail_3; |
2225 | #if defined(CONFIG_GK20A_CYCLE_STATS) | 2192 | #if defined(CONFIG_GK20A_CYCLE_STATS) |
2226 | err = nvgpu_mutex_init(&c->cyclestate.cyclestate_buffer_mutex); | 2193 | err = nvgpu_mutex_init(&c->cyclestate.cyclestate_buffer_mutex); |
2227 | if (err) | 2194 | if (err) |
2228 | goto fail_5; | 2195 | goto fail_4; |
2229 | err = nvgpu_mutex_init(&c->cs_client_mutex); | 2196 | err = nvgpu_mutex_init(&c->cs_client_mutex); |
2230 | if (err) | 2197 | if (err) |
2231 | goto fail_6; | 2198 | goto fail_5; |
2232 | #endif | 2199 | #endif |
2233 | err = nvgpu_mutex_init(&c->event_id_list_lock); | 2200 | err = nvgpu_mutex_init(&c->event_id_list_lock); |
2234 | if (err) | 2201 | if (err) |
2235 | goto fail_7; | 2202 | goto fail_6; |
2236 | err = nvgpu_mutex_init(&c->dbg_s_lock); | 2203 | err = nvgpu_mutex_init(&c->dbg_s_lock); |
2237 | if (err) | 2204 | if (err) |
2238 | goto fail_8; | 2205 | goto fail_7; |
2239 | 2206 | ||
2240 | nvgpu_list_add(&c->free_chs, &g->fifo.free_chs); | 2207 | nvgpu_list_add(&c->free_chs, &g->fifo.free_chs); |
2241 | 2208 | ||
2242 | return 0; | 2209 | return 0; |
2243 | 2210 | ||
2244 | fail_8: | ||
2245 | nvgpu_mutex_destroy(&c->event_id_list_lock); | ||
2246 | fail_7: | 2211 | fail_7: |
2212 | nvgpu_mutex_destroy(&c->event_id_list_lock); | ||
2213 | fail_6: | ||
2247 | #if defined(CONFIG_GK20A_CYCLE_STATS) | 2214 | #if defined(CONFIG_GK20A_CYCLE_STATS) |
2248 | nvgpu_mutex_destroy(&c->cs_client_mutex); | 2215 | nvgpu_mutex_destroy(&c->cs_client_mutex); |
2249 | fail_6: | ||
2250 | nvgpu_mutex_destroy(&c->cyclestate.cyclestate_buffer_mutex); | ||
2251 | fail_5: | 2216 | fail_5: |
2217 | nvgpu_mutex_destroy(&c->cyclestate.cyclestate_buffer_mutex); | ||
2218 | fail_4: | ||
2252 | #endif | 2219 | #endif |
2253 | nvgpu_mutex_destroy(&c->sync_lock); | 2220 | nvgpu_mutex_destroy(&c->sync_lock); |
2254 | fail_4: | ||
2255 | nvgpu_mutex_destroy(&c->joblist.pre_alloc.read_lock); | ||
2256 | fail_3: | 2221 | fail_3: |
2257 | nvgpu_mutex_destroy(&c->joblist.cleanup_lock); | 2222 | nvgpu_mutex_destroy(&c->joblist.pre_alloc.read_lock); |
2258 | fail_2: | 2223 | fail_2: |
2259 | nvgpu_mutex_destroy(&c->error_notifier_mutex); | 2224 | nvgpu_mutex_destroy(&c->joblist.cleanup_lock); |
2260 | fail_1: | 2225 | fail_1: |
2261 | nvgpu_mutex_destroy(&c->ioctl_lock); | 2226 | nvgpu_mutex_destroy(&c->ioctl_lock); |
2262 | 2227 | ||