diff --git a/drivers/misc/mods/Makefile b/drivers/misc/mods/Makefile index 4d9132a0..a01b29d8 100644 --- a/drivers/misc/mods/Makefile +++ b/drivers/misc/mods/Makefile @@ -20,6 +20,7 @@ mods-$(CONFIG_TEGRA_IVC) += mods_bpmpipc.o mods-$(CONFIG_COMMON_CLK) += mods_clock.o mods-$(CONFIG_DEBUG_FS) += mods_debugfs.o mods-$(CONFIG_DMA_ENGINE) += mods_dma.o +mods-$(CONFIG_DMA_SHARED_BUFFER) += mods_dmabuf.o mods-$(CONFIG_ARCH_TEGRA) += mods_ipi.o mods-$(CONFIG_NET) += mods_netdevice.o mods-$(CONFIG_ARCH_TEGRA) += mods_oist.o @@ -33,8 +34,6 @@ mods-$(CONFIG_TRUSTY) += mods_tz.o mods-objs := mods.dtb.o ifneq ($(CONFIG_TEGRA_OOT_MODULE),m) -ccflags-y += -DMODS_HAS_DMABUF ccflags-y += -DMODS_HAS_PROD -mods-$(CONFIG_DMA_SHARED_BUFFER) += mods_dmabuf.o mods-$(CONFIG_ARCH_TEGRA) += mods_tegraprod.o endif diff --git a/drivers/misc/mods/mods_dmabuf.c b/drivers/misc/mods/mods_dmabuf.c index b55ab093..051d1800 100644 --- a/drivers/misc/mods/mods_dmabuf.c +++ b/drivers/misc/mods/mods_dmabuf.c @@ -2,7 +2,7 @@ /* * This file is part of NVIDIA MODS kernel driver. * - * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved. * * NVIDIA MODS kernel driver is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License, @@ -25,6 +25,10 @@ #include "mods_internal.h" +#if KERNEL_VERSION(5, 4, 0) <= MODS_KERNEL_VERSION +MODULE_IMPORT_NS(DMA_BUF); +#endif + static struct device *dummy_device; static bool dummy_device_registered; diff --git a/drivers/misc/mods/mods_internal.h b/drivers/misc/mods/mods_internal.h index a25c8cf7..31b3aa20 100644 --- a/drivers/misc/mods/mods_internal.h +++ b/drivers/misc/mods/mods_internal.h @@ -671,7 +671,7 @@ int esc_mods_net_force_link(struct mods_client *client, struct MODS_NET_DEVICE_NAME *p); #endif -#if defined(MODS_HAS_DMABUF) && defined(CONFIG_DMA_SHARED_BUFFER) +#if defined(MODS_HAS_TEGRA) && defined(CONFIG_DMA_SHARED_BUFFER) int esc_mods_dmabuf_get_phys_addr(struct mods_client *client, struct MODS_DMABUF_GET_PHYSICAL_ADDRESS *p); #else @@ -735,7 +735,7 @@ static inline int mods_create_debugfs(struct miscdevice *modsdev) static inline void mods_remove_debugfs(void) {} #endif /* CONFIG_DEBUG_FS */ -#if defined(MODS_HAS_DMABUF) && defined(CONFIG_DMA_SHARED_BUFFER) +#if defined(MODS_HAS_TEGRA) && defined(CONFIG_DMA_SHARED_BUFFER) int mods_init_dmabuf(void); void mods_exit_dmabuf(void); #else diff --git a/drivers/misc/mods/mods_krnl.c b/drivers/misc/mods/mods_krnl.c index 135d7545..105b1ee4 100644 --- a/drivers/misc/mods/mods_krnl.c +++ b/drivers/misc/mods/mods_krnl.c @@ -2656,7 +2656,7 @@ static long mods_krnl_ioctl(struct file *fp, MODS_FLUSH_CPU_CACHE_RANGE); break; #endif -#if defined(MODS_HAS_DMABUF) +#if defined(MODS_HAS_TEGRA) && defined(CONFIG_DMA_SHARED_BUFFER) case MODS_ESC_DMABUF_GET_PHYSICAL_ADDRESS: MODS_IOCTL(MODS_ESC_DMABUF_GET_PHYSICAL_ADDRESS, esc_mods_dmabuf_get_phys_addr,