summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-01-24 08:30:42 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-22 07:15:02 -0500
commit8ee3aa4b3175d8d27e57a0f5d5e2cdf3d78a4a58 (patch)
tree505dfd2ea2aca2f1cbdb254baee980862d21e04d /drivers/gpu/nvgpu/gp106
parent1f855af63fdd31fe3dcfee75f4f5f9b62f30d87e (diff)
gpu: nvgpu: use common nvgpu mutex/spinlock APIs
Instead of using Linux APIs for mutex and spinlocks directly, use new APIs defined in <nvgpu/lock.h> Replace Linux specific mutex/spinlock declaration, init, lock, unlock APIs with new APIs e.g struct mutex is replaced by struct nvgpu_mutex and mutex_lock() is replaced by nvgpu_mutex_acquire() And also include <nvgpu/lock.h> instead of including <linux/mutex.h> and <linux/spinlock.h> Add explicit nvgpu/lock.h includes to below files to fix complilation failures. gk20a/platform_gk20a.h include/nvgpu/allocator.h Jira NVGPU-13 Change-Id: I81a05d21ecdbd90c2076a9f0aefd0e40b215bd33 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1293187 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106')
-rw-r--r--drivers/gpu/nvgpu/gp106/clk_gp106.c8
-rw-r--r--drivers/gpu/nvgpu/gp106/clk_gp106.h4
-rw-r--r--drivers/gpu/nvgpu/gp106/sec2_gp106.c12
3 files changed, 12 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/gp106/clk_gp106.c b/drivers/gpu/nvgpu/gp106/clk_gp106.c
index edeb97ec..3b9c444d 100644
--- a/drivers/gpu/nvgpu/gp106/clk_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/clk_gp106.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP106 Clocks 2 * GP106 Clocks
3 * 3 *
4 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -79,7 +79,7 @@ static int gp106_init_clk_support(struct gk20a *g) {
79 79
80 gk20a_dbg_fn(""); 80 gk20a_dbg_fn("");
81 81
82 mutex_init(&clk->clk_mutex); 82 nvgpu_mutex_init(&clk->clk_mutex);
83 83
84 clk->clk_namemap = (struct namemap_cfg *) 84 clk->clk_namemap = (struct namemap_cfg *)
85 kzalloc(sizeof(struct namemap_cfg) * NUM_NAMEMAPS, GFP_KERNEL); 85 kzalloc(sizeof(struct namemap_cfg) * NUM_NAMEMAPS, GFP_KERNEL);
@@ -169,7 +169,7 @@ static u32 gp106_get_rate_cntr(struct gk20a *g, struct namemap_cfg *c) {
169 if (!c || !c->cntr.reg_ctrl_addr || !c->cntr.reg_cntr_addr) 169 if (!c || !c->cntr.reg_ctrl_addr || !c->cntr.reg_cntr_addr)
170 return 0; 170 return 0;
171 171
172 mutex_lock(&clk->clk_mutex); 172 nvgpu_mutex_acquire(&clk->clk_mutex);
173 173
174 /* Save the register */ 174 /* Save the register */
175 save_reg = gk20a_readl(g, c->cntr.reg_ctrl_addr); 175 save_reg = gk20a_readl(g, c->cntr.reg_ctrl_addr);
@@ -216,7 +216,7 @@ read_err:
216 gk20a_readl(g, c->cntr.reg_ctrl_addr); 216 gk20a_readl(g, c->cntr.reg_ctrl_addr);
217 gk20a_writel(g, c->cntr.reg_ctrl_addr, save_reg); 217 gk20a_writel(g, c->cntr.reg_ctrl_addr, save_reg);
218 gk20a_readl(g, c->cntr.reg_ctrl_addr); 218 gk20a_readl(g, c->cntr.reg_ctrl_addr);
219 mutex_unlock(&clk->clk_mutex); 219 nvgpu_mutex_release(&clk->clk_mutex);
220 220
221 return cntr; 221 return cntr;
222 222
diff --git a/drivers/gpu/nvgpu/gp106/clk_gp106.h b/drivers/gpu/nvgpu/gp106/clk_gp106.h
index 7df4b974..3c2e31d1 100644
--- a/drivers/gpu/nvgpu/gp106/clk_gp106.h
+++ b/drivers/gpu/nvgpu/gp106/clk_gp106.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -16,7 +16,7 @@
16#ifndef CLK_GP106_H 16#ifndef CLK_GP106_H
17#define CLK_GP106_H 17#define CLK_GP106_H
18 18
19#include <linux/mutex.h> 19#include <nvgpu/lock.h>
20 20
21#define CLK_NAMEMAP_INDEX_GPC2CLK 0x00 21#define CLK_NAMEMAP_INDEX_GPC2CLK 0x00
22#define CLK_NAMEMAP_INDEX_XBAR2CLK 0x02 22#define CLK_NAMEMAP_INDEX_XBAR2CLK 0x02
diff --git a/drivers/gpu/nvgpu/gp106/sec2_gp106.c b/drivers/gpu/nvgpu/gp106/sec2_gp106.c
index 9af16886..51e76605 100644
--- a/drivers/gpu/nvgpu/gp106/sec2_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/sec2_gp106.c
@@ -114,7 +114,7 @@ void sec2_copy_to_dmem(struct pmu_gk20a *pmu,
114 return; 114 return;
115 } 115 }
116 116
117 mutex_lock(&pmu->pmu_copy_lock); 117 nvgpu_mutex_acquire(&pmu->pmu_copy_lock);
118 118
119 words = size >> 2; 119 words = size >> 2;
120 bytes = size & 0x3; 120 bytes = size & 0x3;
@@ -144,7 +144,7 @@ void sec2_copy_to_dmem(struct pmu_gk20a *pmu,
144 "copy failed. bytes written %d, expected %d", 144 "copy failed. bytes written %d, expected %d",
145 data - dst, size); 145 data - dst, size);
146 } 146 }
147 mutex_unlock(&pmu->pmu_copy_lock); 147 nvgpu_mutex_release(&pmu->pmu_copy_lock);
148 return; 148 return;
149} 149}
150 150
@@ -348,10 +348,10 @@ int init_sec2_setup_hw1(struct gk20a *g,
348 348
349 gk20a_dbg_fn(""); 349 gk20a_dbg_fn("");
350 350
351 mutex_lock(&pmu->isr_mutex); 351 nvgpu_mutex_acquire(&pmu->isr_mutex);
352 g->ops.pmu.reset(g); 352 g->ops.pmu.reset(g);
353 pmu->isr_enabled = true; 353 pmu->isr_enabled = true;
354 mutex_unlock(&pmu->isr_mutex); 354 nvgpu_mutex_release(&pmu->isr_mutex);
355 355
356 data = gk20a_readl(g, psec_fbif_ctl_r()); 356 data = gk20a_readl(g, psec_fbif_ctl_r());
357 data |= psec_fbif_ctl_allow_phys_no_ctx_allow_f(); 357 data |= psec_fbif_ctl_allow_phys_no_ctx_allow_f();
@@ -379,11 +379,11 @@ int init_sec2_setup_hw1(struct gk20a *g,
379 psec_fbif_transcfg_target_noncoherent_sysmem_f()); 379 psec_fbif_transcfg_target_noncoherent_sysmem_f());
380 380
381 /*disable irqs for hs falcon booting as we will poll for halt*/ 381 /*disable irqs for hs falcon booting as we will poll for halt*/
382 mutex_lock(&pmu->isr_mutex); 382 nvgpu_mutex_acquire(&pmu->isr_mutex);
383 pmu_enable_irq(pmu, false); 383 pmu_enable_irq(pmu, false);
384 sec_enable_irq(pmu, false); 384 sec_enable_irq(pmu, false);
385 pmu->isr_enabled = false; 385 pmu->isr_enabled = false;
386 mutex_unlock(&pmu->isr_mutex); 386 nvgpu_mutex_release(&pmu->isr_mutex);
387 err = bl_bootstrap_sec2(pmu, desc, bl_sz); 387 err = bl_bootstrap_sec2(pmu, desc, bl_sz);
388 if (err) 388 if (err)
389 return err; 389 return err;