Commit 7b17a379 authored by Aaron Plattner's avatar Aaron Plattner

387.12

parent 0a70cd66
......@@ -62,6 +62,9 @@
#define NV_MODESET_MODULE_NAME "nvidia-modeset"
#define NV_NVLINK_MODULE_NAME "nvidia-nvlink"
#define NV_NVLINK_PROC_PERM_PATH "/proc/driver/nvidia-nvlink/permissions"
#define NV_DEVICE_FILE_MODE_MASK (S_IRWXU|S_IRWXG|S_IRWXO)
#define NV_DEVICE_FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
#define NV_DEVICE_FILE_UID 0
......@@ -484,8 +487,8 @@ static void init_device_file_parameters(uid_t *uid, gid_t *gid, mode_t *mode,
* permissions. Returns 1 if the file is successfully created; returns 0
* if the file could not be created.
*/
static int mknod_helper(int major, int minor, const char *path,
const char *proc_path)
int mknod_helper(int major, int minor, const char *path,
const char *proc_path)
{
dev_t dev = NV_MAKE_DEVICE(major, minor);
mode_t mode;
......@@ -602,7 +605,7 @@ int nvidia_mknod(int minor, int module_instance)
* device with the specified name. Returns the major number on success,
* or -1 on failure.
*/
static int get_chardev_major(const char *name)
int get_chardev_major(const char *name)
{
int ret = -1;
char line[NV_MAX_LINE_LENGTH];
......@@ -721,4 +724,22 @@ int nvidia_modeset_mknod(void)
NV_MODESET_DEVICE_NAME, proc_path);
}
/*
* Attempt to create the NVIDIA NVLink driver device file.
*/
int nvidia_nvlink_mknod(void)
{
int major = get_chardev_major(NV_NVLINK_MODULE_NAME);
if (major < 0)
{
return 0;
}
return mknod_helper(major,
0,
NV_NVLINK_DEVICE_NAME,
NV_NVLINK_PROC_PERM_PATH);
}
#endif /* NV_LINUX */
......@@ -42,6 +42,7 @@
#define NV_DEVICE_FILE_PATH "/dev/nvidia%d"
#define NV_CTRL_DEVICE_FILE_PATH "/dev/nvidiactl"
#define NV_MODESET_DEVICE_NAME "/dev/nvidia-modeset"
#define NV_NVLINK_DEVICE_NAME "/dev/nvidia-nvlink"
#define NV_NMODULE_CTRL_DEVICE_FILE_PATH "/dev/nvidiactl%d"
......@@ -58,10 +59,13 @@
int nvidia_modprobe(const int print_errors, int module_instance);
int nvidia_mknod(int minor, int module_instance);
int nvidia_uvm_modprobe(void);
#define nvidia_uvm_modprobe(print_errors) nvidia_uvm_modprobe()
int nvidia_uvm_mknod(int base_minor);
int nvidia_modeset_modprobe(void);
int nvidia_modeset_mknod(void);
int nvidia_nvlink_mknod(void);
int mknod_helper(int major, int minor, const char *path, const char *proc_path);
int get_chardev_major(const char *name);
#endif /* NV_LINUX */
......
......@@ -80,6 +80,7 @@ HOSTNAME_CMD ?= hostname
DATE ?= date
GZIP_CMD ?= gzip
CHMOD ?= chmod
OBJCOPY ?= objcopy
NV_AUTO_DEPEND ?= 1
NV_VERBOSE ?= 0
......@@ -271,10 +272,14 @@ endif
NV_MODULE_LOGGING_NAME ?=
ifeq ($(NV_VERBOSE),0)
quiet_cmd = @$(PRINTF) \
at_if_quiet := @
quiet_cmd_no_at = $(PRINTF) \
" $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ],%s) $(quiet_$(1))\n" \
"$(NV_MODULE_LOGGING_NAME)" && $($(1))
quiet_cmd = @$(quiet_cmd_no_at)
else
at_if_quiet :=
quiet_cmd_no_at = $($(1))
quiet_cmd = $($(1))
endif
......@@ -295,6 +300,8 @@ quiet_HOST_LINK = $(call define_quiet_cmd,HOST_LINK ,$@)
quiet_M4 = $(call define_quiet_cmd,M4 ,$<)
quiet_STRIP_CMD = $(call define_quiet_cmd,STRIP ,$@)
quiet_HARDLINK = $(call define_quiet_cmd,HARDLINK ,$@)
quiet_LD = $(call define_quiet_cmd,LD ,$@)
quiet_OBJCOPY = $(call define_quiet_cmd,OBJCOPY ,$@)
##############################################################################
# Tell gmake to delete the target of a rule if it has changed and its
......@@ -447,3 +454,30 @@ define DEFINE_STAMP_C_RULE
@ $$(PRINTF) "%s\n" "const char *pNV_ID = NV_ID + 11;" >> $$@
endef
##############################################################################
# Define rules that can be used for embedding a file into an ELF object that
# contains the raw contents of that file and symbols pointing to the embedded
# data.
#
# Note that objcopy will name the symbols in the resulting object file based on
# the filename specified in $(1). For example,
#
# $(eval $(call $(READ_ONLY_OBJECT_FROM_FILE_RULE),a/b/c))
#
# will create an object named $(OUTPUTDIR)/c.o with the symbols _binary_c_start,
# _binary_c_end, and _binary_c_size.
#
# Arguments:
# $(1): Path to the file to convert
##############################################################################
define READ_ONLY_OBJECT_FROM_FILE_RULE
$$(OUTPUTDIR)/$$(notdir $(1)).o: $(1)
$(at_if_quiet)cd $$(dir $(1)); \
$$(call quiet_cmd_no_at,LD) -r -z noexecstack --format=binary \
$$(notdir $(1)) -o $$(OUTPUTDIR_ABSOLUTE)/$$(notdir $$@)
$$(call quiet_cmd,OBJCOPY) \
--rename-section .data=.rodata,contents,alloc,load,data,readonly \
$$@
endef
NVIDIA_VERSION = 384.90
NVIDIA_VERSION = 387.12
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment