mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
drm/tegra: move tegra iommu domain support under CONFIG_TEGRA_IOMMU_SMMU
Tegra iommu domain is used in legacy chips (<= T210). Move the related codes under CONFIG_TEGRA_IOMMU_SMMU accordingly. Jira HOSTX-5833 Change-Id: I1e1e1dab33935b8881b905574ee006bbe8fc61d9 Signed-off-by: Santosh BS <santoshb@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3293445 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -1157,6 +1157,7 @@ fput:
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tegra_drm_get_syncpt);
|
EXPORT_SYMBOL_GPL(tegra_drm_get_syncpt);
|
||||||
|
|
||||||
|
#ifdef CONFIG_TEGRA_IOMMU_SMMU
|
||||||
static bool host1x_drm_wants_iommu(struct host1x_device *dev)
|
static bool host1x_drm_wants_iommu(struct host1x_device *dev)
|
||||||
{
|
{
|
||||||
struct host1x *host1x = dev_get_drvdata(dev->dev.parent);
|
struct host1x *host1x = dev_get_drvdata(dev->dev.parent);
|
||||||
@@ -1202,11 +1203,14 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev)
|
|||||||
|
|
||||||
return domain != NULL;
|
return domain != NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int host1x_drm_probe(struct host1x_device *dev)
|
static int host1x_drm_probe(struct host1x_device *dev)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_TEGRA_IOMMU_SMMU
|
||||||
#if defined(NV_IOMMU_PAGING_DOMAIN_ALLOC_PRESENT) /* Linux v6.11 */
|
#if defined(NV_IOMMU_PAGING_DOMAIN_ALLOC_PRESENT) /* Linux v6.11 */
|
||||||
struct device *dma_dev = dev->dev.parent;
|
struct device *dma_dev = dev->dev.parent;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
struct tegra_drm *tegra;
|
struct tegra_drm *tegra;
|
||||||
struct drm_device *drm;
|
struct drm_device *drm;
|
||||||
@@ -1222,6 +1226,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
|
|||||||
goto put;
|
goto put;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_TEGRA_IOMMU_SMMU
|
||||||
#if defined(NV_IOMMU_PAGING_DOMAIN_ALLOC_PRESENT) /* Linux v6.11 */
|
#if defined(NV_IOMMU_PAGING_DOMAIN_ALLOC_PRESENT) /* Linux v6.11 */
|
||||||
if (host1x_drm_wants_iommu(dev) && device_iommu_mapped(dma_dev)) {
|
if (host1x_drm_wants_iommu(dev) && device_iommu_mapped(dma_dev)) {
|
||||||
tegra->domain = iommu_paging_domain_alloc(dma_dev);
|
tegra->domain = iommu_paging_domain_alloc(dma_dev);
|
||||||
@@ -1238,6 +1243,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto domain;
|
goto domain;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mutex_init(&tegra->clients_lock);
|
mutex_init(&tegra->clients_lock);
|
||||||
INIT_LIST_HEAD(&tegra->clients);
|
INIT_LIST_HEAD(&tegra->clients);
|
||||||
@@ -1272,6 +1278,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
|
|||||||
tegra->hmask = drm->mode_config.max_width - 1;
|
tegra->hmask = drm->mode_config.max_width - 1;
|
||||||
tegra->vmask = drm->mode_config.max_height - 1;
|
tegra->vmask = drm->mode_config.max_height - 1;
|
||||||
|
|
||||||
|
#ifdef CONFIG_TEGRA_IOMMU_SMMU
|
||||||
if (tegra->use_explicit_iommu) {
|
if (tegra->use_explicit_iommu) {
|
||||||
u64 carveout_start, carveout_end, gem_start, gem_end;
|
u64 carveout_start, carveout_end, gem_start, gem_end;
|
||||||
u64 dma_mask = dma_get_mask(&dev->dev);
|
u64 dma_mask = dma_get_mask(&dev->dev);
|
||||||
@@ -1305,6 +1312,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
|
|||||||
tegra->domain = NULL;
|
tegra->domain = NULL;
|
||||||
iova_cache_put();
|
iova_cache_put();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY
|
#ifdef CONFIG_DRM_TEGRA_HAVE_DISPLAY
|
||||||
if (tegra->hub) {
|
if (tegra->hub) {
|
||||||
@@ -1360,21 +1368,25 @@ hub:
|
|||||||
tegra_display_hub_cleanup(tegra->hub);
|
tegra_display_hub_cleanup(tegra->hub);
|
||||||
device:
|
device:
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_TEGRA_IOMMU_SMMU
|
||||||
if (tegra->domain) {
|
if (tegra->domain) {
|
||||||
mutex_destroy(&tegra->mm_lock);
|
mutex_destroy(&tegra->mm_lock);
|
||||||
drm_mm_takedown(&tegra->mm);
|
drm_mm_takedown(&tegra->mm);
|
||||||
put_iova_domain(&tegra->carveout.domain);
|
put_iova_domain(&tegra->carveout.domain);
|
||||||
iova_cache_put();
|
iova_cache_put();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
host1x_device_exit(dev);
|
host1x_device_exit(dev);
|
||||||
poll:
|
poll:
|
||||||
drm_kms_helper_poll_fini(drm);
|
drm_kms_helper_poll_fini(drm);
|
||||||
drm_mode_config_cleanup(drm);
|
drm_mode_config_cleanup(drm);
|
||||||
|
#ifdef CONFIG_TEGRA_IOMMU_SMMU
|
||||||
domain:
|
domain:
|
||||||
if (tegra->domain)
|
if (tegra->domain)
|
||||||
iommu_domain_free(tegra->domain);
|
iommu_domain_free(tegra->domain);
|
||||||
free:
|
free:
|
||||||
|
#endif
|
||||||
kfree(tegra);
|
kfree(tegra);
|
||||||
put:
|
put:
|
||||||
drm_dev_put(drm);
|
drm_dev_put(drm);
|
||||||
|
|||||||
Reference in New Issue
Block a user