From 971645b49cdf63f144eb8d913a911860e2c2920e Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 28 Jul 2023 13:39:29 +0100 Subject: [PATCH] tegra: hwpm: 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: I9de07a4615a6c9da504b36750c48e73e200da301 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2974080 (cherry picked from commit 54ce33447458c8def31a3fb9a77f2a715bc5b869) Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2946966 Reviewed-by: Laxman Dewangan GVS: Gerrit_Virtual_Submit --- drivers/tegra/hwpm/Makefile | 3 ++- drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/tegra/hwpm/Makefile b/drivers/tegra/hwpm/Makefile index 07c0b68..b49e01c 100644 --- a/drivers/tegra/hwpm/Makefile +++ b/drivers/tegra/hwpm/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. # # Tegra SOC HWPM # @@ -25,6 +25,7 @@ ccflags-y += -DCONFIG_TEGRA_HWPM_OOT CONFIG_TEGRA_FUSE_UPSTREAM := y ccflags-y += -DCONFIG_TEGRA_FUSE_UPSTREAM +LINUXINCLUDE += -I$(srctree.nvconftest) LINUXINCLUDE += -I$(srctree.hwpm)/include LINUXINCLUDE += -I$(srctree.hwpm)/drivers/tegra/hwpm/include LINUXINCLUDE += -I$(srctree.hwpm)/drivers/tegra/hwpm diff --git a/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h index e162f41..158f33d 100644 --- a/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h +++ b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h @@ -17,9 +17,11 @@ #ifndef TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H #define TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H +#include + #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) #include #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) @@ -49,7 +51,7 @@ struct tegra_hwpm_mem_mgmt { struct dma_buf *mem_bytes_dma_buf; struct dma_buf_attachment *mem_bytes_attach; void *mem_bytes_kernel; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) +#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT) struct iosys_map mem_bytes_map; #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)