From 1fc707c8054a6d4f6c253db4135a40d93a5dd256 Mon Sep 17 00:00:00 2001 From: Mikko Perttunen Date: Thu, 25 Mar 2021 14:36:49 +0200 Subject: [PATCH] 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 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2505464 Reviewed-by: Jonathan Hunter Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/drm/tegra/uapi/uapi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/uapi/uapi.c b/drivers/gpu/drm/tegra/uapi/uapi.c index e8201d67..7ceea8dd 100644 --- a/drivers/gpu/drm/tegra/uapi/uapi.c +++ b/drivers/gpu/drm/tegra/uapi/uapi.c @@ -191,11 +191,12 @@ int tegra_drm_ioctl_channel_map(struct drm_device *drm, void *data, mapping->dev = ctx->client->base.dev; mapping->bo = &container_of(gem, struct tegra_bo, gem)->base; - if (!iommu_get_domain_for_dev(mapping->dev) || - ctx->client->base.group) { + if (ctx->client->base.group) { + /* Domain managed directly */ host1x_bo_pin(mapping->dev, mapping->bo, &mapping->iova); } else { + /* No IOMMU or DMA API managed domain */ mapping->direction = DMA_TO_DEVICE; if (args->flags & DRM_TEGRA_CHANNEL_MAP_READWRITE) mapping->direction = DMA_BIDIRECTIONAL;