Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm/tegra/for-4.10-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v4.10-rc1

This has a couple of fixes for IOMMU support and some fixes for error
handling.

* tag 'drm/tegra/for-4.10-rc1' of git://anongit.freedesktop.org/tegra/linux:
drm/tegra: Set sgt pointer in BO pin
drm/tegra: Support kernel mappings with IOMMU
gpu: host1x: Add locking to syncpt
gpu: host1x: Store device address to all bufs
drm/tegra: gem: Remove some dead code
drm/tegra: sor: No need to free devm_ allocated memory
drm/tegra: Fix error handling
drm/tegra: dpaux: Fix error handling

+64 -22
+2 -2
drivers/gpu/drm/tegra/dpaux.c
··· 539 539 dpaux->desc.owner = THIS_MODULE; 540 540 541 541 dpaux->pinctrl = devm_pinctrl_register(&pdev->dev, &dpaux->desc, dpaux); 542 - if (!dpaux->pinctrl) { 542 + if (IS_ERR(dpaux->pinctrl)) { 543 543 dev_err(&pdev->dev, "failed to register pincontrol\n"); 544 - return -ENODEV; 544 + return PTR_ERR(dpaux->pinctrl); 545 545 } 546 546 #endif 547 547 /* enable and clear all interrupts */
+33 -8
drivers/gpu/drm/tegra/gem.c
··· 2 2 * NVIDIA Tegra DRM GEM helper functions 3 3 * 4 4 * Copyright (C) 2012 Sascha Hauer, Pengutronix 5 - * Copyright (C) 2013 NVIDIA CORPORATION, All rights reserved. 5 + * Copyright (C) 2013-2015 NVIDIA CORPORATION, All rights reserved. 6 6 * 7 7 * Based on the GEM/CMA helpers 8 8 * ··· 36 36 { 37 37 struct tegra_bo *obj = host1x_to_tegra_bo(bo); 38 38 39 + *sgt = obj->sgt; 40 + 39 41 return obj->paddr; 40 42 } 41 43 ··· 49 47 { 50 48 struct tegra_bo *obj = host1x_to_tegra_bo(bo); 51 49 52 - return obj->vaddr; 50 + if (obj->vaddr) 51 + return obj->vaddr; 52 + else if (obj->gem.import_attach) 53 + return dma_buf_vmap(obj->gem.import_attach->dmabuf); 54 + else 55 + return vmap(obj->pages, obj->num_pages, VM_MAP, 56 + pgprot_writecombine(PAGE_KERNEL)); 53 57 } 54 58 55 59 static void tegra_bo_munmap(struct host1x_bo *bo, void *addr) 56 60 { 61 + struct tegra_bo *obj = host1x_to_tegra_bo(bo); 62 + 63 + if (obj->vaddr) 64 + return; 65 + else if (obj->gem.import_attach) 66 + dma_buf_vunmap(obj->gem.import_attach->dmabuf, addr); 67 + else 68 + vunmap(addr); 57 69 } 58 70 59 71 static void *tegra_bo_kmap(struct host1x_bo *bo, unsigned int page) 60 72 { 61 73 struct tegra_bo *obj = host1x_to_tegra_bo(bo); 62 74 63 - return obj->vaddr + page * PAGE_SIZE; 75 + if (obj->vaddr) 76 + return obj->vaddr + page * PAGE_SIZE; 77 + else if (obj->gem.import_attach) 78 + return dma_buf_kmap(obj->gem.import_attach->dmabuf, page); 79 + else 80 + return vmap(obj->pages + page, 1, VM_MAP, 81 + pgprot_writecombine(PAGE_KERNEL)); 64 82 } 65 83 66 84 static void tegra_bo_kunmap(struct host1x_bo *bo, unsigned int page, 67 85 void *addr) 68 86 { 87 + struct tegra_bo *obj = host1x_to_tegra_bo(bo); 88 + 89 + if (obj->vaddr) 90 + return; 91 + else if (obj->gem.import_attach) 92 + dma_buf_kunmap(obj->gem.import_attach->dmabuf, page, addr); 93 + else 94 + vunmap(addr); 69 95 } 70 96 71 97 static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo) ··· 348 318 get_dma_buf(buf); 349 319 350 320 bo->sgt = dma_buf_map_attachment(attach, DMA_TO_DEVICE); 351 - if (!bo->sgt) { 352 - err = -ENOMEM; 353 - goto detach; 354 - } 355 - 356 321 if (IS_ERR(bo->sgt)) { 357 322 err = PTR_ERR(bo->sgt); 358 323 goto detach;
+2 -2
drivers/gpu/drm/tegra/gr3d.c
··· 268 268 269 269 if (of_device_is_compatible(np, "nvidia,tegra30-gr3d")) { 270 270 gr3d->clk_secondary = devm_clk_get(&pdev->dev, "3d2"); 271 - if (IS_ERR(gr3d->clk)) { 271 + if (IS_ERR(gr3d->clk_secondary)) { 272 272 dev_err(&pdev->dev, "cannot get secondary clock\n"); 273 - return PTR_ERR(gr3d->clk); 273 + return PTR_ERR(gr3d->clk_secondary); 274 274 } 275 275 276 276 gr3d->rst_secondary = devm_reset_control_get(&pdev->dev,
-2
drivers/gpu/drm/tegra/sor.c
··· 349 349 brick->hw.init = &init; 350 350 351 351 clk = devm_clk_register(sor->dev, &brick->hw); 352 - if (IS_ERR(clk)) 353 - kfree(brick); 354 352 355 353 return clk; 356 354 }
+2 -1
drivers/gpu/host1x/dev.h
··· 1 1 /* 2 - * Copyright (c) 2012-2013, NVIDIA Corporation. 2 + * Copyright (c) 2012-2015, NVIDIA Corporation. 3 3 * 4 4 * This program is free software; you can redistribute it and/or modify it 5 5 * under the terms and conditions of the GNU General Public License, ··· 120 120 121 121 struct host1x_syncpt *nop_sp; 122 122 123 + struct mutex syncpt_mutex; 123 124 struct mutex chlist_mutex; 124 125 struct host1x_channel chlist; 125 126 unsigned long allocated_channels;
+6 -3
drivers/gpu/host1x/job.c
··· 1 1 /* 2 2 * Tegra host1x Job 3 3 * 4 - * Copyright (c) 2010-2013, NVIDIA Corporation. 4 + * Copyright (c) 2010-2015, NVIDIA Corporation. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms and conditions of the GNU General Public License, ··· 539 539 540 540 g->base = job->gather_addr_phys[i]; 541 541 542 - for (j = i + 1; j < job->num_gathers; j++) 543 - if (job->gathers[j].bo == g->bo) 542 + for (j = i + 1; j < job->num_gathers; j++) { 543 + if (job->gathers[j].bo == g->bo) { 544 544 job->gathers[j].handled = true; 545 + job->gathers[j].base = g->base; 546 + } 547 + } 545 548 546 549 err = do_relocs(job, g->bo); 547 550 if (err)
+19 -4
drivers/gpu/host1x/syncpt.c
··· 1 1 /* 2 2 * Tegra host1x Syncpoints 3 3 * 4 - * Copyright (c) 2010-2013, NVIDIA Corporation. 4 + * Copyright (c) 2010-2015, NVIDIA Corporation. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms and conditions of the GNU General Public License, ··· 61 61 struct host1x_syncpt *sp = host->syncpt; 62 62 char *name; 63 63 64 + mutex_lock(&host->syncpt_mutex); 65 + 64 66 for (i = 0; i < host->info->nb_pts && sp->name; i++, sp++) 65 67 ; 66 68 67 69 if (i >= host->info->nb_pts) 68 - return NULL; 70 + goto unlock; 69 71 70 72 if (flags & HOST1X_SYNCPT_HAS_BASE) { 71 73 sp->base = host1x_syncpt_base_request(host); 72 74 if (!sp->base) 73 - return NULL; 75 + goto unlock; 74 76 } 75 77 76 78 name = kasprintf(GFP_KERNEL, "%02u-%s", sp->id, 77 79 dev ? dev_name(dev) : NULL); 78 80 if (!name) 79 - return NULL; 81 + goto free_base; 80 82 81 83 sp->dev = dev; 82 84 sp->name = name; ··· 88 86 else 89 87 sp->client_managed = false; 90 88 89 + mutex_unlock(&host->syncpt_mutex); 91 90 return sp; 91 + 92 + free_base: 93 + host1x_syncpt_base_free(sp->base); 94 + sp->base = NULL; 95 + unlock: 96 + mutex_unlock(&host->syncpt_mutex); 97 + return NULL; 92 98 } 93 99 94 100 u32 host1x_syncpt_id(struct host1x_syncpt *sp) ··· 388 378 for (i = 0; i < host->info->nb_bases; i++) 389 379 bases[i].id = i; 390 380 381 + mutex_init(&host->syncpt_mutex); 391 382 host->syncpt = syncpt; 392 383 host->bases = bases; 393 384 ··· 416 405 if (!sp) 417 406 return; 418 407 408 + mutex_lock(&sp->host->syncpt_mutex); 409 + 419 410 host1x_syncpt_base_free(sp->base); 420 411 kfree(sp->name); 421 412 sp->base = NULL; 422 413 sp->dev = NULL; 423 414 sp->name = NULL; 424 415 sp->client_managed = false; 416 + 417 + mutex_unlock(&sp->host->syncpt_mutex); 425 418 } 426 419 EXPORT_SYMBOL(host1x_syncpt_free); 427 420