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()
855 struct tegra_drm *tegra = drm->dev_private; in tegra_debugfs_iova() local
858 if (tegra->domain) { in tegra_debugfs_iova()
859 mutex_lock(&tegra->mm_lock); in tegra_debugfs_iova()
860 drm_mm_print(&tegra->mm, &p); in tegra_debugfs_iova()
861 mutex_unlock(&tegra->mm_lock); in tegra_debugfs_iova()
906 int tegra_drm_register_client(struct tegra_drm *tegra, in tegra_drm_register_client() argument
917 mutex_lock(&tegra->clients_lock); in tegra_drm_register_client()
918 list_add_tail(&client->list, &tegra->clients); in tegra_drm_register_client()
919 client->drm = tegra; in tegra_drm_register_client()
920 mutex_unlock(&tegra->clients_lock); in tegra_drm_register_client()
925 int tegra_drm_unregister_client(struct tegra_drm *tegra, in tegra_drm_unregister_client() argument
928 mutex_lock(&tegra->clients_lock); in tegra_drm_unregister_client()
931 mutex_unlock(&tegra->clients_lock); in tegra_drm_unregister_client()
943 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_attach() local
963 if (domain && domain != tegra->domain) in host1x_client_iommu_attach()
966 if (tegra->domain) { in host1x_client_iommu_attach()
971 if (domain != tegra->domain) { in host1x_client_iommu_attach()
972 err = iommu_attach_group(tegra->domain, group); in host1x_client_iommu_attach()
979 tegra->use_explicit_iommu = true; in host1x_client_iommu_attach()
990 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_detach() local
1001 iommu_detach_group(tegra->domain, client->group); in host1x_client_iommu_detach()
1008 void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma) in tegra_drm_alloc() argument
1015 if (tegra->domain) in tegra_drm_alloc()
1016 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_alloc()
1021 if (!tegra->domain) { in tegra_drm_alloc()
1035 if (!tegra->domain) { in tegra_drm_alloc()
1044 alloc = alloc_iova(&tegra->carveout.domain, in tegra_drm_alloc()
1045 size >> tegra->carveout.shift, in tegra_drm_alloc()
1046 tegra->carveout.limit, true); in tegra_drm_alloc()
1052 *dma = iova_dma_addr(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1053 err = iommu_map(tegra->domain, *dma, virt_to_phys(virt), in tegra_drm_alloc()
1061 __free_iova(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1068 void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, in tegra_drm_free() argument
1071 if (tegra->domain) in tegra_drm_free()
1072 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_free()
1076 if (tegra->domain) { in tegra_drm_free()
1077 iommu_unmap(tegra->domain, dma, size); in tegra_drm_free()
1078 free_iova(&tegra->carveout.domain, in tegra_drm_free()
1079 iova_pfn(&tegra->carveout.domain, dma)); in tegra_drm_free()
1137 struct tegra_drm *tegra; in host1x_drm_probe() local
1145 tegra = kzalloc(sizeof(*tegra), GFP_KERNEL); in host1x_drm_probe()
1146 if (!tegra) { in host1x_drm_probe()
1152 tegra->domain = iommu_domain_alloc(&platform_bus_type); in host1x_drm_probe()
1153 if (!tegra->domain) { in host1x_drm_probe()
1163 mutex_init(&tegra->clients_lock); in host1x_drm_probe()
1164 INIT_LIST_HEAD(&tegra->clients); in host1x_drm_probe()
1167 drm->dev_private = tegra; in host1x_drm_probe()
1168 tegra->drm = drm; in host1x_drm_probe()
1193 tegra->hmask = drm->mode_config.max_width - 1; in host1x_drm_probe()
1194 tegra->vmask = drm->mode_config.max_height - 1; in host1x_drm_probe()
1196 if (tegra->use_explicit_iommu) { in host1x_drm_probe()
1202 start = tegra->domain->geometry.aperture_start & dma_mask; in host1x_drm_probe()
1203 end = tegra->domain->geometry.aperture_end & dma_mask; in host1x_drm_probe()
1210 order = __ffs(tegra->domain->pgsize_bitmap); in host1x_drm_probe()
1211 init_iova_domain(&tegra->carveout.domain, 1UL << order, in host1x_drm_probe()
1214 tegra->carveout.shift = iova_shift(&tegra->carveout.domain); in host1x_drm_probe()
1215 tegra->carveout.limit = carveout_end >> tegra->carveout.shift; in host1x_drm_probe()
1217 drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1); in host1x_drm_probe()
1218 mutex_init(&tegra->mm_lock); in host1x_drm_probe()
1224 } else if (tegra->domain) { in host1x_drm_probe()
1225 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1226 tegra->domain = NULL; in host1x_drm_probe()
1230 if (tegra->hub) { in host1x_drm_probe()
1231 err = tegra_display_hub_prepare(tegra->hub); in host1x_drm_probe()
1258 if (tegra->hub) in host1x_drm_probe()
1259 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_probe()
1261 if (tegra->domain) { in host1x_drm_probe()
1262 mutex_destroy(&tegra->mm_lock); in host1x_drm_probe()
1263 drm_mm_takedown(&tegra->mm); in host1x_drm_probe()
1264 put_iova_domain(&tegra->carveout.domain); in host1x_drm_probe()
1273 if (tegra->domain) in host1x_drm_probe()
1274 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1276 kfree(tegra); in host1x_drm_probe()
1285 struct tegra_drm *tegra = drm->dev_private; in host1x_drm_remove() local
1294 if (tegra->hub) in host1x_drm_remove()
1295 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_remove()
1301 if (tegra->domain) { in host1x_drm_remove()
1302 mutex_destroy(&tegra->mm_lock); in host1x_drm_remove()
1303 drm_mm_takedown(&tegra->mm); in host1x_drm_remove()
1304 put_iova_domain(&tegra->carveout.domain); in host1x_drm_remove()
1306 iommu_domain_free(tegra->domain); in host1x_drm_remove()
1309 kfree(tegra); in host1x_drm_remove()