nvmap: Pass proper argument for get_file_rcu() for Linux 6.7

The function get_file_rcu() has modification in its
argument to take the pointer to pointer of file from
Linux 6.7 from below change
***
commit 0ede61d8589cc2d93aa78230d74ac58b5b8d0244
Author: Christian Brauner <brauner@kernel.org>

    file: convert to SLAB_TYPESAFE_BY_RCU
***

Add support for Linux 6.7.

Bug 4346767

Change-Id: I1e2e005900c7d2c57ac487b5f6ac5e1fcbfbafe7
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020000
(cherry picked from commit 4ef0a332e8)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036791
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-11-21 16:06:59 +00:00
committed by mobile promotions
parent efbbf91f79
commit b5178e70d8
3 changed files with 14 additions and 0 deletions

View File

@@ -53,6 +53,12 @@ subdir-ccflags-y += -DNV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME
export CONFIG_SKIP_CRYPTO=y export CONFIG_SKIP_CRYPTO=y
endif endif
# Changes done in Linux 6.7 onwards
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_7); echo $$?),0)
# get_file_rcu() have change the argument
subdir-ccflags-y += -DNV_GET_FILE_RCU_HAS_PTR_FILE_ARGS
endif
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y) ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION
endif endif

View File

@@ -515,7 +515,11 @@ struct nvmap_handle_ref *nvmap_dup_handle_ro(struct nvmap_client *client,
return ERR_CAST(h->dmabuf_ro); return ERR_CAST(h->dmabuf_ro);
} }
} else { } else {
#if defined(NV_GET_FILE_RCU_HAS_PTR_FILE_ARGS)
if (!get_file_rcu(&h->dmabuf_ro->file)) {
#else
if (!get_file_rcu(h->dmabuf_ro->file)) { if (!get_file_rcu(h->dmabuf_ro->file)) {
#endif
mutex_unlock(&h->lock); mutex_unlock(&h->lock);
remain = wait_event_interruptible_timeout(h->waitq, remain = wait_event_interruptible_timeout(h->waitq,
!h->dmabuf_ro, (long)msecs_to_jiffies(100U)); !h->dmabuf_ro, (long)msecs_to_jiffies(100U));

View File

@@ -249,7 +249,11 @@ int nvmap_get_handle_from_sci_ipc_id(struct nvmap_client *client, u32 flags,
goto unlock; goto unlock;
} }
} else { } else {
#if defined(NV_GET_FILE_RCU_HAS_PTR_FILE_ARGS)
if (!get_file_rcu(&h->dmabuf_ro->file)) {
#else
if (!get_file_rcu(h->dmabuf_ro->file)) { if (!get_file_rcu(h->dmabuf_ro->file)) {
#endif
mutex_unlock(&h->lock); mutex_unlock(&h->lock);
remain = wait_event_interruptible_timeout(h->waitq, remain = wait_event_interruptible_timeout(h->waitq,
!h->dmabuf_ro, (long)msecs_to_jiffies(100U)); !h->dmabuf_ro, (long)msecs_to_jiffies(100U));