From a0eb7382521bb6682c6ba911f13d94c2b1d122db3a1edaf92d0c3d6013ad180c Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Sun, 29 Jan 2023 16:24:50 +0000 Subject: [PATCH 1/3] - introduce %hardcode_pci_list macro for hardcoding PCI ID modaliases for Supplements; make it default to *temporarily* workaround boo#1207520 * TW: enable only officially supported headless GPUs! * Leap/sle: enable all Turing and Ampere GPUs and set the appropriate modprobe.d option, so we can at least begin testing on sle15-sp5 ... OBS-URL: https://build.opensuse.org/package/show/X11:Drivers:Video:Redesign/nvidia-open-driver-G06-signed?expand=0&rev=17 --- generati-pci-table.sh | 63 ++++++++++++++ nvidia-open-driver-G06-signed.changes | 11 +++ nvidia-open-driver-G06-signed.spec | 30 ++++++- pci-table.patch | 114 ++++++++++++++++++++++++++ 4 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 generati-pci-table.sh create mode 100644 pci-table.patch diff --git a/generati-pci-table.sh b/generati-pci-table.sh new file mode 100644 index 0000000..8e5cf43 --- /dev/null +++ b/generati-pci-table.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +if [ $# -ne 1 ]; then + echo "$0 nvidia/nv_pci_table_list.h < nvidia/nv_module_pci_table_list.h <> nvidia/nv_pci_table_list.h <> nvidia/nv_module_pci_table_list.h < + +- introduce %hardcode_pci_list macro for hardcoding PCI ID + modaliases for Supplements; make it default to *temporarily* + workaround boo#1207520 + * TW: enable only officially supported headless GPUs! + * Leap/sle: enable all Turing and Ampere GPUs and set the + appropriate modprobe.d option, so we can at least begin + testing on sle15-sp5 ... + ------------------------------------------------------------------- Wed Jan 25 15:00:04 UTC 2023 - Stefan Dirsch diff --git a/nvidia-open-driver-G06-signed.spec b/nvidia-open-driver-G06-signed.spec index 741d969..fb5e6d2 100644 --- a/nvidia-open-driver-G06-signed.spec +++ b/nvidia-open-driver-G06-signed.spec @@ -16,6 +16,8 @@ # +%define hardcode_pci_list 1 + %if %{undefined kernel_module_directory} %if 0%{?usrmerged} %define kernel_module_directory /usr/lib/modules @@ -49,8 +51,14 @@ Source9: pci_ids-unsupported-%{version} Source10: pci_ids-unsupported Source11: pesign-copy-sources Source12: pesign-spec-macros +%if 0%{hardcode_pci_list} +Source13: generati-pci-table.sh +%endif Patch0: 0001-Don-t-override-INSTALL_MOD_DIR.patch Patch2: persistent-nvidia-id-string.patch +%if 0%{hardcode_pci_list} +Patch3: pci-table.patch +%endif BuildRequires: %{kernel_module_package_buildreqs} BuildRequires: gcc-c++ BuildRequires: kernel-source @@ -71,8 +79,10 @@ ExclusiveArch: x86_64 aarch64 %(sed -e '/^%%post\>/ r %_sourcedir/kmp-post.sh' -e '/^%%postun\>/ r %_sourcedir/kmp-postun.sh' %kmp_template_name >%_builddir/nvidia-kmp-template) %kernel_module_package -n %{name} -t %_builddir/nvidia-kmp-template -f %_sourcedir/kmp-filelist -p %_sourcedir/preamble -# create hardware supplements for manual builds +%if ! 0%{hardcode_pci_list} +## create hardware supplements for manual builds %{load:%{SOURCE12}} +%endif # newer rpmbuilds attach the kernel version and the major part of release to %%pci_id_file of the __kmp_supplements script # boo#1190210 @@ -86,6 +96,16 @@ for GeForce RTX 2000 series and newer GPUs. %setup -q -n open-gpu-kernel-modules-%{version} %patch0 -p1 %patch2 -p1 +%if 0%{hardcode_pci_list} +%patch3 -p0 +pushd kernel-open +%if 0%{?suse_version} >= 1550 +sh %{SOURCE13} %{SOURCE2} +%else +sh %{SOURCE13} %{SOURCE9} +%endif +popd +%endif set -- * mkdir source mv "$@" source/ @@ -148,7 +168,15 @@ for flavor in %flavors_to_build; do blacklist nouveau options nvidia-drm modeset=1 ### Enable support on *all* Turing/Ampere GPUs: Alpha Quality! +%if 0%{hardcode_pci_list} +%if 0%{?suse_version} >= 1550 #options nvidia NVreg_OpenRmEnableUnsupportedGpus=1 +%else +options nvidia NVreg_OpenRmEnableUnsupportedGpus=1 +%endif +%else +#options nvidia NVreg_OpenRmEnableUnsupportedGpus=1 +%endif EOF echo -n "install nvidia " >> $MODPROBE_DIR/50-nvidia-$flavor.conf tail -n +3 %_sourcedir/modprobe.nvidia.install | awk '{ printf "%s ", $0 }' >> $MODPROBE_DIR/50-nvidia-$flavor.conf diff --git a/pci-table.patch b/pci-table.patch new file mode 100644 index 0000000..546de38 --- /dev/null +++ b/pci-table.patch @@ -0,0 +1,114 @@ +diff -u -r kernel-open.orig/nvidia/nv-pci-table.c kernel-open/nvidia/nv-pci-table.c +--- kernel-open.orig/nvidia/nv-pci-table.c 2023-01-29 14:48:55.126713000 +0100 ++++ kernel-open/nvidia/nv-pci-table.c 2023-01-29 14:56:28.901959000 +0100 +@@ -28,51 +28,13 @@ + + /* Devices supported by RM */ + struct pci_device_id nv_pci_table[] = { +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_DISPLAY_VGA << 8), +- .class_mask = ~0 +- }, +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_DISPLAY_3D << 8), +- .class_mask = ~0 +- }, ++#include "nv_pci_table_list.h" + { } + }; + + /* Devices supported by all drivers in nvidia.ko */ + struct pci_device_id nv_module_device_table[] = { +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_DISPLAY_VGA << 8), +- .class_mask = ~0 +- }, +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_DISPLAY_3D << 8), +- .class_mask = ~0 +- }, +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_BRIDGE_OTHER << 8), +- .class_mask = ~0 +- }, ++#include "nv_module_pci_table_list.h" + { } + }; + +diff -u -r kernel-open.orig/nvidia-drm/nv-pci-table.c kernel-open/nvidia-drm/nv-pci-table.c +--- kernel-open.orig/nvidia-drm/nv-pci-table.c 2023-01-29 14:48:51.032916000 +0100 ++++ kernel-open/nvidia-drm/nv-pci-table.c 2023-01-29 14:53:47.242620000 +0100 +@@ -28,51 +28,13 @@ + + /* Devices supported by RM */ + struct pci_device_id nv_pci_table[] = { +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_DISPLAY_VGA << 8), +- .class_mask = ~0 +- }, +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_DISPLAY_3D << 8), +- .class_mask = ~0 +- }, ++#include "nv_pci_table_list.h" + { } + }; + + /* Devices supported by all drivers in nvidia.ko */ + struct pci_device_id nv_module_device_table[] = { +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_DISPLAY_VGA << 8), +- .class_mask = ~0 +- }, +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_DISPLAY_3D << 8), +- .class_mask = ~0 +- }, +- { +- .vendor = PCI_VENDOR_ID_NVIDIA, +- .device = PCI_ANY_ID, +- .subvendor = PCI_ANY_ID, +- .subdevice = PCI_ANY_ID, +- .class = (PCI_CLASS_BRIDGE_OTHER << 8), +- .class_mask = ~0 +- }, ++#include "nv_module_pci_table_list.h" + { } + }; + From 4e43cf87fc4c20aed4167008f1715ce4d9c55116d65b29d74ed029587ba4ef5e Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Sun, 29 Jan 2023 17:12:22 +0000 Subject: [PATCH 2/3] always include patch and script for generating PCI ID modalias Supplements OBS-URL: https://build.opensuse.org/package/show/X11:Drivers:Video:Redesign/nvidia-open-driver-G06-signed?expand=0&rev=18 --- nvidia-open-driver-G06-signed.spec | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nvidia-open-driver-G06-signed.spec b/nvidia-open-driver-G06-signed.spec index fb5e6d2..b24276a 100644 --- a/nvidia-open-driver-G06-signed.spec +++ b/nvidia-open-driver-G06-signed.spec @@ -51,14 +51,10 @@ Source9: pci_ids-unsupported-%{version} Source10: pci_ids-unsupported Source11: pesign-copy-sources Source12: pesign-spec-macros -%if 0%{hardcode_pci_list} Source13: generati-pci-table.sh -%endif Patch0: 0001-Don-t-override-INSTALL_MOD_DIR.patch Patch2: persistent-nvidia-id-string.patch -%if 0%{hardcode_pci_list} Patch3: pci-table.patch -%endif BuildRequires: %{kernel_module_package_buildreqs} BuildRequires: gcc-c++ BuildRequires: kernel-source From 23e16f14328d32a963b28eb46ac664e357d0dce794142c43fcec42313f55c4da Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Sun, 29 Jan 2023 17:39:38 +0000 Subject: [PATCH 3/3] mention pci-table.patch, generati-pci-table.sh in changelog OBS-URL: https://build.opensuse.org/package/show/X11:Drivers:Video:Redesign/nvidia-open-driver-G06-signed?expand=0&rev=19 --- nvidia-open-driver-G06-signed.changes | 1 + 1 file changed, 1 insertion(+) diff --git a/nvidia-open-driver-G06-signed.changes b/nvidia-open-driver-G06-signed.changes index 1f4ab20..9d1b5e7 100644 --- a/nvidia-open-driver-G06-signed.changes +++ b/nvidia-open-driver-G06-signed.changes @@ -8,6 +8,7 @@ Sun Jan 29 16:16:33 UTC 2023 - Stefan Dirsch * Leap/sle: enable all Turing and Ampere GPUs and set the appropriate modprobe.d option, so we can at least begin testing on sle15-sp5 ... +- adds pci-table.patch, generati-pci-table.sh ------------------------------------------------------------------- Wed Jan 25 15:00:04 UTC 2023 - Stefan Dirsch