drivers: Add compilation flag for iosys-map.h

Determining whether the header file iosys-map.h is present in the kernel
is currently determine by kernel version. However, for Linux v5.15,
iosys-map.h has been backported in order to support simple-framebuffer
for early display. Therefore, we cannot rely on the kernel version to
indicate whether iosys-map is present. This is also true for 3rd party
Linux kernels that backport changes as well. Fix this by adding a
compile time flag, that will be set accordingly by the conftest script
if this header is present.

Bug 4119327
Bug 4228080

Change-Id: Ibd814285b2a07932ede2fbe9e6dc8fd03039d0c3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971954
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2023-07-28 14:11:20 +01:00
committed by mobile promotions
parent b3b4cf6f51
commit 214beca091
7 changed files with 39 additions and 27 deletions

View File

@@ -10,6 +10,8 @@
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
*/
#include <nvidia/conftest.h>
#include <linux/dma-buf.h>
#include <linux/iommu.h>
#include <linux/module.h>
@@ -178,7 +180,7 @@ 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, 18, 0)
#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
struct iosys_map map = {0};
#else
struct dma_buf_map map = {0};
@@ -199,7 +201,7 @@ 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, 18, 0)
#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
struct iosys_map map = IOSYS_MAP_INIT_VADDR(addr);
#else
struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(addr);
@@ -722,7 +724,7 @@ 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, 18, 0)
#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
static int tegra_gem_prime_vmap(struct dma_buf *buf, struct iosys_map *map)
{
struct drm_gem_object *gem = buf->priv;