From 8057298353bed045f1cc1a4cfbb81de22fba3ceb Mon Sep 17 00:00:00 2001 From: Christopher Desiniotis Date: Thu, 11 Apr 2024 15:00:42 -0700 Subject: [PATCH] [vgpu-manager] update firmware search path This allows the nvidia kernel module to properly find the path to the GSP firmware files that are installed in the driver container. Signed-off-by: Christopher Desiniotis --- vgpu-manager/rhel8/nvidia-driver | 16 +++++++++++++++- vgpu-manager/ubuntu20.04/nvidia-driver | 15 +++++++++++++++ vgpu-manager/ubuntu22.04/nvidia-driver | 15 +++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/vgpu-manager/rhel8/nvidia-driver b/vgpu-manager/rhel8/nvidia-driver index 02e229ce..81cc1594 100755 --- a/vgpu-manager/rhel8/nvidia-driver +++ b/vgpu-manager/rhel8/nvidia-driver @@ -38,6 +38,20 @@ _create_dev_char_directory() { fi } +_set_fw_search_path() { + local nv_fw_search_path="$RUN_DIR/driver/lib/firmware" + local fw_path_config_file="/sys/module/firmware_class/parameters/path" + + if [[ ! -z $(grep '[^[:space:]]' $fw_path_config_file) ]]; then + echo "WARNING: A search path is already configured in $fw_path_config_file" + echo " Retaining the current configuration. Note, GSP firmware may not be found and thus won't be used by the NVIDIA driver." + return + fi + + echo "Configuring the following firmware search path in '$fw_path_config_file': $nv_fw_search_path" + echo -n "$nv_fw_search_path" > $fw_path_config_file +} + _install_driver() { local tmp_dir=$(mktemp -d) @@ -165,8 +179,8 @@ init() { exit 1 fi _unmount_rootfs - _create_dev_char_directory + _set_fw_search_path _install_driver _load_driver || exit 1 _mount_rootfs diff --git a/vgpu-manager/ubuntu20.04/nvidia-driver b/vgpu-manager/ubuntu20.04/nvidia-driver index e841d59e..64cf59b9 100755 --- a/vgpu-manager/ubuntu20.04/nvidia-driver +++ b/vgpu-manager/ubuntu20.04/nvidia-driver @@ -112,6 +112,20 @@ _create_dev_char_directory() { fi } +_set_fw_search_path() { + local nv_fw_search_path="$RUN_DIR/driver/lib/firmware" + local fw_path_config_file="/sys/module/firmware_class/parameters/path" + + if [[ ! -z $(grep '[^[:space:]]' $fw_path_config_file) ]]; then + echo "WARNING: A search path is already configured in $fw_path_config_file" + echo " Retaining the current configuration. Note, GSP firmware may not be found and thus won't be used by the NVIDIA driver." + return + fi + + echo "Configuring the following firmware search path in '$fw_path_config_file': $nv_fw_search_path" + echo -n "$nv_fw_search_path" > $fw_path_config_file +} + _install_driver() { local tmp_dir=$(mktemp -d) @@ -244,6 +258,7 @@ init() { _resolve_kernel_version || exit 1 _install_prerequisites _create_dev_char_directory + _set_fw_search_path _install_driver _load_driver || exit 1 _mount_rootfs diff --git a/vgpu-manager/ubuntu22.04/nvidia-driver b/vgpu-manager/ubuntu22.04/nvidia-driver index a6cc53a9..12a7e7e1 100755 --- a/vgpu-manager/ubuntu22.04/nvidia-driver +++ b/vgpu-manager/ubuntu22.04/nvidia-driver @@ -118,6 +118,20 @@ _create_dev_char_directory() { fi } +_set_fw_search_path() { + local nv_fw_search_path="$RUN_DIR/driver/lib/firmware" + local fw_path_config_file="/sys/module/firmware_class/parameters/path" + + if [[ ! -z $(grep '[^[:space:]]' $fw_path_config_file) ]]; then + echo "WARNING: A search path is already configured in $fw_path_config_file" + echo " Retaining the current configuration. Note, GSP firmware may not be found and thus won't be used by the NVIDIA driver." + return + fi + + echo "Configuring the following firmware search path in '$fw_path_config_file': $nv_fw_search_path" + echo -n "$nv_fw_search_path" > $fw_path_config_file +} + # Currently _install_driver() takes care of loading nvidia modules. Just need to start necessary vgpu daemons _load_driver() { /usr/bin/nvidia-vgpud @@ -244,6 +258,7 @@ init() { _resolve_kernel_version || exit 1 _install_prerequisites _create_dev_char_directory + _set_fw_search_path _install_driver _load_driver || exit 1 _mount_rootfs