diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2018-02-28 06:56:36 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-03-01 16:53:28 -0500 |
commit | df2100018db1dba730937fe76464a8edf8ebf5dc (patch) | |
tree | 016ba84823e0752f665e3b67e569b8ef146ccfc6 /drivers/gpu/nvgpu/gk20a | |
parent | aa1da74a75aca5d85d1a78546fec381423bf5836 (diff) |
gpu: nvgpu: allocate separate client managed syncpoint for User
We right now allocate a nvgpu managed syncpoint in c->sync and share
that with user space
But to avoid conflicts between user space and kernel space increments
allocate a separate "client managed" syncpoint for User space in c->user_sync
Add new API nvgpu_nvhost_get_syncpt_client_managed() to request a client managed
syncpoint from nvhost.
Note that nvhost/nvgpu do not keep track of MAX/threshold value of this syncpoint
Update gk20a_channel_syncpt_create() to receive a flag to indicate whether a
User space syncpoint is required or not
Unset NVGPU_SUPPORT_USER_SYNCPOINT for gp10b since we don't want to allocate
double syncpoints per channel on that platform
For gv11b, once we move to use user space submits, support for c->sync will be
dropped so we keep using only one syncpoint per channel
Bug 200326065
Jira NVGPU-179
Change-Id: I78d94de4276db1c897ea2a4fe4c2db8b2a179722
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1665828
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h | 3 |
4 files changed, 25 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 2f5ea301..2c98797d 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -438,6 +438,10 @@ static void gk20a_free_channel(struct channel_gk20a *ch, bool force) | |||
438 | gk20a_channel_sync_destroy(ch->sync); | 438 | gk20a_channel_sync_destroy(ch->sync); |
439 | ch->sync = NULL; | 439 | ch->sync = NULL; |
440 | } | 440 | } |
441 | if (ch->user_sync) { | ||
442 | gk20a_channel_sync_destroy(ch->user_sync); | ||
443 | ch->user_sync = NULL; | ||
444 | } | ||
441 | nvgpu_mutex_release(&ch->sync_lock); | 445 | nvgpu_mutex_release(&ch->sync_lock); |
442 | 446 | ||
443 | /* | 447 | /* |
@@ -1147,7 +1151,7 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | |||
1147 | 1151 | ||
1148 | if (!g->aggressive_sync_destroy_thresh) { | 1152 | if (!g->aggressive_sync_destroy_thresh) { |
1149 | nvgpu_mutex_acquire(&c->sync_lock); | 1153 | nvgpu_mutex_acquire(&c->sync_lock); |
1150 | c->sync = gk20a_channel_sync_create(c); | 1154 | c->sync = gk20a_channel_sync_create(c, false); |
1151 | if (!c->sync) { | 1155 | if (!c->sync) { |
1152 | err = -ENOMEM; | 1156 | err = -ENOMEM; |
1153 | nvgpu_mutex_release(&c->sync_lock); | 1157 | nvgpu_mutex_release(&c->sync_lock); |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index db1404a3..edb645b5 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -226,6 +226,7 @@ struct channel_gk20a { | |||
226 | 226 | ||
227 | struct nvgpu_mutex sync_lock; | 227 | struct nvgpu_mutex sync_lock; |
228 | struct gk20a_channel_sync *sync; | 228 | struct gk20a_channel_sync *sync; |
229 | struct gk20a_channel_sync *user_sync; | ||
229 | 230 | ||
230 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | 231 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION |
231 | u64 virt_ctx; | 232 | u64 virt_ctx; |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index e965a329..9649c573 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | |||
@@ -315,7 +315,7 @@ static void gk20a_channel_syncpt_destroy(struct gk20a_channel_sync *s) | |||
315 | } | 315 | } |
316 | 316 | ||
317 | static struct gk20a_channel_sync * | 317 | static struct gk20a_channel_sync * |
318 | gk20a_channel_syncpt_create(struct channel_gk20a *c) | 318 | gk20a_channel_syncpt_create(struct channel_gk20a *c, bool user_managed) |
319 | { | 319 | { |
320 | struct gk20a_channel_syncpt *sp; | 320 | struct gk20a_channel_syncpt *sp; |
321 | char syncpt_name[32]; | 321 | char syncpt_name[32]; |
@@ -327,11 +327,19 @@ gk20a_channel_syncpt_create(struct channel_gk20a *c) | |||
327 | sp->c = c; | 327 | sp->c = c; |
328 | sp->nvhost_dev = c->g->nvhost_dev; | 328 | sp->nvhost_dev = c->g->nvhost_dev; |
329 | 329 | ||
330 | snprintf(syncpt_name, sizeof(syncpt_name), | 330 | if (user_managed) { |
331 | "%s_%d", c->g->name, c->chid); | 331 | snprintf(syncpt_name, sizeof(syncpt_name), |
332 | "%s_%d_user", c->g->name, c->chid); | ||
332 | 333 | ||
333 | sp->id = nvgpu_nvhost_get_syncpt_host_managed(sp->nvhost_dev, | 334 | sp->id = nvgpu_nvhost_get_syncpt_client_managed(sp->nvhost_dev, |
335 | syncpt_name); | ||
336 | } else { | ||
337 | snprintf(syncpt_name, sizeof(syncpt_name), | ||
338 | "%s_%d", c->g->name, c->chid); | ||
339 | |||
340 | sp->id = nvgpu_nvhost_get_syncpt_host_managed(sp->nvhost_dev, | ||
334 | c->chid, syncpt_name); | 341 | c->chid, syncpt_name); |
342 | } | ||
335 | if (!sp->id) { | 343 | if (!sp->id) { |
336 | nvgpu_kfree(c->g, sp); | 344 | nvgpu_kfree(c->g, sp); |
337 | nvgpu_err(c->g, "failed to get free syncpt"); | 345 | nvgpu_err(c->g, "failed to get free syncpt"); |
@@ -892,7 +900,7 @@ static void gk20a_channel_semaphore_destroy(struct gk20a_channel_sync *s) | |||
892 | } | 900 | } |
893 | 901 | ||
894 | static struct gk20a_channel_sync * | 902 | static struct gk20a_channel_sync * |
895 | gk20a_channel_semaphore_create(struct channel_gk20a *c) | 903 | gk20a_channel_semaphore_create(struct channel_gk20a *c, bool user_managed) |
896 | { | 904 | { |
897 | int asid = -1; | 905 | int asid = -1; |
898 | struct gk20a_channel_semaphore *sema; | 906 | struct gk20a_channel_semaphore *sema; |
@@ -940,13 +948,14 @@ void gk20a_channel_sync_destroy(struct gk20a_channel_sync *sync) | |||
940 | sync->destroy(sync); | 948 | sync->destroy(sync); |
941 | } | 949 | } |
942 | 950 | ||
943 | struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c) | 951 | struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c, |
952 | bool user_managed) | ||
944 | { | 953 | { |
945 | #ifdef CONFIG_TEGRA_GK20A_NVHOST | 954 | #ifdef CONFIG_TEGRA_GK20A_NVHOST |
946 | if (gk20a_platform_has_syncpoints(c->g)) | 955 | if (gk20a_platform_has_syncpoints(c->g)) |
947 | return gk20a_channel_syncpt_create(c); | 956 | return gk20a_channel_syncpt_create(c, user_managed); |
948 | #endif | 957 | #endif |
949 | return gk20a_channel_semaphore_create(c); | 958 | return gk20a_channel_semaphore_create(c, user_managed); |
950 | } | 959 | } |
951 | 960 | ||
952 | bool gk20a_channel_sync_needs_sync_framework(struct gk20a *g) | 961 | bool gk20a_channel_sync_needs_sync_framework(struct gk20a *g) |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h index fe1d8526..f4f54145 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h | |||
@@ -110,7 +110,8 @@ struct gk20a_channel_sync { | |||
110 | }; | 110 | }; |
111 | 111 | ||
112 | void gk20a_channel_sync_destroy(struct gk20a_channel_sync *sync); | 112 | void gk20a_channel_sync_destroy(struct gk20a_channel_sync *sync); |
113 | struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c); | 113 | struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c, |
114 | bool user_managed); | ||
114 | bool gk20a_channel_sync_needs_sync_framework(struct gk20a *g); | 115 | bool gk20a_channel_sync_needs_sync_framework(struct gk20a *g); |
115 | 116 | ||
116 | #ifdef CONFIG_SYNC | 117 | #ifdef CONFIG_SYNC |