From c88d7b49ed5bc17530cc51bd100e1bfc8061dc19 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Wed, 6 Apr 2022 19:38:16 +0100 Subject: [PATCH] drm/tegra: Fix build for Linux v5.18 Building the Tegra DRM out-of-tree module with Linux v5.18-rc1 is currently failing because of two changes which are ... 1. Upstream commit 5b529e8d9c38 ("drm/dp: Move public DisplayPort headers into dp/") moves the location of the header drm_dp_helper.h. Fix this by updating the location for Linux v5.18 onwards. 2. Upstream commit 7938f4218168 ("dma-buf-map: Rename to iosys-map") renames 'struct dma_buf_map' to 'struct iosys_map' and so fix this by using the appropriate structure name depending on kernel version. Bug 3598986 Change-Id: Ib6c3326d42fb5e6c74bc74f4d16b136b903ff1b2 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2693912 Reviewed-by: Mikko Perttunen Reviewed-by: svc_kernel_abi GVS: Gerrit_Virtual_Submit --- drivers/gpu/drm/tegra/dp.c | 5 +++++ drivers/gpu/drm/tegra/dpaux.c | 4 ++++ drivers/gpu/drm/tegra/gem.c | 26 ++++++++++++++++++++++---- drivers/gpu/drm/tegra/sor.c | 4 ++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/dp.c b/drivers/gpu/drm/tegra/dp.c index f5535eb0..a895bd79 100644 --- a/drivers/gpu/drm/tegra/dp.c +++ b/drivers/gpu/drm/tegra/dp.c @@ -4,8 +4,13 @@ * Copyright (C) 2015 Rob Clark */ +#include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +#include +#else #include +#endif #include #include "dp.h" diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index df1060af..22791115 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -19,7 +19,11 @@ #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +#include +#else #include +#endif #include #include "dp.h" diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index bc66d966..3922424b 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -177,10 +177,12 @@ static void tegra_bo_unpin(struct host1x_bo_mapping *map) static void *tegra_bo_mmap(struct host1x_bo *bo) { struct tegra_bo *obj = host1x_to_tegra_bo(bo); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + struct iosys_map map; +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) struct dma_buf_map map; - int ret; #endif + int ret; if (obj->vaddr) { return obj->vaddr; @@ -200,7 +202,9 @@ static void *tegra_bo_mmap(struct host1x_bo *bo) static void tegra_bo_munmap(struct host1x_bo *bo, void *addr) { struct tegra_bo *obj = host1x_to_tegra_bo(bo); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) + struct iosys_map map = IOSYS_MAP_INIT_VADDR(addr); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(addr); #endif @@ -718,7 +722,21 @@ static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct *vma) return __tegra_gem_mmap(gem, vma); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +static int tegra_gem_prime_vmap(struct dma_buf *buf, struct iosys_map *map) +{ + struct drm_gem_object *gem = buf->priv; + struct tegra_bo *bo = to_tegra_bo(gem); + + iosys_map_set_vaddr(map, bo->vaddr); + + return 0; +} + +static void tegra_gem_prime_vunmap(struct dma_buf *buf, struct iosys_map *map) +{ +} +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) static int tegra_gem_prime_vmap(struct dma_buf *buf, struct dma_buf_map *map) { struct drm_gem_object *gem = buf->priv; diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index e3e2e868..ca63c3ac 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -19,7 +19,11 @@ #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +#include +#else #include +#endif #include #include #include