diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2017-05-09 07:54:55 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2017-05-09 07:54:55 -0700 |
commit | ef7ebc4ecd67800784fda8c52aeb7e76623d3dc8 (patch) | |
tree | 92b2028f7961c940f3f64b7ee9f7277ca6e583e8 | |
parent | f9efab5470c130489f7af87068db3a9671cc5c92 (diff) |
381.22381.22
-rw-r--r-- | install-from-cwd.c | 35 | ||||
-rw-r--r-- | kernel.c | 26 | ||||
-rw-r--r-- | misc.c | 71 | ||||
-rw-r--r-- | misc.h | 4 | ||||
-rw-r--r-- | nvidia-installer.c | 4 | ||||
-rw-r--r-- | nvidia-installer.h | 2 | ||||
-rw-r--r-- | option_table.h | 9 | ||||
-rw-r--r-- | version.mk | 2 |
8 files changed, 115 insertions, 38 deletions
diff --git a/install-from-cwd.c b/install-from-cwd.c index 47ebdf6..b7b7061 100644 --- a/install-from-cwd.c +++ b/install-from-cwd.c @@ -32,6 +32,7 @@ #include <errno.h> #include <fcntl.h> #include <unistd.h> +#include <stddef.h> #include <sys/mman.h> #include <sys/types.h> @@ -55,6 +56,20 @@ static int install_kernel_modules(Options *op, Package *p); static void free_package(Package *p); static int assisted_module_signing(Options *op, Package *p); +static const KernelModuleInfo optional_modules[] = { + { + .module_name = "nvidia-uvm", + .optional_module_dependee = "CUDA", + .disable_option = "no-unified-memory", + .option_offset = offsetof(Options, install_uvm), + }, + { + .module_name = "nvidia-drm", + .optional_module_dependee = "DRM-KMS", + .disable_option = "no-drm", + .option_offset = offsetof(Options, install_drm), + }, +}; /* * install_from_cwd() - perform an installation from the current @@ -167,9 +182,10 @@ int install_from_cwd(Options *op) if (!check_for_nouveau(op)) goto failed; - /* ask if we should install the UVM kernel module */ + /* ask if we should install the optional kernel modules */ - should_install_uvm(op, p); + should_install_optional_modules(op, p, optional_modules, + ARRAY_LEN(optional_modules)); /* attempt to build the kernel modules for the target kernel */ @@ -622,7 +638,6 @@ static int has_separate_interface_file(char *name) { return TRUE; }; - /* * Populate the module info records for optional records with information * that can be used in e.g. error messages. @@ -631,19 +646,13 @@ static void populate_optional_module_info(KernelModuleInfo *module) { int i; - static struct { - const char *name; - char * const dependee; - char * const disable_option; - } optional_modules[] = { - { "nvidia-uvm", "CUDA", "no-unified-memory" }, - }; - for (i = 0; i < ARRAY_LEN(optional_modules); i++) { - if (strcmp(optional_modules[i].name, module->module_name) == 0) { + if (strcmp(optional_modules[i].module_name, module->module_name) == 0) { module->is_optional = TRUE; - module->optional_module_dependee = optional_modules[i].dependee; + module->optional_module_dependee = + optional_modules[i].optional_module_dependee; module->disable_option = optional_modules[i].disable_option; + module->option_offset = optional_modules[i].option_offset; return; } } @@ -71,7 +71,7 @@ static int init_libkmod(void); static void close_libkmod(void); static int run_conftest(Options *op, const char *dir, const char *args, char **result); -static int run_make(Options *op, Package *p, char *dir, const char *target, +static int run_make(Options *op, Package *p, const char *dir, const char *target, char **vars, const char *status, int lines); static void load_kernel_module_quiet(Options *op, const char *module_name); static void modprobe_remove_kernel_module_quiet(Options *op, const char *name); @@ -572,13 +572,31 @@ int unpack_kernel_modules(Options *op, Package *p, const char *build_directory, } -static int check_file(Options *op, const char *dir, const char *modname) +static int check_file(Options *op, Package *p, const char *dir, + const char *modname) { int ret; char *path; path = nvstrcat(dir, "/", modname, ".ko", NULL); ret = access(path, F_OK); + + if (ret == -1) { + char *single_module_list = nvstrcat("NV_KERNEL_MODULES=\"", modname, + "\"", NULL); + char *rebuild_msg = nvstrcat("Checking to see whether the ", modname, + " kernel module was successfully built", + NULL); + /* Attempt to rebuild the individual module, in case the failure + * is module-specific and due to a different module */ + run_make(op, p, dir, single_module_list, NULL, rebuild_msg, 25); + nvfree(single_module_list); + nvfree(rebuild_msg); + + /* Check the file again */ + ret = access(path, F_OK); + } + nvfree(path); if (ret == -1) { @@ -933,7 +951,7 @@ int build_kernel_interfaces(Options *op, Package *p, /* Test to make sure that all kernel modules were built. */ for (i = 0; i < p->num_kernel_modules; i++) { - if (!check_file(op, builddir, p->kernel_modules[i].module_name)) { + if (!check_file(op, p, builddir, p->kernel_modules[i].module_name)) { handle_optional_module_failure(op, p->kernel_modules[i], ui_error, "build"); @@ -2543,7 +2561,7 @@ char *get_machine_arch(Options *op) * using 'status' as the initial message, expecting 'lines' lines of output * from the make command. */ -static int run_make(Options *op, Package *p, char *dir, const char *target, +static int run_make(Options *op, Package *p, const char *dir, const char *target, char **vars, const char *status, int lines) { char *cmd, *concurrency, *data = NULL; int i = 0, ret; @@ -1158,34 +1158,67 @@ void should_install_compat32_files(Options *op, Package *p) } +#define member_at_offset(base, offset, target_type) \ + ((target_type *) ((char *) base + offset)) + + +static void set_optional_module_install(Options *op, int offset, int val) { + *member_at_offset(op, offset, int) = val; +} + +static int get_optional_module_install(Options *op, int offset) { + return *member_at_offset(op, offset, int); +} + /* - * should_install_uvm() - ask the user if he/she wishes to install UVM + * should_install_optional_modules() - ask the user if he/she wishes to install + * optional kernel modules */ -void should_install_uvm(Options *op, Package *p) +void should_install_optional_modules(Options *op, Package *p, + const KernelModuleInfo* optional_modules, + int num_optional_modules) { - /* if the package does not include UVM, it can't be installed. */ + int i; - if (!package_includes_kernel_module(p, "nvidia-uvm")) { - op->install_uvm = FALSE; - return; - } + for (i = 0; i < num_optional_modules; i++) { + int install = get_optional_module_install(op, + optional_modules[i].option_offset); - /* ask expert users whether they want to install UVM */ + /* if the package doesn't include the module, it can't be installed. */ - if (op->expert) { - op->install_uvm = ui_yes_no(op, op->install_uvm, "Would you like to " - "install the NVIDIA Unified Memory kernel " - "module? You must install this module in " - "order to use CUDA."); - } + if (!package_includes_kernel_module(p, + optional_modules[i].module_name)) { + set_optional_module_install(op, optional_modules[i].option_offset, + FALSE); + continue; + } - if (!op->install_uvm) { - ui_warn(op, "The NVIDIA Unified Memory kernel module will not be " - "installed. As a result, CUDA applications will not be able to " - "run with this installation of the NVIDIA driver."); + /* ask expert users whether they want to install the module */ + + if (op->expert) { + int default_value = install; + install = ui_yes_no(op, default_value, "Would you like to install " + "the %s kernel module? You must install " + "this module in order to use %s.", + optional_modules[i].module_name, + optional_modules[i].optional_module_dependee); + if (install != default_value) { + set_optional_module_install(op, + optional_modules[i].option_offset, + install); + } + } - remove_kernel_module_from_package(p, "nvidia-uvm"); + if (!install) { + ui_warn(op, "The %s module will not be installed. As a result, %s " + "will not function with this installation of the NVIDIA " + "driver.", optional_modules[i].module_name, + optional_modules[i].optional_module_dependee); + + remove_kernel_module_from_package(p, + optional_modules[i].module_name); + } } } @@ -70,7 +70,9 @@ int continue_after_error(Options *op, const char *fmt, ...) NV_ATTRIBUTE_PRINTF( int do_install(Options *op, Package *p, CommandList *c); void should_install_opengl_headers(Options *op, Package *p); void should_install_compat32_files(Options *op, Package *p); -void should_install_uvm(Options *op, Package *p); +void should_install_optional_modules(Options *op, Package *p, + const KernelModuleInfo *optional_modules, + int num_optional_modules); void check_installed_files_from_package(Options *op, Package *p); int check_installed_file(Options*, const char*, const mode_t, const uint32, ui_message_func *logwarn); diff --git a/nvidia-installer.c b/nvidia-installer.c index 66fbdba..f58bca5 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -142,6 +142,7 @@ static Options *load_default_options(void) op->dkms = FALSE; op->check_for_alternate_installs = TRUE; op->install_uvm = TRUE; + op->install_drm = TRUE; op->glvnd_glx_client = TRUE; op->glvnd_egl_client = TRUE; op->install_compat32_libs = NV_OPTIONAL_BOOL_DEFAULT; @@ -438,6 +439,9 @@ static void parse_commandline(int argc, char *argv[], Options *op) case NO_UVM_OPTION: op->install_uvm = FALSE; break; + case NO_DRM_OPTION: + op->install_drm = FALSE; + break; case NO_CHECK_FOR_ALTERNATE_INSTALLS_OPTION: op->check_for_alternate_installs = FALSE; break; diff --git a/nvidia-installer.h b/nvidia-installer.h index 6f66466..4116e3e 100644 --- a/nvidia-installer.h +++ b/nvidia-installer.h @@ -152,6 +152,7 @@ typedef struct __options { int dkms; int check_for_alternate_installs; int install_uvm; + int install_drm; int compat32_files_packaged; int x_files_packaged; int concurrency_level; @@ -427,6 +428,7 @@ typedef struct { int is_optional; /* e.g. TRUE for "nvidia-uvm" */ char *optional_module_dependee; /* e.g. "CUDA" for "nvidia-uvm" */ char *disable_option; /* e.g. "--no-unified-memory" */ + int option_offset; /* offset in Options struct for option */ } KernelModuleInfo; diff --git a/option_table.h b/option_table.h index 51824f7..4ebd984 100644 --- a/option_table.h +++ b/option_table.h @@ -95,6 +95,7 @@ enum { INSTALL_VDPAU_WRAPPER_OPTION, NO_CHECK_FOR_ALTERNATE_INSTALLS_OPTION, NO_UVM_OPTION, + NO_DRM_OPTION, INSTALL_COMPAT32_LIBS_OPTION, X_SYSCONFIG_PATH_OPTION, FORCE_LIBGLX_INDIRECT, @@ -642,6 +643,14 @@ static const NVGetoptOption __options[] = { "around failures to build or install the Unified Memory kernel module on " "systems that do not need to run CUDA." }, + { "no-drm", NO_DRM_OPTION, 0, NULL, + "Do not install the nvidia-drm kernel module. This kernel module " + "provides several features, including X11 autoconfiguration, support for " + "PRIME, and DRM-KMS. The latter is used to support modesetting on " + "windowing systems that run independently of X11. The '--no-drm' option " + "should only be used to work around failures to build or install the " + "nvidia-drm kernel module on systems that do not need these features." }, + { "concurrency-level", 'j', NVGETOPT_INTEGER_ARGUMENT, NULL, "Set the concurrency level for operations such as building the kernel " "module which may be parallelized on SMP systems. By default, this will " @@ -1 +1 @@ -NVIDIA_VERSION = 381.09 +NVIDIA_VERSION = 381.22 |