drm/tegra: Use DMA API path for mapping if IOMMU is disabled

If IOMMU is disabled, imported DMA-BUF handles won't get the iova
property set in the BO. As such, we should use the SGT instead,
so use the DMA-API path which works transparently.

Change-Id: Ie79ba859eebc2d4438086cae6a5c00400f04f4b0
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2505464
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Mikko Perttunen
2021-03-25 14:36:49 +02:00
committed by Laxman Dewangan
parent a4cfbdfb2c
commit 1fc707c805

View File

@@ -191,11 +191,12 @@ int tegra_drm_ioctl_channel_map(struct drm_device *drm, void *data,
mapping->dev = ctx->client->base.dev; mapping->dev = ctx->client->base.dev;
mapping->bo = &container_of(gem, struct tegra_bo, gem)->base; mapping->bo = &container_of(gem, struct tegra_bo, gem)->base;
if (!iommu_get_domain_for_dev(mapping->dev) || if (ctx->client->base.group) {
ctx->client->base.group) { /* Domain managed directly */
host1x_bo_pin(mapping->dev, mapping->bo, host1x_bo_pin(mapping->dev, mapping->bo,
&mapping->iova); &mapping->iova);
} else { } else {
/* No IOMMU or DMA API managed domain */
mapping->direction = DMA_TO_DEVICE; mapping->direction = DMA_TO_DEVICE;
if (args->flags & DRM_TEGRA_CHANNEL_MAP_READWRITE) if (args->flags & DRM_TEGRA_CHANNEL_MAP_READWRITE)
mapping->direction = DMA_BIDIRECTIONAL; mapping->direction = DMA_BIDIRECTIONAL;