diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 24 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 3 |
2 files changed, 14 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index e3937afd..713c4215 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -602,10 +602,10 @@ unbind: | |||
602 | 602 | ||
603 | /* put back the channel-wide submit ref from init */ | 603 | /* put back the channel-wide submit ref from init */ |
604 | if (ch->deterministic) { | 604 | if (ch->deterministic) { |
605 | down_read(&g->deterministic_busy); | 605 | nvgpu_rwsem_down_read(&g->deterministic_busy); |
606 | ch->deterministic = false; | 606 | ch->deterministic = false; |
607 | gk20a_idle(g); | 607 | gk20a_idle(g); |
608 | up_read(&g->deterministic_busy); | 608 | nvgpu_rwsem_up_read(&g->deterministic_busy); |
609 | } | 609 | } |
610 | 610 | ||
611 | ch->vpr = false; | 611 | ch->vpr = false; |
@@ -1268,7 +1268,7 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | |||
1268 | c->vpr = true; | 1268 | c->vpr = true; |
1269 | 1269 | ||
1270 | if (flags & NVGPU_ALLOC_GPFIFO_EX_FLAGS_DETERMINISTIC) { | 1270 | if (flags & NVGPU_ALLOC_GPFIFO_EX_FLAGS_DETERMINISTIC) { |
1271 | down_read(&g->deterministic_busy); | 1271 | nvgpu_rwsem_down_read(&g->deterministic_busy); |
1272 | /* | 1272 | /* |
1273 | * Railgating isn't deterministic; instead of disallowing | 1273 | * Railgating isn't deterministic; instead of disallowing |
1274 | * railgating globally, take a power refcount for this | 1274 | * railgating globally, take a power refcount for this |
@@ -1280,12 +1280,12 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | |||
1280 | */ | 1280 | */ |
1281 | err = gk20a_busy(g); | 1281 | err = gk20a_busy(g); |
1282 | if (err) { | 1282 | if (err) { |
1283 | up_read(&g->deterministic_busy); | 1283 | nvgpu_rwsem_up_read(&g->deterministic_busy); |
1284 | return err; | 1284 | return err; |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | c->deterministic = true; | 1287 | c->deterministic = true; |
1288 | up_read(&g->deterministic_busy); | 1288 | nvgpu_rwsem_up_read(&g->deterministic_busy); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | /* an address space needs to have been bound at this point. */ | 1291 | /* an address space needs to have been bound at this point. */ |
@@ -1397,10 +1397,10 @@ clean_up: | |||
1397 | memset(&c->gpfifo, 0, sizeof(struct gpfifo_desc)); | 1397 | memset(&c->gpfifo, 0, sizeof(struct gpfifo_desc)); |
1398 | clean_up_idle: | 1398 | clean_up_idle: |
1399 | if (c->deterministic) { | 1399 | if (c->deterministic) { |
1400 | down_read(&g->deterministic_busy); | 1400 | nvgpu_rwsem_down_read(&g->deterministic_busy); |
1401 | gk20a_idle(g); | 1401 | gk20a_idle(g); |
1402 | c->deterministic = false; | 1402 | c->deterministic = false; |
1403 | up_read(&g->deterministic_busy); | 1403 | nvgpu_rwsem_up_read(&g->deterministic_busy); |
1404 | } | 1404 | } |
1405 | nvgpu_err(g, "fail"); | 1405 | nvgpu_err(g, "fail"); |
1406 | return err; | 1406 | return err; |
@@ -2661,7 +2661,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
2661 | 2661 | ||
2662 | /* Grab access to HW to deal with do_idle */ | 2662 | /* Grab access to HW to deal with do_idle */ |
2663 | if (c->deterministic) | 2663 | if (c->deterministic) |
2664 | down_read(&g->deterministic_busy); | 2664 | nvgpu_rwsem_down_read(&g->deterministic_busy); |
2665 | 2665 | ||
2666 | trace_gk20a_channel_submit_gpfifo(g->name, | 2666 | trace_gk20a_channel_submit_gpfifo(g->name, |
2667 | c->chid, | 2667 | c->chid, |
@@ -2741,7 +2741,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
2741 | 2741 | ||
2742 | /* No hw access beyond this point */ | 2742 | /* No hw access beyond this point */ |
2743 | if (c->deterministic) | 2743 | if (c->deterministic) |
2744 | up_read(&g->deterministic_busy); | 2744 | nvgpu_rwsem_up_read(&g->deterministic_busy); |
2745 | 2745 | ||
2746 | trace_gk20a_channel_submitted_gpfifo(g->name, | 2746 | trace_gk20a_channel_submitted_gpfifo(g->name, |
2747 | c->chid, | 2747 | c->chid, |
@@ -2765,7 +2765,7 @@ clean_up: | |||
2765 | gk20a_fence_put(pre_fence); | 2765 | gk20a_fence_put(pre_fence); |
2766 | gk20a_fence_put(post_fence); | 2766 | gk20a_fence_put(post_fence); |
2767 | if (c->deterministic) | 2767 | if (c->deterministic) |
2768 | up_read(&g->deterministic_busy); | 2768 | nvgpu_rwsem_up_read(&g->deterministic_busy); |
2769 | else if (need_deferred_cleanup) | 2769 | else if (need_deferred_cleanup) |
2770 | gk20a_idle(g); | 2770 | gk20a_idle(g); |
2771 | 2771 | ||
@@ -2787,7 +2787,7 @@ void gk20a_channel_deterministic_idle(struct gk20a *g) | |||
2787 | u32 chid; | 2787 | u32 chid; |
2788 | 2788 | ||
2789 | /* Grab exclusive access to the hw to block new submits */ | 2789 | /* Grab exclusive access to the hw to block new submits */ |
2790 | down_write(&g->deterministic_busy); | 2790 | nvgpu_rwsem_down_write(&g->deterministic_busy); |
2791 | 2791 | ||
2792 | for (chid = 0; chid < f->num_channels; chid++) { | 2792 | for (chid = 0; chid < f->num_channels; chid++) { |
2793 | struct channel_gk20a *ch = &f->channel[chid]; | 2793 | struct channel_gk20a *ch = &f->channel[chid]; |
@@ -2845,7 +2845,7 @@ void gk20a_channel_deterministic_unidle(struct gk20a *g) | |||
2845 | } | 2845 | } |
2846 | 2846 | ||
2847 | /* Release submits, new deterministic channels and frees */ | 2847 | /* Release submits, new deterministic channels and frees */ |
2848 | up_write(&g->deterministic_busy); | 2848 | nvgpu_rwsem_up_write(&g->deterministic_busy); |
2849 | } | 2849 | } |
2850 | 2850 | ||
2851 | int gk20a_init_channel_support(struct gk20a *g, u32 chid) | 2851 | int gk20a_init_channel_support(struct gk20a *g, u32 chid) |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index cf13999a..b6f6a97b 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -58,6 +58,7 @@ struct nvgpu_mem_sgt; | |||
58 | #include <nvgpu/pmu.h> | 58 | #include <nvgpu/pmu.h> |
59 | #include <nvgpu/atomic.h> | 59 | #include <nvgpu/atomic.h> |
60 | #include <nvgpu/barrier.h> | 60 | #include <nvgpu/barrier.h> |
61 | #include <nvgpu/rwsem.h> | ||
61 | 62 | ||
62 | #include "clk_gk20a.h" | 63 | #include "clk_gk20a.h" |
63 | #include "ce2_gk20a.h" | 64 | #include "ce2_gk20a.h" |
@@ -1082,7 +1083,7 @@ struct gk20a { | |||
1082 | * for submits and held for channel lifetime but dropped for an ongoing | 1083 | * for submits and held for channel lifetime but dropped for an ongoing |
1083 | * gk20a_do_idle(). | 1084 | * gk20a_do_idle(). |
1084 | */ | 1085 | */ |
1085 | struct rw_semaphore deterministic_busy; | 1086 | struct nvgpu_rwsem deterministic_busy; |
1086 | 1087 | ||
1087 | struct nvgpu_falcon pmu_flcn; | 1088 | struct nvgpu_falcon pmu_flcn; |
1088 | struct nvgpu_falcon sec2_flcn; | 1089 | struct nvgpu_falcon sec2_flcn; |