Lines Matching refs:tegra

77 	struct tegra_drm *tegra = drm->dev_private;  in tegra_atomic_commit_tail()  local
79 if (tegra->hub) { in tegra_atomic_commit_tail()
461 struct tegra_drm *tegra = drm->dev_private; in tegra_open_channel() local
473 list_for_each_entry(client, &tegra->clients, list) in tegra_open_channel()
856 struct tegra_drm *tegra = drm->dev_private; in tegra_debugfs_iova() local
859 if (tegra->domain) { in tegra_debugfs_iova()
860 mutex_lock(&tegra->mm_lock); in tegra_debugfs_iova()
861 drm_mm_print(&tegra->mm, &p); in tegra_debugfs_iova()
862 mutex_unlock(&tegra->mm_lock); in tegra_debugfs_iova()
907 int tegra_drm_register_client(struct tegra_drm *tegra, in tegra_drm_register_client() argument
918 mutex_lock(&tegra->clients_lock); in tegra_drm_register_client()
919 list_add_tail(&client->list, &tegra->clients); in tegra_drm_register_client()
920 client->drm = tegra; in tegra_drm_register_client()
921 mutex_unlock(&tegra->clients_lock); in tegra_drm_register_client()
926 int tegra_drm_unregister_client(struct tegra_drm *tegra, in tegra_drm_unregister_client() argument
929 mutex_lock(&tegra->clients_lock); in tegra_drm_unregister_client()
932 mutex_unlock(&tegra->clients_lock); in tegra_drm_unregister_client()
944 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_attach() local
965 domain != tegra->domain) in host1x_client_iommu_attach()
968 if (tegra->domain) { in host1x_client_iommu_attach()
973 if (domain != tegra->domain) { in host1x_client_iommu_attach()
974 err = iommu_attach_group(tegra->domain, group); in host1x_client_iommu_attach()
981 tegra->use_explicit_iommu = true; in host1x_client_iommu_attach()
992 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_detach() local
1003 iommu_detach_group(tegra->domain, client->group); in host1x_client_iommu_detach()
1010 void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma) in tegra_drm_alloc() argument
1017 if (tegra->domain) in tegra_drm_alloc()
1018 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_alloc()
1023 if (!tegra->domain) { in tegra_drm_alloc()
1037 if (!tegra->domain) { in tegra_drm_alloc()
1046 alloc = alloc_iova(&tegra->carveout.domain, in tegra_drm_alloc()
1047 size >> tegra->carveout.shift, in tegra_drm_alloc()
1048 tegra->carveout.limit, true); in tegra_drm_alloc()
1054 *dma = iova_dma_addr(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1055 err = iommu_map(tegra->domain, *dma, virt_to_phys(virt), in tegra_drm_alloc()
1063 __free_iova(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1070 void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, in tegra_drm_free() argument
1073 if (tegra->domain) in tegra_drm_free()
1074 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_free()
1078 if (tegra->domain) { in tegra_drm_free()
1079 iommu_unmap(tegra->domain, dma, size); in tegra_drm_free()
1080 free_iova(&tegra->carveout.domain, in tegra_drm_free()
1081 iova_pfn(&tegra->carveout.domain, dma)); in tegra_drm_free()
1140 struct tegra_drm *tegra; in host1x_drm_probe() local
1148 tegra = kzalloc(sizeof(*tegra), GFP_KERNEL); in host1x_drm_probe()
1149 if (!tegra) { in host1x_drm_probe()
1155 tegra->domain = iommu_paging_domain_alloc(dma_dev); in host1x_drm_probe()
1156 if (IS_ERR(tegra->domain)) { in host1x_drm_probe()
1157 err = PTR_ERR(tegra->domain); in host1x_drm_probe()
1166 mutex_init(&tegra->clients_lock); in host1x_drm_probe()
1167 INIT_LIST_HEAD(&tegra->clients); in host1x_drm_probe()
1170 drm->dev_private = tegra; in host1x_drm_probe()
1171 tegra->drm = drm; in host1x_drm_probe()
1196 tegra->hmask = drm->mode_config.max_width - 1; in host1x_drm_probe()
1197 tegra->vmask = drm->mode_config.max_height - 1; in host1x_drm_probe()
1199 if (tegra->use_explicit_iommu) { in host1x_drm_probe()
1205 start = tegra->domain->geometry.aperture_start & dma_mask; in host1x_drm_probe()
1206 end = tegra->domain->geometry.aperture_end & dma_mask; in host1x_drm_probe()
1213 order = __ffs(tegra->domain->pgsize_bitmap); in host1x_drm_probe()
1214 init_iova_domain(&tegra->carveout.domain, 1UL << order, in host1x_drm_probe()
1217 tegra->carveout.shift = iova_shift(&tegra->carveout.domain); in host1x_drm_probe()
1218 tegra->carveout.limit = carveout_end >> tegra->carveout.shift; in host1x_drm_probe()
1220 drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1); in host1x_drm_probe()
1221 mutex_init(&tegra->mm_lock); in host1x_drm_probe()
1227 } else if (tegra->domain) { in host1x_drm_probe()
1228 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1229 tegra->domain = NULL; in host1x_drm_probe()
1233 if (tegra->hub) { in host1x_drm_probe()
1234 err = tegra_display_hub_prepare(tegra->hub); in host1x_drm_probe()
1278 if (tegra->hub) in host1x_drm_probe()
1279 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_probe()
1281 if (tegra->domain) { in host1x_drm_probe()
1282 mutex_destroy(&tegra->mm_lock); in host1x_drm_probe()
1283 drm_mm_takedown(&tegra->mm); in host1x_drm_probe()
1284 put_iova_domain(&tegra->carveout.domain); in host1x_drm_probe()
1293 if (tegra->domain) in host1x_drm_probe()
1294 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1296 kfree(tegra); in host1x_drm_probe()
1305 struct tegra_drm *tegra = drm->dev_private; in host1x_drm_remove() local
1314 if (tegra->hub) in host1x_drm_remove()
1315 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_remove()
1321 if (tegra->domain) { in host1x_drm_remove()
1322 mutex_destroy(&tegra->mm_lock); in host1x_drm_remove()
1323 drm_mm_takedown(&tegra->mm); in host1x_drm_remove()
1324 put_iova_domain(&tegra->carveout.domain); in host1x_drm_remove()
1326 iommu_domain_free(tegra->domain); in host1x_drm_remove()
1329 kfree(tegra); in host1x_drm_remove()