summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/vgpu.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-09-27 16:21:44 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-13 18:19:55 -0400
commitbe3750bc9eb60f8696c20b7298cc282eea17ac1b (patch)
treeb36fb818ce58a96fc7f2822480433057bd28faf4 /drivers/gpu/nvgpu/vgpu/vgpu.c
parentff9c3fc20a27444cd1ff7d9402965023e425f404 (diff)
gpu: nvgpu: Abstract IO aperture accessors
Add abstraction of IO aperture accessors. Add new functions gk20a_io_exists() and gk20a_io_valid_reg() to remove dependencies to aperture fields from common code. Implement Linux version of the abstraction by moving gk20a_readl() and gk20a_writel() to new Linux specific io.c. Move the fields defining IO aperture to nvgpu_os_linux. Add t19x specific IO aperture initialization functions and add t19x specific section to nvgpu_os_linux. JIRA NVGPU-259 Change-Id: I09e79cda60d11a20d1099a9aaa6d2375236e94ce Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1569698 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index c13d8ff0..b63202c1 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -216,6 +216,7 @@ static int vgpu_intr_thread(void *dev_id)
216 216
217static void vgpu_remove_support(struct gk20a *g) 217static void vgpu_remove_support(struct gk20a *g)
218{ 218{
219 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
219 struct vgpu_priv_data *priv = 220 struct vgpu_priv_data *priv =
220 vgpu_get_priv_data_from_dev(dev_from_gk20a(g)); 221 vgpu_get_priv_data_from_dev(dev_from_gk20a(g));
221 struct tegra_vgpu_intr_msg msg; 222 struct tegra_vgpu_intr_msg msg;
@@ -245,18 +246,20 @@ static void vgpu_remove_support(struct gk20a *g)
245 246
246 /* free mappings to registers, etc*/ 247 /* free mappings to registers, etc*/
247 248
248 if (g->bar1) { 249 if (l->bar1) {
249 iounmap(g->bar1); 250 iounmap(l->bar1);
250 g->bar1 = NULL; 251 l->bar1 = NULL;
251 } 252 }
252} 253}
253 254
254static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform) 255static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform)
255{ 256{
257 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
258
256 nvgpu_mutex_init(&g->poweron_lock); 259 nvgpu_mutex_init(&g->poweron_lock);
257 nvgpu_mutex_init(&g->poweroff_lock); 260 nvgpu_mutex_init(&g->poweroff_lock);
258 g->regs_saved = g->regs; 261 l->regs_saved = l->regs;
259 g->bar1_saved = g->bar1; 262 l->bar1_saved = l->bar1;
260 263
261 nvgpu_init_list_node(&g->pending_sema_waits); 264 nvgpu_init_list_node(&g->pending_sema_waits);
262 nvgpu_raw_spinlock_init(&g->pending_sema_waits_lock); 265 nvgpu_raw_spinlock_init(&g->pending_sema_waits_lock);
@@ -276,6 +279,7 @@ static int vgpu_init_support(struct platform_device *pdev)
276{ 279{
277 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 280 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
278 struct gk20a *g = get_gk20a(&pdev->dev); 281 struct gk20a *g = get_gk20a(&pdev->dev);
282 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
279 void __iomem *regs; 283 void __iomem *regs;
280 int err = 0; 284 int err = 0;
281 285
@@ -292,8 +296,8 @@ static int vgpu_init_support(struct platform_device *pdev)
292 err = PTR_ERR(regs); 296 err = PTR_ERR(regs);
293 goto fail; 297 goto fail;
294 } 298 }
295 g->bar1 = regs; 299 l->bar1 = regs;
296 g->bar1_mem = r; 300 l->bar1_mem = r;
297 } 301 }
298 302
299 nvgpu_mutex_init(&g->dbg_sessions_lock); 303 nvgpu_mutex_init(&g->dbg_sessions_lock);