Lines Matching full:tegra
36 #define DRIVER_NAME "tegra"
37 #define DRIVER_DESC "NVIDIA Tegra graphics"
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()
908 int tegra_drm_register_client(struct tegra_drm *tegra, in tegra_drm_register_client() argument
919 mutex_lock(&tegra->clients_lock); in tegra_drm_register_client()
920 list_add_tail(&client->list, &tegra->clients); in tegra_drm_register_client()
921 client->drm = tegra; in tegra_drm_register_client()
922 mutex_unlock(&tegra->clients_lock); in tegra_drm_register_client()
927 int tegra_drm_unregister_client(struct tegra_drm *tegra, in tegra_drm_unregister_client() argument
930 mutex_lock(&tegra->clients_lock); in tegra_drm_unregister_client()
933 mutex_unlock(&tegra->clients_lock); in tegra_drm_unregister_client()
945 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_attach() local
966 domain != tegra->domain) in host1x_client_iommu_attach()
969 if (tegra->domain) { in host1x_client_iommu_attach()
974 if (domain != tegra->domain) { in host1x_client_iommu_attach()
975 err = iommu_attach_group(tegra->domain, group); in host1x_client_iommu_attach()
982 tegra->use_explicit_iommu = true; in host1x_client_iommu_attach()
993 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_detach() local
1004 iommu_detach_group(tegra->domain, client->group); in host1x_client_iommu_detach()
1011 void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma) in tegra_drm_alloc() argument
1018 if (tegra->domain) in tegra_drm_alloc()
1019 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_alloc()
1024 if (!tegra->domain) { in tegra_drm_alloc()
1038 if (!tegra->domain) { in tegra_drm_alloc()
1047 alloc = alloc_iova(&tegra->carveout.domain, in tegra_drm_alloc()
1048 size >> tegra->carveout.shift, in tegra_drm_alloc()
1049 tegra->carveout.limit, true); in tegra_drm_alloc()
1055 *dma = iova_dma_addr(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1056 err = iommu_map(tegra->domain, *dma, virt_to_phys(virt), in tegra_drm_alloc()
1064 __free_iova(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1071 void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, in tegra_drm_free() argument
1074 if (tegra->domain) in tegra_drm_free()
1075 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_free()
1079 if (tegra->domain) { in tegra_drm_free()
1080 iommu_unmap(tegra->domain, dma, size); in tegra_drm_free()
1081 free_iova(&tegra->carveout.domain, in tegra_drm_free()
1082 iova_pfn(&tegra->carveout.domain, dma)); in tegra_drm_free()
1098 * If the Tegra DRM clients are backed by an IOMMU, push buffers are in host1x_drm_wants_iommu()
1100 * system memory is available. This is problematic on earlier Tegra in host1x_drm_wants_iommu()
1115 * Work around this by making sure that Tegra DRM clients only use in host1x_drm_wants_iommu()
1141 struct tegra_drm *tegra; in host1x_drm_probe() local
1149 tegra = kzalloc(sizeof(*tegra), GFP_KERNEL); in host1x_drm_probe()
1150 if (!tegra) { in host1x_drm_probe()
1156 tegra->domain = iommu_paging_domain_alloc(dma_dev); in host1x_drm_probe()
1157 if (IS_ERR(tegra->domain)) { in host1x_drm_probe()
1158 err = PTR_ERR(tegra->domain); in host1x_drm_probe()
1167 mutex_init(&tegra->clients_lock); in host1x_drm_probe()
1168 INIT_LIST_HEAD(&tegra->clients); in host1x_drm_probe()
1171 drm->dev_private = tegra; in host1x_drm_probe()
1172 tegra->drm = drm; in host1x_drm_probe()
1197 tegra->hmask = drm->mode_config.max_width - 1; in host1x_drm_probe()
1198 tegra->vmask = drm->mode_config.max_height - 1; in host1x_drm_probe()
1200 if (tegra->use_explicit_iommu) { in host1x_drm_probe()
1206 start = tegra->domain->geometry.aperture_start & dma_mask; in host1x_drm_probe()
1207 end = tegra->domain->geometry.aperture_end & dma_mask; in host1x_drm_probe()
1214 order = __ffs(tegra->domain->pgsize_bitmap); in host1x_drm_probe()
1215 init_iova_domain(&tegra->carveout.domain, 1UL << order, in host1x_drm_probe()
1218 tegra->carveout.shift = iova_shift(&tegra->carveout.domain); in host1x_drm_probe()
1219 tegra->carveout.limit = carveout_end >> tegra->carveout.shift; in host1x_drm_probe()
1221 drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1); in host1x_drm_probe()
1222 mutex_init(&tegra->mm_lock); in host1x_drm_probe()
1228 } else if (tegra->domain) { in host1x_drm_probe()
1229 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1230 tegra->domain = NULL; in host1x_drm_probe()
1234 if (tegra->hub) { in host1x_drm_probe()
1235 err = tegra_display_hub_prepare(tegra->hub); in host1x_drm_probe()
1279 if (tegra->hub) in host1x_drm_probe()
1280 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_probe()
1282 if (tegra->domain) { in host1x_drm_probe()
1283 mutex_destroy(&tegra->mm_lock); in host1x_drm_probe()
1284 drm_mm_takedown(&tegra->mm); in host1x_drm_probe()
1285 put_iova_domain(&tegra->carveout.domain); in host1x_drm_probe()
1294 if (tegra->domain) in host1x_drm_probe()
1295 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1297 kfree(tegra); in host1x_drm_probe()
1306 struct tegra_drm *tegra = drm->dev_private; in host1x_drm_remove() local
1315 if (tegra->hub) in host1x_drm_remove()
1316 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_remove()
1322 if (tegra->domain) { in host1x_drm_remove()
1323 mutex_destroy(&tegra->mm_lock); in host1x_drm_remove()
1324 drm_mm_takedown(&tegra->mm); in host1x_drm_remove()
1325 put_iova_domain(&tegra->carveout.domain); in host1x_drm_remove()
1327 iommu_domain_free(tegra->domain); in host1x_drm_remove()
1330 kfree(tegra); in host1x_drm_remove()
1457 MODULE_DESCRIPTION("NVIDIA Tegra DRM driver");