Lines Matching full:tegra
35 #define DRIVER_NAME "tegra"
36 #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()
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
964 domain != tegra->domain) in host1x_client_iommu_attach()
967 if (tegra->domain) { in host1x_client_iommu_attach()
972 if (domain != tegra->domain) { in host1x_client_iommu_attach()
973 err = iommu_attach_group(tegra->domain, group); in host1x_client_iommu_attach()
980 tegra->use_explicit_iommu = true; in host1x_client_iommu_attach()
991 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_detach() local
1002 iommu_detach_group(tegra->domain, client->group); in host1x_client_iommu_detach()
1009 void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma) in tegra_drm_alloc() argument
1016 if (tegra->domain) in tegra_drm_alloc()
1017 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_alloc()
1022 if (!tegra->domain) { in tegra_drm_alloc()
1036 if (!tegra->domain) { in tegra_drm_alloc()
1045 alloc = alloc_iova(&tegra->carveout.domain, in tegra_drm_alloc()
1046 size >> tegra->carveout.shift, in tegra_drm_alloc()
1047 tegra->carveout.limit, true); in tegra_drm_alloc()
1053 *dma = iova_dma_addr(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1054 err = iommu_map(tegra->domain, *dma, virt_to_phys(virt), in tegra_drm_alloc()
1062 __free_iova(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1069 void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, in tegra_drm_free() argument
1072 if (tegra->domain) in tegra_drm_free()
1073 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_free()
1077 if (tegra->domain) { in tegra_drm_free()
1078 iommu_unmap(tegra->domain, dma, size); in tegra_drm_free()
1079 free_iova(&tegra->carveout.domain, in tegra_drm_free()
1080 iova_pfn(&tegra->carveout.domain, dma)); in tegra_drm_free()
1096 * If the Tegra DRM clients are backed by an IOMMU, push buffers are in host1x_drm_wants_iommu()
1098 * system memory is available. This is problematic on earlier Tegra in host1x_drm_wants_iommu()
1113 * Work around this by making sure that Tegra DRM clients only use in host1x_drm_wants_iommu()
1138 struct tegra_drm *tegra; in host1x_drm_probe() local
1146 tegra = kzalloc(sizeof(*tegra), GFP_KERNEL); in host1x_drm_probe()
1147 if (!tegra) { in host1x_drm_probe()
1153 tegra->domain = iommu_domain_alloc(&platform_bus_type); in host1x_drm_probe()
1154 if (!tegra->domain) { in host1x_drm_probe()
1164 mutex_init(&tegra->clients_lock); in host1x_drm_probe()
1165 INIT_LIST_HEAD(&tegra->clients); in host1x_drm_probe()
1168 drm->dev_private = tegra; in host1x_drm_probe()
1169 tegra->drm = drm; in host1x_drm_probe()
1194 tegra->hmask = drm->mode_config.max_width - 1; in host1x_drm_probe()
1195 tegra->vmask = drm->mode_config.max_height - 1; in host1x_drm_probe()
1197 if (tegra->use_explicit_iommu) { in host1x_drm_probe()
1203 start = tegra->domain->geometry.aperture_start & dma_mask; in host1x_drm_probe()
1204 end = tegra->domain->geometry.aperture_end & dma_mask; in host1x_drm_probe()
1211 order = __ffs(tegra->domain->pgsize_bitmap); in host1x_drm_probe()
1212 init_iova_domain(&tegra->carveout.domain, 1UL << order, in host1x_drm_probe()
1215 tegra->carveout.shift = iova_shift(&tegra->carveout.domain); in host1x_drm_probe()
1216 tegra->carveout.limit = carveout_end >> tegra->carveout.shift; in host1x_drm_probe()
1218 drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1); in host1x_drm_probe()
1219 mutex_init(&tegra->mm_lock); in host1x_drm_probe()
1225 } else if (tegra->domain) { in host1x_drm_probe()
1226 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1227 tegra->domain = NULL; in host1x_drm_probe()
1231 if (tegra->hub) { in host1x_drm_probe()
1232 err = tegra_display_hub_prepare(tegra->hub); in host1x_drm_probe()
1276 if (tegra->hub) in host1x_drm_probe()
1277 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_probe()
1279 if (tegra->domain) { in host1x_drm_probe()
1280 mutex_destroy(&tegra->mm_lock); in host1x_drm_probe()
1281 drm_mm_takedown(&tegra->mm); in host1x_drm_probe()
1282 put_iova_domain(&tegra->carveout.domain); in host1x_drm_probe()
1291 if (tegra->domain) in host1x_drm_probe()
1292 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1294 kfree(tegra); in host1x_drm_probe()
1303 struct tegra_drm *tegra = drm->dev_private; in host1x_drm_remove() local
1312 if (tegra->hub) in host1x_drm_remove()
1313 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_remove()
1319 if (tegra->domain) { in host1x_drm_remove()
1320 mutex_destroy(&tegra->mm_lock); in host1x_drm_remove()
1321 drm_mm_takedown(&tegra->mm); in host1x_drm_remove()
1322 put_iova_domain(&tegra->carveout.domain); in host1x_drm_remove()
1324 iommu_domain_free(tegra->domain); in host1x_drm_remove()
1327 kfree(tegra); in host1x_drm_remove()
1448 MODULE_DESCRIPTION("NVIDIA Tegra DRM driver");