nvmap: Use conftest to find get_rcu_file() argument type

The argument of get_rcu_file() get changed to pointer
type of file handle form Linux 6.7 with
commit 0ede61d8589cc ("file: convert to SLAB_TYPESAFE_BY_RCU").

Use conftest to findout this new argument type.

Bug 4346767

Change-Id: I18943421dd4c2ed4f409ce071b182e68d3d393e6
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028575
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-06 04:43:03 +00:00
committed by mobile promotions
parent 3b457a1293
commit ed5ae591c9
5 changed files with 24 additions and 5 deletions

View File

@@ -80,9 +80,6 @@ subdir-ccflags-y += -DNV_ASOC_XXX_DROP
# drm_debugfs_remove_files has root argument
subdir-ccflags-y += -DNV_DRM_DEBUGFS_REMOVE_HAS_ROOT_ARGS
# get_file_rcu() have change the argument
subdir-ccflags-y += -DNV_GET_FILE_RCU_HAS_PTR_FILE_ARGS
endif
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)

View File

@@ -5,6 +5,8 @@
* Handle allocation and freeing routines for nvmap
*/
#include <nvidia/conftest.h>
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/err.h>
@@ -515,7 +517,7 @@ struct nvmap_handle_ref *nvmap_dup_handle_ro(struct nvmap_client *client,
return ERR_CAST(h->dmabuf_ro);
}
} else {
#if defined(NV_GET_FILE_RCU_HAS_PTR_FILE_ARGS)
#if defined(NV_GET_FILE_RCU_HAS_DOUBLE_PTR_FILE_ARG) /* Linux 6.7 */
if (!get_file_rcu(&h->dmabuf_ro->file)) {
#else
if (!get_file_rcu(h->dmabuf_ro->file)) {

View File

@@ -5,6 +5,8 @@
* mapping between nvmap_hnadle and sci_ipc entery
*/
#include <nvidia/conftest.h>
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/slab.h>
@@ -249,7 +251,7 @@ int nvmap_get_handle_from_sci_ipc_id(struct nvmap_client *client, u32 flags,
goto unlock;
}
} else {
#if defined(NV_GET_FILE_RCU_HAS_PTR_FILE_ARGS)
#if defined(NV_GET_FILE_RCU_HAS_DOUBLE_PTR_FILE_ARG) /* Linux 6.7 */
if (!get_file_rcu(&h->dmabuf_ro->file)) {
#else
if (!get_file_rcu(h->dmabuf_ro->file)) {

View File

@@ -114,6 +114,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_mode_config_struct_has_fb_base_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_scdc_get_set_has_struct_drm_connector_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_coalesce_has_coal_and_extack_args
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_ringparam_has_ringparam_and_extack_args
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_file_rcu_has_double_ptr_file_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg

View File

@@ -2448,6 +2448,23 @@ compile_test() {
compile_check_conftest "$CODE" "NV_PCI_DEV_HAS_ATS_ENABLED" "" "types"
;;
get_file_rcu_has_double_ptr_file_arg)
#
# Determine if the function 'get_file_rcu()' has pointer to pointer of file
# type argument or not.
#
# In Linux v6.7, commit 0ede61d8589cc2 ("file: convert to SLAB_TYPESAFE_BY_RCU")
# changed the argument of file handle to pointer type.
#
CODE="
#include <linux/fs.h>
struct file *conftest_get_file_rcu_has_double_ptr_file_arg(struct file __rcu *f) {
return get_file_rcu(&f);
}"
compile_check_conftest "$CODE" "NV_GET_FILE_RCU_HAS_DOUBLE_PTR_FILE_ARG" "" "types"
;;
get_user_pages)
#
# Conftest for get_user_pages()