diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2017-10-30 10:35:11 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2017-10-30 10:35:11 -0700 |
commit | 3f7787c86b6cb96f4c84f34bc4984e05efc5fe3d (patch) | |
tree | 15b1712316ff557661526148958c5ce9c52349aa | |
parent | c69f1b28da1db961b5240e25ab9ec8a16ce77d2d (diff) |
387.22387.22
-rw-r--r-- | install-from-cwd.c | 29 | ||||
-rw-r--r-- | kernel.c | 17 | ||||
-rw-r--r-- | misc.c | 10 | ||||
-rw-r--r-- | misc.h | 6 | ||||
-rw-r--r-- | nvidia-installer.c | 28 | ||||
-rw-r--r-- | nvidia-installer.h | 1 | ||||
-rw-r--r-- | option_table.h | 5 | ||||
-rw-r--r-- | version.mk | 2 |
8 files changed, 94 insertions, 4 deletions
diff --git a/install-from-cwd.c b/install-from-cwd.c index 43266a1..659d053 100644 --- a/install-from-cwd.c +++ b/install-from-cwd.c @@ -793,6 +793,35 @@ static Package *parse_manifest (Options *op) line++; tmpstr = get_next_line(ptr, &ptr, manifest, len); + + /* + * On Multi-RM builds, build nvidia-frontend and nvidiaX modules. + * On Single-RM builds, build all the modules as specified in + * the '.manifest' file on line 4. + */ + if (is_multi_rm_install(op)) { + char *multi_rm_modules = NULL; + char *tmp_buffer = NULL; + int i; + + multi_rm_modules = nvstrcat("nvidia-frontend ", NULL); + + for (i = 0; i < op->num_rm_instances; i++) { + char *module_name; + + module_name = nvasprintf("nvidia%d ", i); + + tmp_buffer = nvstrcat(multi_rm_modules, module_name, NULL); + nvfree(multi_rm_modules); + nvfree(module_name); + + multi_rm_modules = tmp_buffer; + } + + nvfree(tmpstr); + tmpstr = multi_rm_modules; + } + if (parse_kernel_modules_list(p, tmpstr) == 0) { goto invalid_manifest_file; } @@ -1332,7 +1332,22 @@ int test_kernel_modules(Options *op, Package *p) NULL); const char *module_opts = ""; - if (strcmp(p->kernel_modules[i].module_name, "nvidia") == 0) { + /* + * For Multi-RM, only test load the modules nvidia-frontend.ko and + * nvidia0.ko because the moment you load nvidia0.ko (without the + * NVreg_AssignGpus registry key) it gets attached to all the GPUs in + * the system. Later, when we attempt to load nvidia1.ko, it can't find + * any GPU's left to which it could attach. Hence nvidia_init_module() + * fails to load other nvidiaX modules. + */ + if (is_multi_rm_install(op) && + ((strcmp(p->kernel_modules[i].module_name, "nvidia-frontend") != 0) && + (strcmp(p->kernel_modules[i].module_name, "nvidia0") != 0))) { + continue; + } + + if ((strcmp(p->kernel_modules[i].module_name, "nvidia") == 0) || + (strcmp(p->kernel_modules[i].module_name, "nvidia0") == 0)) { module_opts = "NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=0 " "NVreg_DeviceFileMode=0 NVreg_ModifyDeviceFiles=0"; } @@ -108,7 +108,15 @@ int check_euid(Options *op) } /* check_euid() */ - +/* + * Determine if the installation is Single RM or a multi-RM installation. + * Return TRUE, if it is a multi-RM install, else return FALSE. + */ +int is_multi_rm_install(const Options *op) +{ + return ((op->num_rm_instances > NV_MODULE_INSTANCE_ZERO) && + (op->num_rm_instances <= NV_MAX_MODULE_INSTANCES)); +} /* * adjust_cwd() - this function scans through program_name (ie @@ -31,6 +31,11 @@ #include "command-list.h" #include "user-interface.h" +/* Definitions for Multi-RM build */ +#define NV_MODULE_INSTANCE_NONE -1 +#define NV_MODULE_INSTANCE_ZERO 0 +#define NV_MAX_MODULE_INSTANCES 8 + /* * Enumeration to identify whether the execution of a distro hook script has * succeeded, failed or the script has not actually been executed @@ -53,6 +58,7 @@ typedef enum { char *read_next_word (char *buf, char **e); int check_euid(Options *op); +int is_multi_rm_install(const Options *op); int adjust_cwd(Options *op, const char *program_name); char *get_next_line(char *buf, char **e, char *start, int length); int run_command(Options *op, const char *cmd, char **data, diff --git a/nvidia-installer.c b/nvidia-installer.c index 1e6d6f6..16d7f64 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -133,7 +133,7 @@ static Options *load_default_options(void) op->nvidia_modprobe = TRUE; op->run_nvidia_xconfig = FALSE; op->selinux_option = SELINUX_DEFAULT; - + op->num_rm_instances = NV_MODULE_INSTANCE_NONE; op->sigwinch_workaround = TRUE; op->run_distro_scripts = TRUE; op->no_kernel_module_source = FALSE; @@ -460,6 +460,32 @@ static void parse_commandline(int argc, char *argv[], Options *op) case EGL_EXTERNAL_PLATFORM_CONFIG_FILE_PATH_OPTION: op->external_platform_json_path = strval; break; + case MULTIPLE_KERNEL_MODULES_OPTION: + op->num_rm_instances = intval; + + /* + * Determine if we need to install a multi-RM driver. If the + * argument for '--multiple-kernel-modules' is between 1 and 8, + * then set the environment variable NV_BUILD_MODULE_INSTANCES + * for the RM makefiles and install a multi-RM driver. Otherwise, + * for invalid values of '--multiple-kernel-modules', quit the + * installer. + */ + if (is_multi_rm_install(op)) { + char *num; + + num = nvasprintf("%d", op->num_rm_instances); + setenv("NV_BUILD_MODULE_INSTANCES", num, 1); + nvfree(num); + } else { + nv_error_msg("The '--multiple-kernel-modules' option only " + "accepts values greater than %d and less than or " + "equal to %d.", NV_MODULE_INSTANCE_ZERO, + NV_MAX_MODULE_INSTANCES); + + goto fail; + } + break; default: goto fail; } diff --git a/nvidia-installer.h b/nvidia-installer.h index 932123d..250dc2d 100644 --- a/nvidia-installer.h +++ b/nvidia-installer.h @@ -130,6 +130,7 @@ typedef struct __options { int no_backup; int kernel_module_only; int no_kernel_module; + int num_rm_instances; int no_abi_note; int no_rpms; int no_recursion; diff --git a/option_table.h b/option_table.h index c98b99a..9c0873e 100644 --- a/option_table.h +++ b/option_table.h @@ -105,6 +105,7 @@ enum { GLVND_EGL_CONFIG_FILE_PATH_OPTION, GLVND_EGL_CLIENT_OPTION, EGL_EXTERNAL_PLATFORM_CONFIG_FILE_PATH_OPTION, + MULTIPLE_KERNEL_MODULES_OPTION, }; static const NVGetoptOption __options[] = { @@ -671,6 +672,10 @@ static const NVGetoptOption __options[] = { "Defaults to " DEFAULT_EGL_EXTERNAL_PLATFORM_JSON_PATH "." }, + /* Undocumented options with no help text */ + { "multiple-kernel-modules", MULTIPLE_KERNEL_MODULES_OPTION, + NVGETOPT_INTEGER_ARGUMENT, NULL, NULL}, + /* Orphaned options: These options were in the long_options table in * nvidia-installer.c but not in the help. */ { "debug", 'd', 0, NULL,NULL }, @@ -1 +1 @@ -NVIDIA_VERSION = 387.12 +NVIDIA_VERSION = 387.22 |