gpu: nvgpu: 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: I303b1060643b18709a236be5e0268d39cf540054
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2974081
(cherry picked from commit 41c1afb165122e98004005b8513d131b492269e9)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2946965
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2023-07-28 17:16:45 +01:00
committed by mobile promotions
parent 22e1608e72
commit 9fab6f05af
3 changed files with 9 additions and 3 deletions

View File

@@ -54,6 +54,7 @@ endif
# When compiling as OOT module, include the headers from nvidia-oot tree.
ifeq ($(CONFIG_TEGRA_OOT_MODULE),m)
ccflags-y += -I$(srctree.nvconftest)
ccflags-y += -I$(srctree.nvidia)/include
endif

View File

@@ -49,6 +49,7 @@ CONFIG_NVGPU_SUPPORT_GV11B := y
ifeq ($(CONFIG_TEGRA_OOT_MODULE),m)
CONFIG_TEGRA_HOST1X_NEXT := m
CONFIG_TEGRA_NVMAP_NEXT := m
ccflags-y += -DCONFIG_NVIDIA_CONFTEST
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
CONFIG_TEGRA_GR_VIRTUALIZATION := y
ccflags-y += -DCONFIG_TEGRA_GR_VIRTUALIZATION

View File

@@ -14,6 +14,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(CONFIG_NVIDIA_CONFTEST)
#include <nvidia/conftest.h>
#endif
#include <linux/version.h>
#include <linux/device.h>
#include <linux/dma-buf.h>
@@ -25,7 +29,7 @@
#endif
#include <linux/fs.h>
#include <linux/scatterlist.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
#include <linux/iosys-map.h>
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
#include <linux/dma-buf-map.h>
@@ -358,7 +362,7 @@ out:
static void *__gk20a_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};
@@ -386,7 +390,7 @@ void *gk20a_dmabuf_vmap(struct dma_buf *dmabuf)
void gk20a_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);