summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_fifo.c23
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_tsg.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/vm.c6
4 files changed, 17 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/debug_fifo.c b/drivers/gpu/nvgpu/common/linux/debug_fifo.c
index 1763eb7e..59198718 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_fifo.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_fifo.c
@@ -20,7 +20,7 @@
20 20
21#include <nvgpu/sort.h> 21#include <nvgpu/sort.h>
22 22
23void __gk20a_fifo_profile_free(struct kref *ref); 23void __gk20a_fifo_profile_free(struct nvgpu_ref *ref);
24 24
25static void *gk20a_fifo_sched_debugfs_seq_start( 25static void *gk20a_fifo_sched_debugfs_seq_start(
26 struct seq_file *s, loff_t *pos) 26 struct seq_file *s, loff_t *pos)
@@ -145,14 +145,15 @@ static int gk20a_fifo_profile_enable(void *data, u64 val)
145 if (val == 0) { 145 if (val == 0) {
146 if (f->profile.enabled) { 146 if (f->profile.enabled) {
147 f->profile.enabled = false; 147 f->profile.enabled = false;
148 kref_put(&f->profile.ref, __gk20a_fifo_profile_free); 148 nvgpu_ref_put(&f->profile.ref,
149 __gk20a_fifo_profile_free);
149 } 150 }
150 } else { 151 } else {
151 if (!f->profile.enabled) { 152 if (!f->profile.enabled) {
152 /* not kref init as it can have a running condition if 153 /* not kref init as it can have a running condition if
153 * we enable/disable/enable while kickoff is happening 154 * we enable/disable/enable while kickoff is happening
154 */ 155 */
155 if (!kref_get_unless_zero(&f->profile.ref)) { 156 if (!nvgpu_ref_get_unless_zero(&f->profile.ref)) {
156 f->profile.data = vzalloc( 157 f->profile.data = vzalloc(
157 FIFO_PROFILING_ENTRIES * 158 FIFO_PROFILING_ENTRIES *
158 sizeof(struct fifo_profile_gk20a)); 159 sizeof(struct fifo_profile_gk20a));
@@ -165,7 +166,7 @@ static int gk20a_fifo_profile_enable(void *data, u64 val)
165 nvgpu_mutex_release(&f->profile.lock); 166 nvgpu_mutex_release(&f->profile.lock);
166 return -ENOMEM; 167 return -ENOMEM;
167 } 168 }
168 kref_init(&f->profile.ref); 169 nvgpu_ref_init(&f->profile.ref);
169 } 170 }
170 atomic_set(&f->profile.get.atomic_var, 0); 171 atomic_set(&f->profile.get.atomic_var, 0);
171 f->profile.enabled = true; 172 f->profile.enabled = true;
@@ -241,7 +242,7 @@ static int gk20a_fifo_profile_stats(struct seq_file *s, void *unused)
241 u64 percentiles_append[PERCENTILE_RANGES]; 242 u64 percentiles_append[PERCENTILE_RANGES];
242 u64 percentiles_userd[PERCENTILE_RANGES]; 243 u64 percentiles_userd[PERCENTILE_RANGES];
243 244
244 if (!kref_get_unless_zero(&g->fifo.profile.ref)) { 245 if (!nvgpu_ref_get_unless_zero(&g->fifo.profile.ref)) {
245 seq_printf(s, "Profiling disabled\n"); 246 seq_printf(s, "Profiling disabled\n");
246 return 0; 247 return 0;
247 } 248 }
@@ -271,7 +272,7 @@ static int gk20a_fifo_profile_stats(struct seq_file *s, void *unused)
271 percentiles_jobtracking[index], 272 percentiles_jobtracking[index],
272 percentiles_userd[index]); 273 percentiles_userd[index]);
273 274
274 kref_put(&g->fifo.profile.ref, __gk20a_fifo_profile_free); 275 nvgpu_ref_put(&g->fifo.profile.ref, __gk20a_fifo_profile_free);
275 276
276 return 0; 277 return 0;
277} 278}
@@ -312,7 +313,7 @@ void gk20a_fifo_debugfs_init(struct gk20a *g)
312 nvgpu_mutex_init(&g->fifo.profile.lock); 313 nvgpu_mutex_init(&g->fifo.profile.lock);
313 g->fifo.profile.enabled = false; 314 g->fifo.profile.enabled = false;
314 atomic_set(&g->fifo.profile.get.atomic_var, 0); 315 atomic_set(&g->fifo.profile.get.atomic_var, 0);
315 atomic_set(&g->fifo.profile.ref.refcount, 0); 316 atomic_set(&g->fifo.profile.ref.refcount.atomic_var, 0);
316 317
317 debugfs_create_file("enable", 0600, profile_root, g, 318 debugfs_create_file("enable", 0600, profile_root, g,
318 &gk20a_fifo_profile_enable_debugfs_fops); 319 &gk20a_fifo_profile_enable_debugfs_fops);
@@ -322,7 +323,7 @@ void gk20a_fifo_debugfs_init(struct gk20a *g)
322 323
323} 324}
324 325
325void __gk20a_fifo_profile_free(struct kref *ref) 326void __gk20a_fifo_profile_free(struct nvgpu_ref *ref)
326{ 327{
327 struct fifo_gk20a *f = container_of(ref, struct fifo_gk20a, 328 struct fifo_gk20a *f = container_of(ref, struct fifo_gk20a,
328 profile.ref); 329 profile.ref);
@@ -340,7 +341,7 @@ struct fifo_profile_gk20a *gk20a_fifo_profile_acquire(struct gk20a *g)
340 unsigned int index; 341 unsigned int index;
341 342
342 /* If kref is zero, profiling is not enabled */ 343 /* If kref is zero, profiling is not enabled */
343 if (!kref_get_unless_zero(&f->profile.ref)) 344 if (!nvgpu_ref_get_unless_zero(&f->profile.ref))
344 return NULL; 345 return NULL;
345 index = atomic_inc_return(&f->profile.get.atomic_var); 346 index = atomic_inc_return(&f->profile.get.atomic_var);
346 profile = &f->profile.data[index % FIFO_PROFILING_ENTRIES]; 347 profile = &f->profile.data[index % FIFO_PROFILING_ENTRIES];
@@ -352,7 +353,7 @@ struct fifo_profile_gk20a *gk20a_fifo_profile_acquire(struct gk20a *g)
352void gk20a_fifo_profile_release(struct gk20a *g, 353void gk20a_fifo_profile_release(struct gk20a *g,
353 struct fifo_profile_gk20a *profile) 354 struct fifo_profile_gk20a *profile)
354{ 355{
355 kref_put(&g->fifo.profile.ref, __gk20a_fifo_profile_free); 356 nvgpu_ref_put(&g->fifo.profile.ref, __gk20a_fifo_profile_free);
356} 357}
357 358
358void gk20a_fifo_debugfs_deinit(struct gk20a *g) 359void gk20a_fifo_debugfs_deinit(struct gk20a *g)
@@ -362,7 +363,7 @@ void gk20a_fifo_debugfs_deinit(struct gk20a *g)
362 nvgpu_mutex_acquire(&f->profile.lock); 363 nvgpu_mutex_acquire(&f->profile.lock);
363 if (f->profile.enabled) { 364 if (f->profile.enabled) {
364 f->profile.enabled = false; 365 f->profile.enabled = false;
365 kref_put(&f->profile.ref, __gk20a_fifo_profile_free); 366 nvgpu_ref_put(&f->profile.ref, __gk20a_fifo_profile_free);
366 } 367 }
367 nvgpu_mutex_release(&f->profile.lock); 368 nvgpu_mutex_release(&f->profile.lock);
368} 369}
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c
index d1905c86..e8530c05 100644
--- a/drivers/gpu/nvgpu/common/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/common/linux/driver_common.c
@@ -217,7 +217,7 @@ int nvgpu_probe(struct gk20a *g,
217 217
218 g->remove_support = gk20a_remove_support; 218 g->remove_support = gk20a_remove_support;
219 219
220 kref_init(&g->refcount); 220 nvgpu_ref_init(&g->refcount);
221 221
222 return 0; 222 return 0;
223} 223}
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
index cb876e23..c68c907e 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
@@ -260,7 +260,7 @@ int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp)
260 struct tsg_private *priv = filp->private_data; 260 struct tsg_private *priv = filp->private_data;
261 struct tsg_gk20a *tsg = priv->tsg; 261 struct tsg_gk20a *tsg = priv->tsg;
262 262
263 kref_put(&tsg->refcount, gk20a_tsg_release); 263 nvgpu_ref_put(&tsg->refcount, gk20a_tsg_release);
264 nvgpu_kfree(tsg->g, priv); 264 nvgpu_kfree(tsg->g, priv);
265 return 0; 265 return 0;
266} 266}
diff --git a/drivers/gpu/nvgpu/common/linux/vm.c b/drivers/gpu/nvgpu/common/linux/vm.c
index 3d1219b6..c84f531d 100644
--- a/drivers/gpu/nvgpu/common/linux/vm.c
+++ b/drivers/gpu/nvgpu/common/linux/vm.c
@@ -155,7 +155,7 @@ static u64 __nvgpu_vm_find_mapping(struct vm_gk20a *vm,
155 else 155 else
156 mapped_buffer->own_mem_ref = true; 156 mapped_buffer->own_mem_ref = true;
157 } 157 }
158 kref_get(&mapped_buffer->ref); 158 nvgpu_ref_get(&mapped_buffer->ref);
159 159
160 nvgpu_log(g, gpu_dbg_map, 160 nvgpu_log(g, gpu_dbg_map,
161 "gv: 0x%04x_%08x + 0x%-7zu " 161 "gv: 0x%04x_%08x + 0x%-7zu "
@@ -380,7 +380,7 @@ u64 nvgpu_vm_map(struct vm_gk20a *vm,
380 mapped_buffer->user_mapped = user_mapped ? 1 : 0; 380 mapped_buffer->user_mapped = user_mapped ? 1 : 0;
381 mapped_buffer->own_mem_ref = user_mapped; 381 mapped_buffer->own_mem_ref = user_mapped;
382 nvgpu_init_list_node(&mapped_buffer->buffer_list); 382 nvgpu_init_list_node(&mapped_buffer->buffer_list);
383 kref_init(&mapped_buffer->ref); 383 nvgpu_ref_init(&mapped_buffer->ref);
384 384
385 err = nvgpu_insert_mapped_buf(vm, mapped_buffer); 385 err = nvgpu_insert_mapped_buf(vm, mapped_buffer);
386 if (err) { 386 if (err) {
@@ -425,6 +425,6 @@ void nvgpu_vm_unmap(struct vm_gk20a *vm, u64 offset)
425 return; 425 return;
426 } 426 }
427 427
428 kref_put(&mapped_buffer->ref, gk20a_vm_unmap_locked_kref); 428 nvgpu_ref_put(&mapped_buffer->ref, gk20a_vm_unmap_locked_ref);
429 nvgpu_mutex_release(&vm->update_gmmu_lock); 429 nvgpu_mutex_release(&vm->update_gmmu_lock);
430} 430}