Lines Matching refs:tegra

80 	struct tegra_drm *tegra = drm->dev_private;  in tegra_atomic_commit_tail()  local
82 if (tegra->hub) { in tegra_atomic_commit_tail()
464 struct tegra_drm *tegra = drm->dev_private; in tegra_open_channel() local
476 list_for_each_entry(client, &tegra->clients, list) in tegra_open_channel()
858 struct tegra_drm *tegra = drm->dev_private; in tegra_debugfs_iova() local
861 if (tegra->domain) { in tegra_debugfs_iova()
862 mutex_lock(&tegra->mm_lock); in tegra_debugfs_iova()
863 drm_mm_print(&tegra->mm, &p); in tegra_debugfs_iova()
864 mutex_unlock(&tegra->mm_lock); in tegra_debugfs_iova()
912 int tegra_drm_register_client(struct tegra_drm *tegra, in tegra_drm_register_client() argument
923 mutex_lock(&tegra->clients_lock); in tegra_drm_register_client()
924 list_add_tail(&client->list, &tegra->clients); in tegra_drm_register_client()
925 client->drm = tegra; in tegra_drm_register_client()
926 mutex_unlock(&tegra->clients_lock); in tegra_drm_register_client()
931 int tegra_drm_unregister_client(struct tegra_drm *tegra, in tegra_drm_unregister_client() argument
934 mutex_lock(&tegra->clients_lock); in tegra_drm_unregister_client()
937 mutex_unlock(&tegra->clients_lock); in tegra_drm_unregister_client()
949 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_attach() local
969 if (domain && domain != tegra->domain) in host1x_client_iommu_attach()
972 if (tegra->domain) { in host1x_client_iommu_attach()
977 if (domain != tegra->domain) { in host1x_client_iommu_attach()
978 err = iommu_attach_group(tegra->domain, group); in host1x_client_iommu_attach()
985 tegra->use_explicit_iommu = true; in host1x_client_iommu_attach()
996 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_detach() local
1007 iommu_detach_group(tegra->domain, client->group); in host1x_client_iommu_detach()
1014 void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma) in tegra_drm_alloc() argument
1021 if (tegra->domain) in tegra_drm_alloc()
1022 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_alloc()
1027 if (!tegra->domain) { in tegra_drm_alloc()
1041 if (!tegra->domain) { in tegra_drm_alloc()
1050 alloc = alloc_iova(&tegra->carveout.domain, in tegra_drm_alloc()
1051 size >> tegra->carveout.shift, in tegra_drm_alloc()
1052 tegra->carveout.limit, true); in tegra_drm_alloc()
1058 *dma = iova_dma_addr(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1059 err = iommu_map(tegra->domain, *dma, virt_to_phys(virt), in tegra_drm_alloc()
1067 __free_iova(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1074 void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, in tegra_drm_free() argument
1077 if (tegra->domain) in tegra_drm_free()
1078 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_free()
1082 if (tegra->domain) { in tegra_drm_free()
1083 iommu_unmap(tegra->domain, dma, size); in tegra_drm_free()
1084 free_iova(&tegra->carveout.domain, in tegra_drm_free()
1085 iova_pfn(&tegra->carveout.domain, dma)); in tegra_drm_free()
1143 struct tegra_drm *tegra; in host1x_drm_probe() local
1151 tegra = kzalloc(sizeof(*tegra), GFP_KERNEL); in host1x_drm_probe()
1152 if (!tegra) { in host1x_drm_probe()
1158 tegra->domain = iommu_domain_alloc(&platform_bus_type); in host1x_drm_probe()
1159 if (!tegra->domain) { in host1x_drm_probe()
1169 mutex_init(&tegra->clients_lock); in host1x_drm_probe()
1170 INIT_LIST_HEAD(&tegra->clients); in host1x_drm_probe()
1173 drm->dev_private = tegra; in host1x_drm_probe()
1174 tegra->drm = drm; in host1x_drm_probe()
1203 tegra->hmask = drm->mode_config.max_width - 1; in host1x_drm_probe()
1204 tegra->vmask = drm->mode_config.max_height - 1; in host1x_drm_probe()
1206 if (tegra->use_explicit_iommu) { in host1x_drm_probe()
1212 start = tegra->domain->geometry.aperture_start & dma_mask; in host1x_drm_probe()
1213 end = tegra->domain->geometry.aperture_end & dma_mask; in host1x_drm_probe()
1220 order = __ffs(tegra->domain->pgsize_bitmap); in host1x_drm_probe()
1221 init_iova_domain(&tegra->carveout.domain, 1UL << order, in host1x_drm_probe()
1224 tegra->carveout.shift = iova_shift(&tegra->carveout.domain); in host1x_drm_probe()
1225 tegra->carveout.limit = carveout_end >> tegra->carveout.shift; in host1x_drm_probe()
1227 drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1); in host1x_drm_probe()
1228 mutex_init(&tegra->mm_lock); in host1x_drm_probe()
1234 } else if (tegra->domain) { in host1x_drm_probe()
1235 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1236 tegra->domain = NULL; in host1x_drm_probe()
1240 if (tegra->hub) { in host1x_drm_probe()
1241 err = tegra_display_hub_prepare(tegra->hub); in host1x_drm_probe()
1272 if (tegra->hub) in host1x_drm_probe()
1273 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_probe()
1275 if (tegra->domain) { in host1x_drm_probe()
1276 mutex_destroy(&tegra->mm_lock); in host1x_drm_probe()
1277 drm_mm_takedown(&tegra->mm); in host1x_drm_probe()
1278 put_iova_domain(&tegra->carveout.domain); in host1x_drm_probe()
1289 if (tegra->domain) in host1x_drm_probe()
1290 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1292 kfree(tegra); in host1x_drm_probe()
1301 struct tegra_drm *tegra = drm->dev_private; in host1x_drm_remove() local
1311 if (tegra->hub) in host1x_drm_remove()
1312 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_remove()
1318 if (tegra->domain) { in host1x_drm_remove()
1319 mutex_destroy(&tegra->mm_lock); in host1x_drm_remove()
1320 drm_mm_takedown(&tegra->mm); in host1x_drm_remove()
1321 put_iova_domain(&tegra->carveout.domain); in host1x_drm_remove()
1323 iommu_domain_free(tegra->domain); in host1x_drm_remove()
1326 kfree(tegra); in host1x_drm_remove()