summaryrefslogtreecommitdiff
blob: f0c92cb603b677e5684bfc784bef832275150fe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- a/src/bbsecondary.c	2019-01-01 14:54:00.322574712 +0100
+++ b/src/bbsecondary.c	2019-01-01 14:56:06.237570395 +0100
@@ -119,6 +119,23 @@
     if (!module_load(module_name, driver_name)) {
       set_bb_error("Could not load GPU driver");
       return false;
+    } else {
+      /* XXX NVIDIA UVM support */
+      if (strstr(module_name, "nvidia")) { /* We are using NVIDIA's proprietary driver */
+        char uvm_module_name[1024];
+        sprintf(uvm_module_name, "%s-uvm", module_name);
+        if (!module_load(uvm_module_name, "nvidia_uvm")) {
+          char log_string[1024];
+          sprintf(log_string, "Cannot load UVM module: %s\n", uvm_module_name);
+          bb_log(LOG_ERR, log_string);
+          /* Let's try the new nvidia-modeset if they have no uvm module installed: */
+          sprintf(uvm_module_name, "%s-modeset", module_name);
+          if (!module_load(uvm_module_name, "nvidia_uvm")) {
+            sprintf(log_string, "Cannot load MODESET module either: %s\n", uvm_module_name);
+            bb_log(LOG_ERR, log_string);
+          }
+        }
+      }
     }
   }
   return true;
@@ -244,6 +261,12 @@
   if (unload_driver || bb_config.force_driver_unload) {
     /* unload the driver loaded by the graphica card */
     if (pci_get_driver(driver, pci_bus_id_discrete, sizeof driver)) {
+      /* XXX NVIDIA UVM support */
+      if (strstr(driver, "nvidia")) {
+        module_unload("nvidia_drm");
+        module_unload("nvidia_modeset");
+        module_unload("nvidia_uvm");
+      }
       module_unload(driver);
     }
   }