diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-01-12 22:18:21 -0500 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2017-02-13 21:15:03 -0500 |
commit | e7a0c0ae8b6791c6b8ee30270ebdbe6e95fbbc71 (patch) | |
tree | 0f62852593ad151cc716e258ece88fb5da30a3ae /drivers/gpu/nvgpu/common | |
parent | aa36d3786aeed6755b9744fed37aad000b582322 (diff) |
gpu: nvgpu: Move from gk20a_ to nvgpu_ in semaphore code
Change the prefix in the semaphore code to 'nvgpu_' since this code
is global to all chips.
Bug 1799159
Change-Id: Ic1f3e13428882019e5d1f547acfe95271cc10da5
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1284628
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/semaphore.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/gpu/nvgpu/common/semaphore.c b/drivers/gpu/nvgpu/common/semaphore.c index ea4910f1..4bf8695d 100644 --- a/drivers/gpu/nvgpu/common/semaphore.c +++ b/drivers/gpu/nvgpu/common/semaphore.c | |||
@@ -37,12 +37,12 @@ | |||
37 | /* | 37 | /* |
38 | * Return the sema_sea pointer. | 38 | * Return the sema_sea pointer. |
39 | */ | 39 | */ |
40 | struct gk20a_semaphore_sea *gk20a_semaphore_get_sea(struct gk20a *g) | 40 | struct nvgpu_semaphore_sea *nvgpu_semaphore_get_sea(struct gk20a *g) |
41 | { | 41 | { |
42 | return g->sema_sea; | 42 | return g->sema_sea; |
43 | } | 43 | } |
44 | 44 | ||
45 | static int __gk20a_semaphore_sea_grow(struct gk20a_semaphore_sea *sea) | 45 | static int __nvgpu_semaphore_sea_grow(struct nvgpu_semaphore_sea *sea) |
46 | { | 46 | { |
47 | int ret = 0; | 47 | int ret = 0; |
48 | struct gk20a *gk20a = sea->gk20a; | 48 | struct gk20a *gk20a = sea->gk20a; |
@@ -68,7 +68,7 @@ out: | |||
68 | * Create the semaphore sea. Only create it once - subsequent calls to this will | 68 | * Create the semaphore sea. Only create it once - subsequent calls to this will |
69 | * return the originally created sea pointer. | 69 | * return the originally created sea pointer. |
70 | */ | 70 | */ |
71 | struct gk20a_semaphore_sea *gk20a_semaphore_sea_create(struct gk20a *g) | 71 | struct nvgpu_semaphore_sea *nvgpu_semaphore_sea_create(struct gk20a *g) |
72 | { | 72 | { |
73 | if (g->sema_sea) | 73 | if (g->sema_sea) |
74 | return g->sema_sea; | 74 | return g->sema_sea; |
@@ -83,7 +83,7 @@ struct gk20a_semaphore_sea *gk20a_semaphore_sea_create(struct gk20a *g) | |||
83 | INIT_LIST_HEAD(&g->sema_sea->pool_list); | 83 | INIT_LIST_HEAD(&g->sema_sea->pool_list); |
84 | mutex_init(&g->sema_sea->sea_lock); | 84 | mutex_init(&g->sema_sea->sea_lock); |
85 | 85 | ||
86 | if (__gk20a_semaphore_sea_grow(g->sema_sea)) | 86 | if (__nvgpu_semaphore_sea_grow(g->sema_sea)) |
87 | goto cleanup; | 87 | goto cleanup; |
88 | 88 | ||
89 | gpu_sema_dbg("Created semaphore sea!"); | 89 | gpu_sema_dbg("Created semaphore sea!"); |
@@ -111,10 +111,10 @@ static int __semaphore_bitmap_alloc(unsigned long *bitmap, unsigned long len) | |||
111 | /* | 111 | /* |
112 | * Allocate a pool from the sea. | 112 | * Allocate a pool from the sea. |
113 | */ | 113 | */ |
114 | struct gk20a_semaphore_pool *gk20a_semaphore_pool_alloc( | 114 | struct nvgpu_semaphore_pool *nvgpu_semaphore_pool_alloc( |
115 | struct gk20a_semaphore_sea *sea) | 115 | struct nvgpu_semaphore_sea *sea) |
116 | { | 116 | { |
117 | struct gk20a_semaphore_pool *p; | 117 | struct nvgpu_semaphore_pool *p; |
118 | unsigned long page_idx; | 118 | unsigned long page_idx; |
119 | int ret, err = 0; | 119 | int ret, err = 0; |
120 | 120 | ||
@@ -159,7 +159,7 @@ fail: | |||
159 | * Map a pool into the passed vm's address space. This handles both the fixed | 159 | * Map a pool into the passed vm's address space. This handles both the fixed |
160 | * global RO mapping and the non-fixed private RW mapping. | 160 | * global RO mapping and the non-fixed private RW mapping. |
161 | */ | 161 | */ |
162 | int gk20a_semaphore_pool_map(struct gk20a_semaphore_pool *p, | 162 | int nvgpu_semaphore_pool_map(struct nvgpu_semaphore_pool *p, |
163 | struct vm_gk20a *vm) | 163 | struct vm_gk20a *vm) |
164 | { | 164 | { |
165 | int ents, err = 0; | 165 | int ents, err = 0; |
@@ -252,10 +252,10 @@ fail: | |||
252 | /* | 252 | /* |
253 | * Unmap a semaphore_pool. | 253 | * Unmap a semaphore_pool. |
254 | */ | 254 | */ |
255 | void gk20a_semaphore_pool_unmap(struct gk20a_semaphore_pool *p, | 255 | void nvgpu_semaphore_pool_unmap(struct nvgpu_semaphore_pool *p, |
256 | struct vm_gk20a *vm) | 256 | struct vm_gk20a *vm) |
257 | { | 257 | { |
258 | struct gk20a_semaphore_int *hw_sema; | 258 | struct nvgpu_semaphore_int *hw_sema; |
259 | 259 | ||
260 | kunmap(p->cpu_va); | 260 | kunmap(p->cpu_va); |
261 | 261 | ||
@@ -291,12 +291,12 @@ void gk20a_semaphore_pool_unmap(struct gk20a_semaphore_pool *p, | |||
291 | * Completely free a sempahore_pool. You should make sure this pool is not | 291 | * Completely free a sempahore_pool. You should make sure this pool is not |
292 | * mapped otherwise there's going to be a memory leak. | 292 | * mapped otherwise there's going to be a memory leak. |
293 | */ | 293 | */ |
294 | static void gk20a_semaphore_pool_free(struct kref *ref) | 294 | static void nvgpu_semaphore_pool_free(struct kref *ref) |
295 | { | 295 | { |
296 | struct gk20a_semaphore_pool *p = | 296 | struct nvgpu_semaphore_pool *p = |
297 | container_of(ref, struct gk20a_semaphore_pool, ref); | 297 | container_of(ref, struct nvgpu_semaphore_pool, ref); |
298 | struct gk20a_semaphore_sea *s = p->sema_sea; | 298 | struct nvgpu_semaphore_sea *s = p->sema_sea; |
299 | struct gk20a_semaphore_int *hw_sema, *tmp; | 299 | struct nvgpu_semaphore_int *hw_sema, *tmp; |
300 | 300 | ||
301 | WARN_ON(p->gpu_va || p->rw_sg_table || p->ro_sg_table); | 301 | WARN_ON(p->gpu_va || p->rw_sg_table || p->ro_sg_table); |
302 | 302 | ||
@@ -313,21 +313,21 @@ static void gk20a_semaphore_pool_free(struct kref *ref) | |||
313 | kfree(p); | 313 | kfree(p); |
314 | } | 314 | } |
315 | 315 | ||
316 | void gk20a_semaphore_pool_get(struct gk20a_semaphore_pool *p) | 316 | void nvgpu_semaphore_pool_get(struct nvgpu_semaphore_pool *p) |
317 | { | 317 | { |
318 | kref_get(&p->ref); | 318 | kref_get(&p->ref); |
319 | } | 319 | } |
320 | 320 | ||
321 | void gk20a_semaphore_pool_put(struct gk20a_semaphore_pool *p) | 321 | void nvgpu_semaphore_pool_put(struct nvgpu_semaphore_pool *p) |
322 | { | 322 | { |
323 | kref_put(&p->ref, gk20a_semaphore_pool_free); | 323 | kref_put(&p->ref, nvgpu_semaphore_pool_free); |
324 | } | 324 | } |
325 | 325 | ||
326 | /* | 326 | /* |
327 | * Get the address for a semaphore_pool - if global is true then return the | 327 | * Get the address for a semaphore_pool - if global is true then return the |
328 | * global RO address instead of the RW address owned by the semaphore's VM. | 328 | * global RO address instead of the RW address owned by the semaphore's VM. |
329 | */ | 329 | */ |
330 | u64 __gk20a_semaphore_pool_gpu_va(struct gk20a_semaphore_pool *p, bool global) | 330 | u64 __nvgpu_semaphore_pool_gpu_va(struct nvgpu_semaphore_pool *p, bool global) |
331 | { | 331 | { |
332 | if (!global) | 332 | if (!global) |
333 | return p->gpu_va; | 333 | return p->gpu_va; |
@@ -335,12 +335,12 @@ u64 __gk20a_semaphore_pool_gpu_va(struct gk20a_semaphore_pool *p, bool global) | |||
335 | return p->gpu_va_ro + (PAGE_SIZE * p->page_idx); | 335 | return p->gpu_va_ro + (PAGE_SIZE * p->page_idx); |
336 | } | 336 | } |
337 | 337 | ||
338 | static int __gk20a_init_hw_sema(struct channel_gk20a *ch) | 338 | static int __nvgpu_init_hw_sema(struct channel_gk20a *ch) |
339 | { | 339 | { |
340 | int hw_sema_idx; | 340 | int hw_sema_idx; |
341 | int ret = 0; | 341 | int ret = 0; |
342 | struct gk20a_semaphore_int *hw_sema; | 342 | struct nvgpu_semaphore_int *hw_sema; |
343 | struct gk20a_semaphore_pool *p = ch->vm->sema_pool; | 343 | struct nvgpu_semaphore_pool *p = ch->vm->sema_pool; |
344 | 344 | ||
345 | BUG_ON(!p); | 345 | BUG_ON(!p); |
346 | 346 | ||
@@ -354,7 +354,7 @@ static int __gk20a_init_hw_sema(struct channel_gk20a *ch) | |||
354 | goto fail; | 354 | goto fail; |
355 | } | 355 | } |
356 | 356 | ||
357 | hw_sema = kzalloc(sizeof(struct gk20a_semaphore_int), GFP_KERNEL); | 357 | hw_sema = kzalloc(sizeof(struct nvgpu_semaphore_int), GFP_KERNEL); |
358 | if (!hw_sema) { | 358 | if (!hw_sema) { |
359 | ret = -ENOMEM; | 359 | ret = -ENOMEM; |
360 | goto fail_free_idx; | 360 | goto fail_free_idx; |
@@ -385,9 +385,9 @@ fail: | |||
385 | /* | 385 | /* |
386 | * Free the channel used semaphore index | 386 | * Free the channel used semaphore index |
387 | */ | 387 | */ |
388 | void gk20a_semaphore_free_hw_sema(struct channel_gk20a *ch) | 388 | void nvgpu_semaphore_free_hw_sema(struct channel_gk20a *ch) |
389 | { | 389 | { |
390 | struct gk20a_semaphore_pool *p = ch->vm->sema_pool; | 390 | struct nvgpu_semaphore_pool *p = ch->vm->sema_pool; |
391 | 391 | ||
392 | BUG_ON(!p); | 392 | BUG_ON(!p); |
393 | 393 | ||
@@ -409,13 +409,13 @@ void gk20a_semaphore_free_hw_sema(struct channel_gk20a *ch) | |||
409 | * Since semaphores are ref-counted there's no explicit free for external code | 409 | * Since semaphores are ref-counted there's no explicit free for external code |
410 | * to use. When the ref-count hits 0 the internal free will happen. | 410 | * to use. When the ref-count hits 0 the internal free will happen. |
411 | */ | 411 | */ |
412 | struct gk20a_semaphore *gk20a_semaphore_alloc(struct channel_gk20a *ch) | 412 | struct nvgpu_semaphore *nvgpu_semaphore_alloc(struct channel_gk20a *ch) |
413 | { | 413 | { |
414 | struct gk20a_semaphore *s; | 414 | struct nvgpu_semaphore *s; |
415 | int ret; | 415 | int ret; |
416 | 416 | ||
417 | if (!ch->hw_sema) { | 417 | if (!ch->hw_sema) { |
418 | ret = __gk20a_init_hw_sema(ch); | 418 | ret = __nvgpu_init_hw_sema(ch); |
419 | if (ret) | 419 | if (ret) |
420 | return NULL; | 420 | return NULL; |
421 | } | 421 | } |
@@ -432,29 +432,29 @@ struct gk20a_semaphore *gk20a_semaphore_alloc(struct channel_gk20a *ch) | |||
432 | * Take a ref on the pool so that we can keep this pool alive for | 432 | * Take a ref on the pool so that we can keep this pool alive for |
433 | * as long as this semaphore is alive. | 433 | * as long as this semaphore is alive. |
434 | */ | 434 | */ |
435 | gk20a_semaphore_pool_get(s->hw_sema->p); | 435 | nvgpu_semaphore_pool_get(s->hw_sema->p); |
436 | 436 | ||
437 | gpu_sema_dbg("Allocated semaphore (c=%d)", ch->hw_chid); | 437 | gpu_sema_dbg("Allocated semaphore (c=%d)", ch->hw_chid); |
438 | 438 | ||
439 | return s; | 439 | return s; |
440 | } | 440 | } |
441 | 441 | ||
442 | static void gk20a_semaphore_free(struct kref *ref) | 442 | static void nvgpu_semaphore_free(struct kref *ref) |
443 | { | 443 | { |
444 | struct gk20a_semaphore *s = | 444 | struct nvgpu_semaphore *s = |
445 | container_of(ref, struct gk20a_semaphore, ref); | 445 | container_of(ref, struct nvgpu_semaphore, ref); |
446 | 446 | ||
447 | gk20a_semaphore_pool_put(s->hw_sema->p); | 447 | nvgpu_semaphore_pool_put(s->hw_sema->p); |
448 | 448 | ||
449 | kfree(s); | 449 | kfree(s); |
450 | } | 450 | } |
451 | 451 | ||
452 | void gk20a_semaphore_put(struct gk20a_semaphore *s) | 452 | void nvgpu_semaphore_put(struct nvgpu_semaphore *s) |
453 | { | 453 | { |
454 | kref_put(&s->ref, gk20a_semaphore_free); | 454 | kref_put(&s->ref, nvgpu_semaphore_free); |
455 | } | 455 | } |
456 | 456 | ||
457 | void gk20a_semaphore_get(struct gk20a_semaphore *s) | 457 | void nvgpu_semaphore_get(struct nvgpu_semaphore *s) |
458 | { | 458 | { |
459 | kref_get(&s->ref); | 459 | kref_get(&s->ref); |
460 | } | 460 | } |