tegra: hwpm: os: linux: update kernel vers. check

This is needed when building HWPM driver locally without
NVIDIA build system.

- driver.c: use kernel version check to select the correct
  signature of class:devnode
- mem_mgmt_utils.c:
  - use kernel version check to provide correct parameter
    of MODULE_IMPORT_NS macro
  - use kernel version check to select the correct signature
    of get_user_pages function
- mem_mgmt_utils.h: use kernel version check to select
  between iosys-map or dma-buf-map

Bug 5120925

Change-Id: Ib33afc4d99056d5b872f0d4362e0e6c25eb7b64a
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3306471
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Yifei Wan <ywan@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
This commit is contained in:
Besar Wicaksono
2025-02-19 22:18:18 +00:00
committed by mobile promotions
parent 47aa6ea0b9
commit 547508653d
3 changed files with 13 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2021-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
@@ -25,7 +25,8 @@
#include <os/linux/driver.h>
#if defined(NV_MODULE_IMPORT_NS_CALLS_STRINGIFY)
#if defined(NV_MODULE_IMPORT_NS_CALLS_STRINGIFY) || \
LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS(DMA_BUF);
#else
MODULE_IMPORT_NS("DMA_BUF");
@@ -460,7 +461,7 @@ int tegra_hwpm_map_update_allowlist(struct tegra_soc_hwpm *hwpm,
goto fail;
}
#if defined(NV_GET_USER_PAGES_HAS_ARGS_FLAGS) /* Linux v6.5 */
#if defined(NV_GET_USER_PAGES_HAS_ARGS_FLAGS) || LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
pinned_pages = get_user_pages(user_va & PAGE_MASK,
hwpm->alist_map->num_pages, 0, hwpm->alist_map->pages);
#else