Lines Matching refs:tegra
65 struct tegra_drm *tegra = drm->dev_private; in tegra_atomic_commit_tail() local
67 if (tegra->hub) { in tegra_atomic_commit_tail()
447 struct tegra_drm *tegra = drm->dev_private; in tegra_open_channel() local
459 list_for_each_entry(client, &tegra->clients, list) in tegra_open_channel()
825 struct tegra_drm *tegra = drm->dev_private; in tegra_debugfs_iova() local
828 if (tegra->domain) { in tegra_debugfs_iova()
829 mutex_lock(&tegra->mm_lock); in tegra_debugfs_iova()
830 drm_mm_print(&tegra->mm, &p); in tegra_debugfs_iova()
831 mutex_unlock(&tegra->mm_lock); in tegra_debugfs_iova()
883 int tegra_drm_register_client(struct tegra_drm *tegra, in tegra_drm_register_client() argument
886 mutex_lock(&tegra->clients_lock); in tegra_drm_register_client()
887 list_add_tail(&client->list, &tegra->clients); in tegra_drm_register_client()
888 client->drm = tegra; in tegra_drm_register_client()
889 mutex_unlock(&tegra->clients_lock); in tegra_drm_register_client()
894 int tegra_drm_unregister_client(struct tegra_drm *tegra, in tegra_drm_unregister_client() argument
897 mutex_lock(&tegra->clients_lock); in tegra_drm_unregister_client()
900 mutex_unlock(&tegra->clients_lock); in tegra_drm_unregister_client()
909 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_attach() local
918 if (domain && domain != tegra->domain) in host1x_client_iommu_attach()
921 if (tegra->domain) { in host1x_client_iommu_attach()
926 if (domain != tegra->domain) { in host1x_client_iommu_attach()
927 err = iommu_attach_group(tegra->domain, group); in host1x_client_iommu_attach()
934 tegra->use_explicit_iommu = true; in host1x_client_iommu_attach()
945 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_detach() local
956 iommu_detach_group(tegra->domain, client->group); in host1x_client_iommu_detach()
963 void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma) in tegra_drm_alloc() argument
970 if (tegra->domain) in tegra_drm_alloc()
971 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_alloc()
976 if (!tegra->domain) { in tegra_drm_alloc()
990 if (!tegra->domain) { in tegra_drm_alloc()
999 alloc = alloc_iova(&tegra->carveout.domain, in tegra_drm_alloc()
1000 size >> tegra->carveout.shift, in tegra_drm_alloc()
1001 tegra->carveout.limit, true); in tegra_drm_alloc()
1007 *dma = iova_dma_addr(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1008 err = iommu_map(tegra->domain, *dma, virt_to_phys(virt), in tegra_drm_alloc()
1016 __free_iova(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1023 void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, in tegra_drm_free() argument
1026 if (tegra->domain) in tegra_drm_free()
1027 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_free()
1031 if (tegra->domain) { in tegra_drm_free()
1032 iommu_unmap(tegra->domain, dma, size); in tegra_drm_free()
1033 free_iova(&tegra->carveout.domain, in tegra_drm_free()
1034 iova_pfn(&tegra->carveout.domain, dma)); in tegra_drm_free()
1093 struct tegra_drm *tegra; in host1x_drm_probe() local
1101 tegra = kzalloc(sizeof(*tegra), GFP_KERNEL); in host1x_drm_probe()
1102 if (!tegra) { in host1x_drm_probe()
1108 tegra->domain = iommu_domain_alloc(&platform_bus_type); in host1x_drm_probe()
1109 if (!tegra->domain) { in host1x_drm_probe()
1119 mutex_init(&tegra->clients_lock); in host1x_drm_probe()
1120 INIT_LIST_HEAD(&tegra->clients); in host1x_drm_probe()
1123 drm->dev_private = tegra; in host1x_drm_probe()
1124 tegra->drm = drm; in host1x_drm_probe()
1149 if (tegra->use_explicit_iommu) { in host1x_drm_probe()
1155 start = tegra->domain->geometry.aperture_start & dma_mask; in host1x_drm_probe()
1156 end = tegra->domain->geometry.aperture_end & dma_mask; in host1x_drm_probe()
1163 order = __ffs(tegra->domain->pgsize_bitmap); in host1x_drm_probe()
1164 init_iova_domain(&tegra->carveout.domain, 1UL << order, in host1x_drm_probe()
1167 tegra->carveout.shift = iova_shift(&tegra->carveout.domain); in host1x_drm_probe()
1168 tegra->carveout.limit = carveout_end >> tegra->carveout.shift; in host1x_drm_probe()
1170 drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1); in host1x_drm_probe()
1171 mutex_init(&tegra->mm_lock); in host1x_drm_probe()
1177 } else if (tegra->domain) { in host1x_drm_probe()
1178 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1179 tegra->domain = NULL; in host1x_drm_probe()
1183 if (tegra->hub) { in host1x_drm_probe()
1184 err = tegra_display_hub_prepare(tegra->hub); in host1x_drm_probe()
1223 if (tegra->hub) in host1x_drm_probe()
1224 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_probe()
1226 if (tegra->domain) { in host1x_drm_probe()
1227 mutex_destroy(&tegra->mm_lock); in host1x_drm_probe()
1228 drm_mm_takedown(&tegra->mm); in host1x_drm_probe()
1229 put_iova_domain(&tegra->carveout.domain); in host1x_drm_probe()
1240 if (tegra->domain) in host1x_drm_probe()
1241 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1243 kfree(tegra); in host1x_drm_probe()
1252 struct tegra_drm *tegra = drm->dev_private; in host1x_drm_remove() local
1262 if (tegra->hub) in host1x_drm_remove()
1263 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_remove()
1269 if (tegra->domain) { in host1x_drm_remove()
1270 mutex_destroy(&tegra->mm_lock); in host1x_drm_remove()
1271 drm_mm_takedown(&tegra->mm); in host1x_drm_remove()
1272 put_iova_domain(&tegra->carveout.domain); in host1x_drm_remove()
1274 iommu_domain_free(tegra->domain); in host1x_drm_remove()
1277 kfree(tegra); in host1x_drm_remove()