Lines Matching full:tegra

29 #define DRIVER_NAME "tegra"
30 #define DRIVER_DESC "NVIDIA Tegra graphics"
74 struct tegra_drm *tegra = drm->dev_private; in tegra_atomic_commit_tail() local
76 if (tegra->hub) { in tegra_atomic_commit_tail()
450 struct tegra_drm *tegra = drm->dev_private; in tegra_open_channel() local
462 list_for_each_entry(client, &tegra->clients, list) in tegra_open_channel()
844 struct tegra_drm *tegra = drm->dev_private; in tegra_debugfs_iova() local
847 if (tegra->domain) { in tegra_debugfs_iova()
848 mutex_lock(&tegra->mm_lock); in tegra_debugfs_iova()
849 drm_mm_print(&tegra->mm, &p); in tegra_debugfs_iova()
850 mutex_unlock(&tegra->mm_lock); in tegra_debugfs_iova()
898 int tegra_drm_register_client(struct tegra_drm *tegra, in tegra_drm_register_client() argument
909 mutex_lock(&tegra->clients_lock); in tegra_drm_register_client()
910 list_add_tail(&client->list, &tegra->clients); in tegra_drm_register_client()
911 client->drm = tegra; in tegra_drm_register_client()
912 mutex_unlock(&tegra->clients_lock); in tegra_drm_register_client()
917 int tegra_drm_unregister_client(struct tegra_drm *tegra, in tegra_drm_unregister_client() argument
920 mutex_lock(&tegra->clients_lock); in tegra_drm_unregister_client()
923 mutex_unlock(&tegra->clients_lock); in tegra_drm_unregister_client()
935 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_attach() local
944 if (domain && domain != tegra->domain) in host1x_client_iommu_attach()
947 if (tegra->domain) { in host1x_client_iommu_attach()
952 if (domain != tegra->domain) { in host1x_client_iommu_attach()
953 err = iommu_attach_group(tegra->domain, group); in host1x_client_iommu_attach()
960 tegra->use_explicit_iommu = true; in host1x_client_iommu_attach()
971 struct tegra_drm *tegra = drm->dev_private; in host1x_client_iommu_detach() local
982 iommu_detach_group(tegra->domain, client->group); in host1x_client_iommu_detach()
989 void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *dma) in tegra_drm_alloc() argument
996 if (tegra->domain) in tegra_drm_alloc()
997 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_alloc()
1002 if (!tegra->domain) { in tegra_drm_alloc()
1016 if (!tegra->domain) { in tegra_drm_alloc()
1025 alloc = alloc_iova(&tegra->carveout.domain, in tegra_drm_alloc()
1026 size >> tegra->carveout.shift, in tegra_drm_alloc()
1027 tegra->carveout.limit, true); in tegra_drm_alloc()
1033 *dma = iova_dma_addr(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1034 err = iommu_map(tegra->domain, *dma, virt_to_phys(virt), in tegra_drm_alloc()
1042 __free_iova(&tegra->carveout.domain, alloc); in tegra_drm_alloc()
1049 void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, in tegra_drm_free() argument
1052 if (tegra->domain) in tegra_drm_free()
1053 size = iova_align(&tegra->carveout.domain, size); in tegra_drm_free()
1057 if (tegra->domain) { in tegra_drm_free()
1058 iommu_unmap(tegra->domain, dma, size); in tegra_drm_free()
1059 free_iova(&tegra->carveout.domain, in tegra_drm_free()
1060 iova_pfn(&tegra->carveout.domain, dma)); in tegra_drm_free()
1072 * If the Tegra DRM clients are backed by an IOMMU, push buffers are in host1x_drm_wants_iommu()
1074 * system memory is available. This is problematic on earlier Tegra in host1x_drm_wants_iommu()
1089 * Work around this by making sure that Tegra DRM clients only use in host1x_drm_wants_iommu()
1114 struct tegra_drm *tegra; in host1x_drm_probe() local
1122 tegra = kzalloc(sizeof(*tegra), GFP_KERNEL); in host1x_drm_probe()
1123 if (!tegra) { in host1x_drm_probe()
1129 tegra->domain = iommu_domain_alloc(&platform_bus_type); in host1x_drm_probe()
1130 if (!tegra->domain) { in host1x_drm_probe()
1140 mutex_init(&tegra->clients_lock); in host1x_drm_probe()
1141 INIT_LIST_HEAD(&tegra->clients); in host1x_drm_probe()
1144 drm->dev_private = tegra; in host1x_drm_probe()
1145 tegra->drm = drm; in host1x_drm_probe()
1174 tegra->hmask = drm->mode_config.max_width - 1; in host1x_drm_probe()
1175 tegra->vmask = drm->mode_config.max_height - 1; in host1x_drm_probe()
1177 if (tegra->use_explicit_iommu) { in host1x_drm_probe()
1183 start = tegra->domain->geometry.aperture_start & dma_mask; in host1x_drm_probe()
1184 end = tegra->domain->geometry.aperture_end & dma_mask; in host1x_drm_probe()
1191 order = __ffs(tegra->domain->pgsize_bitmap); in host1x_drm_probe()
1192 init_iova_domain(&tegra->carveout.domain, 1UL << order, in host1x_drm_probe()
1195 tegra->carveout.shift = iova_shift(&tegra->carveout.domain); in host1x_drm_probe()
1196 tegra->carveout.limit = carveout_end >> tegra->carveout.shift; in host1x_drm_probe()
1198 drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1); in host1x_drm_probe()
1199 mutex_init(&tegra->mm_lock); in host1x_drm_probe()
1205 } else if (tegra->domain) { in host1x_drm_probe()
1206 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1207 tegra->domain = NULL; in host1x_drm_probe()
1211 if (tegra->hub) { in host1x_drm_probe()
1212 err = tegra_display_hub_prepare(tegra->hub); in host1x_drm_probe()
1243 if (tegra->hub) in host1x_drm_probe()
1244 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_probe()
1246 if (tegra->domain) { in host1x_drm_probe()
1247 mutex_destroy(&tegra->mm_lock); in host1x_drm_probe()
1248 drm_mm_takedown(&tegra->mm); in host1x_drm_probe()
1249 put_iova_domain(&tegra->carveout.domain); in host1x_drm_probe()
1260 if (tegra->domain) in host1x_drm_probe()
1261 iommu_domain_free(tegra->domain); in host1x_drm_probe()
1263 kfree(tegra); in host1x_drm_probe()
1272 struct tegra_drm *tegra = drm->dev_private; in host1x_drm_remove() local
1282 if (tegra->hub) in host1x_drm_remove()
1283 tegra_display_hub_cleanup(tegra->hub); in host1x_drm_remove()
1289 if (tegra->domain) { in host1x_drm_remove()
1290 mutex_destroy(&tegra->mm_lock); in host1x_drm_remove()
1291 drm_mm_takedown(&tegra->mm); in host1x_drm_remove()
1292 put_iova_domain(&tegra->carveout.domain); in host1x_drm_remove()
1294 iommu_domain_free(tegra->domain); in host1x_drm_remove()
1297 kfree(tegra); in host1x_drm_remove()
1409 MODULE_DESCRIPTION("NVIDIA Tegra DRM driver");