diff --git a/Makefile b/Makefile index 3a4090fc..c7a56120 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. +LINUXINCLUDE += -I$(srctree.nvconftest) LINUXINCLUDE += -I$(srctree.nvidia-oot)/include subdir-ccflags-y += -Werror diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index d960aff9..e7fa3eb9 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -10,6 +10,8 @@ * Copyright (c) 2011 Samsung Electronics Co., Ltd. */ +#include + #include #include #include @@ -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; diff --git a/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c b/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c index 8cbc0f9d..9a80e535 100644 --- a/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c +++ b/drivers/media/platform/tegra/camera/fusa-capture/capture-common.c @@ -8,6 +8,8 @@ * platform. */ +#include + #include #include #include @@ -526,10 +528,10 @@ int capture_common_setup_progress_status_notifier( uint32_t mem_offset) { struct dma_buf *dmabuf; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) - struct dma_buf_map map = {0}; -#else +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) struct iosys_map map = {0}; +#else + struct dma_buf_map map = {0}; #endif void *va; int err = 0; @@ -573,10 +575,10 @@ int capture_common_release_progress_status_notifier( { struct dma_buf *dmabuf = progress_status_notifier->buf; void *va = progress_status_notifier->va; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) - struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(va); -#else +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) struct iosys_map map = IOSYS_MAP_INIT_VADDR(va); +#else + struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(va); #endif if (dmabuf != NULL) { @@ -629,10 +631,10 @@ int capture_common_pin_memory( struct capture_common_buf *unpin_data) { struct dma_buf *buf; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) - struct dma_buf_map map = {0}; -#else +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) struct iosys_map map = {0}; +#else + struct dma_buf_map map = {0}; #endif struct dma_buf_attachment *attach; struct sg_table *sgt; @@ -682,10 +684,10 @@ EXPORT_SYMBOL_GPL(capture_common_pin_memory); void capture_common_unpin_memory( struct capture_common_buf *unpin_data) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) - struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(unpin_data->va); -#else +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) struct iosys_map map = IOSYS_MAP_INIT_VADDR(unpin_data->va); +#else + struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(unpin_data->va); #endif if (unpin_data->va) diff --git a/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c b/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c index baa05a7f..717cf76a 100644 --- a/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c +++ b/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c @@ -7,6 +7,8 @@ * @brief ISP channel operations for the T186/T194 Camera RTCPU platform. */ +#include + #include #include #include @@ -341,10 +343,10 @@ static int isp_capture_setup_inputfences( void *reloc_page_addr = NULL; struct isp_capture *capture = chan->capture_data; void *vmap_base = NULL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) - struct dma_buf_map map; -#else +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) struct iosys_map map; +#else + struct dma_buf_map map; #endif int i = 0; int err = 0; @@ -427,10 +429,10 @@ static int isp_capture_setup_prefences( void *reloc_page_addr = NULL; struct isp_capture *capture = chan->capture_data; void *vmap_base = NULL; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) - struct dma_buf_map map; -#else +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) struct iosys_map map; +#else + struct dma_buf_map map; #endif /* It is valid not to have prefences for given frame capture */ diff --git a/drivers/video/tegra/host/pva/pva_queue.c b/drivers/video/tegra/host/pva/pva_queue.c index a1c92f13..f79fa2ca 100644 --- a/drivers/video/tegra/host/pva/pva_queue.c +++ b/drivers/video/tegra/host/pva/pva_queue.c @@ -3,6 +3,8 @@ * Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved. */ +#include + #include #include #include @@ -48,7 +50,7 @@ void *pva_dmabuf_vmap(struct dma_buf *dmabuf) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) -#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}; @@ -67,7 +69,7 @@ void *pva_dmabuf_vmap(struct dma_buf *dmabuf) void pva_dmabuf_vunmap(struct dma_buf *dmabuf, void *addr) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) -#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); diff --git a/drivers/video/tegra/nvmap/nvmap_dmabuf.c b/drivers/video/tegra/nvmap/nvmap_dmabuf.c index bf66347c..31232523 100644 --- a/drivers/video/tegra/nvmap/nvmap_dmabuf.c +++ b/drivers/video/tegra/nvmap/nvmap_dmabuf.c @@ -7,6 +7,8 @@ #define pr_fmt(fmt) "nvmap: %s() " fmt, __func__ +#include + #include #include #include @@ -22,7 +24,7 @@ #include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) #include #endif @@ -499,7 +501,7 @@ static void nvmap_dmabuf_vunmap(struct dma_buf *dmabuf, void *vaddr) __nvmap_munmap(info->handle, vaddr); } #else -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) static int nvmap_dmabuf_vmap(struct dma_buf *dmabuf, struct iosys_map *map) #else static int nvmap_dmabuf_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map) @@ -526,7 +528,7 @@ static int nvmap_dmabuf_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map) return ret; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) static void nvmap_dmabuf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map) #else static void nvmap_dmabuf_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map) diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 5ec00fc3..feaa2a27 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -106,7 +106,8 @@ $(obj)/conftest/patches.h: $(NV_CONFTEST_SCRIPT) # corresponding #define will be generated in conftest/headers.h. NV_HEADER_PRESENCE_TESTS = \ generated/autoconf.h \ - linux/kconfig.h + linux/kconfig.h \ + linux/iosys-map.h # Filename to store the define for the header in $(1); this is only consumed by # the rule below that concatenates all of these together.