mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: unit: add --driver-load-path arg
Add --driver-load-path option to specify which library to
load for driver.
There is already an --unit-load-path option that can be
used to specify where to load units from.
Example usage:
./nvgpu_unit --nvtest --unit-load-path units/dgpu \
--no-color --num-threads 1 \
--driver-load-path ./libnvgpu-drv-dgpu.so
Jira NVGPU-5217
Change-Id: I6af5d2029138b25a6715154779b812d30052e9e9
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2333498
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Alex Waterman
parent
88d3640bc5
commit
80285be2da
@@ -31,6 +31,11 @@
|
|||||||
#define __stringify(x) #x
|
#define __stringify(x) #x
|
||||||
#define stringify(x) __stringify(x)
|
#define stringify(x) __stringify(x)
|
||||||
|
|
||||||
|
#ifndef __DEFAULT_ARG_DRIVER_LOAD_PATH
|
||||||
|
#define __DEFAULT_ARG_DRIVER_LOAD_PATH ./libnvgpu-drv.so
|
||||||
|
#endif
|
||||||
|
#define DEFAULT_ARG_DRIVER_LOAD_PATH stringify(__DEFAULT_ARG_DRIVER_LOAD_PATH)
|
||||||
|
|
||||||
#ifndef __DEFAULT_ARG_UNIT_LOAD_PATH
|
#ifndef __DEFAULT_ARG_UNIT_LOAD_PATH
|
||||||
#define __DEFAULT_ARG_UNIT_LOAD_PATH build/units
|
#define __DEFAULT_ARG_UNIT_LOAD_PATH build/units
|
||||||
#endif
|
#endif
|
||||||
@@ -50,6 +55,8 @@ struct unit_fw_args {
|
|||||||
bool debug;
|
bool debug;
|
||||||
const char *binary_name;
|
const char *binary_name;
|
||||||
|
|
||||||
|
const char *driver_load_path;
|
||||||
|
|
||||||
const char *unit_name;
|
const char *unit_name;
|
||||||
const char *unit_load_path;
|
const char *unit_load_path;
|
||||||
const char *unit_to_run;
|
const char *unit_to_run;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ struct unit_fw {
|
|||||||
struct unit_results *results;
|
struct unit_results *results;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nvgpu-drv interface. Currently the only two directly referenced
|
* driver library interface. Currently the only two directly referenced
|
||||||
* functions are:
|
* functions are:
|
||||||
*
|
*
|
||||||
* nvgpu_posix_probe()
|
* nvgpu_posix_probe()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -37,6 +37,7 @@ static struct option core_opts[] = {
|
|||||||
{ "nvtest", 0, NULL, 'n' },
|
{ "nvtest", 0, NULL, 'n' },
|
||||||
{ "is-qnx", 0, NULL, 'Q' },
|
{ "is-qnx", 0, NULL, 'Q' },
|
||||||
{ "unit-load-path", 1, NULL, 'L' },
|
{ "unit-load-path", 1, NULL, 'L' },
|
||||||
|
{ "driver-load-path", 1, NULL, 'K' },
|
||||||
{ "num-threads", 1, NULL, 'j' },
|
{ "num-threads", 1, NULL, 'j' },
|
||||||
{ "test-level", 1, NULL, 't' },
|
{ "test-level", 1, NULL, 't' },
|
||||||
{ "debug", 0, NULL, 'd' },
|
{ "debug", 0, NULL, 'd' },
|
||||||
@@ -44,7 +45,7 @@ static struct option core_opts[] = {
|
|||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *core_opts_str = "hvqCnQL:j:t:dr:";
|
static const char *core_opts_str = "hvqCnQL:K:j:t:dr:";
|
||||||
|
|
||||||
void core_print_help(struct unit_fw *fw)
|
void core_print_help(struct unit_fw *fw)
|
||||||
{
|
{
|
||||||
@@ -69,6 +70,8 @@ void core_print_help(struct unit_fw *fw)
|
|||||||
" -Q, --is-qnx QNX specific tests\n",
|
" -Q, --is-qnx QNX specific tests\n",
|
||||||
" -L, --unit-load-path <PATH>\n",
|
" -L, --unit-load-path <PATH>\n",
|
||||||
" Path to where the unit test libraries reside.\n",
|
" Path to where the unit test libraries reside.\n",
|
||||||
|
" -K, --driver-load-path <PATH>\n",
|
||||||
|
" Path to driver library.\n",
|
||||||
" -j, --num-threads <COUNT>\n",
|
" -j, --num-threads <COUNT>\n",
|
||||||
" Number of threads to use while running all tests.\n",
|
" Number of threads to use while running all tests.\n",
|
||||||
" -t, --test-level <LEVEL>\n",
|
" -t, --test-level <LEVEL>\n",
|
||||||
@@ -92,6 +95,7 @@ NULL
|
|||||||
|
|
||||||
static void set_arg_defaults(struct unit_fw_args *args)
|
static void set_arg_defaults(struct unit_fw_args *args)
|
||||||
{
|
{
|
||||||
|
args->driver_load_path = DEFAULT_ARG_DRIVER_LOAD_PATH;
|
||||||
args->unit_load_path = DEFAULT_ARG_UNIT_LOAD_PATH;
|
args->unit_load_path = DEFAULT_ARG_UNIT_LOAD_PATH;
|
||||||
args->thread_count = 1;
|
args->thread_count = 1;
|
||||||
args->test_lvl = TEST_PLAN_MAX;
|
args->test_lvl = TEST_PLAN_MAX;
|
||||||
@@ -150,6 +154,9 @@ int core_parse_args(struct unit_fw *fw, int argc, char **argv)
|
|||||||
case 'L':
|
case 'L':
|
||||||
args->unit_load_path = optarg;
|
args->unit_load_path = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'K':
|
||||||
|
args->driver_load_path = optarg;
|
||||||
|
break;
|
||||||
case 'j':
|
case 'j':
|
||||||
args->thread_count = strtol(optarg, NULL, 10);
|
args->thread_count = strtol(optarg, NULL, 10);
|
||||||
if (args->thread_count == 0) {
|
if (args->thread_count == 0) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <unit/core.h>
|
#include <unit/core.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load libnvgpu-drv.so. This is done with dlopen() since this will make
|
* Load driver library. This is done with dlopen() since this will make
|
||||||
* resolving addresses into symbols easier in the future.
|
* resolving addresses into symbols easier in the future.
|
||||||
*
|
*
|
||||||
* Also, this makes people think carefully about what functions to call in
|
* Also, this makes people think carefully about what functions to call in
|
||||||
@@ -38,6 +38,7 @@ int core_load_nvgpu(struct unit_fw *fw)
|
|||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
int flag = RTLD_NOW;
|
int flag = RTLD_NOW;
|
||||||
|
const char *load_path = args(fw)->driver_load_path;
|
||||||
|
|
||||||
if (fw->args->is_qnx == 0) {
|
if (fw->args->is_qnx == 0) {
|
||||||
/*
|
/*
|
||||||
@@ -51,11 +52,11 @@ int core_load_nvgpu(struct unit_fw *fw)
|
|||||||
|
|
||||||
/* TODO: WAR: remove this dependency of libnvgpu-drv.so for qnx unit
|
/* TODO: WAR: remove this dependency of libnvgpu-drv.so for qnx unit
|
||||||
* test, refer NVGPU-1935 for more detail */
|
* test, refer NVGPU-1935 for more detail */
|
||||||
fw->nvgpu_so = dlopen("libnvgpu-drv.so", flag);
|
fw->nvgpu_so = dlopen(load_path, flag);
|
||||||
|
|
||||||
if (fw->nvgpu_so == NULL) {
|
if (fw->nvgpu_so == NULL) {
|
||||||
msg = dlerror();
|
msg = dlerror();
|
||||||
core_err(fw, "Failed to load nvgpu-drv: %s\n", msg);
|
core_err(fw, "Failed to load %s: %s\n", load_path, msg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,10 +92,10 @@ int core_load_nvgpu(struct unit_fw *fw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fw->args->is_qnx != 0) {
|
if (fw->args->is_qnx != 0) {
|
||||||
fw->nvgpu_qnx_ut = dlopen("libnvgpu_ut.so", flag);
|
fw->nvgpu_qnx_ut = dlopen("libnvgpu_ut_igpu.so", flag);
|
||||||
if (fw->nvgpu_qnx_ut == NULL) {
|
if (fw->nvgpu_qnx_ut == NULL) {
|
||||||
msg = dlerror();
|
msg = dlerror();
|
||||||
core_err(fw, "Failed to load nvgpu_ut: %s\n", msg);
|
core_err(fw, "Failed to load nvgpu_ut_igpu: %s\n", msg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fw->nvgpu.nvgpu_posix_init_fault_injection_qnx =
|
fw->nvgpu.nvgpu_posix_init_fault_injection_qnx =
|
||||||
|
|||||||
Reference in New Issue
Block a user