From e6ab9b53008b53eb1583661aaa23043390e308f8 Mon Sep 17 00:00:00 2001 From: Thomas Duckworth Date: Sat, 29 Nov 2025 15:58:43 +1100 Subject: [PATCH] Include some power-saving options for NVIDIA GPUs Include udev rules for enabling runtime power management for NVIDIA graphics processors using PRIME, as well as setting up some memory management improvements in the driver. --- mkosi.extra/usr/lib/modprobe.d/00-nvidia.conf | 18 ++++++++++++++++ .../rules.d/80-nvidia-power-management.rules | 21 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 mkosi.extra/usr/lib/modprobe.d/00-nvidia.conf create mode 100644 mkosi.extra/usr/lib/udev/rules.d/80-nvidia-power-management.rules diff --git a/mkosi.extra/usr/lib/modprobe.d/00-nvidia.conf b/mkosi.extra/usr/lib/modprobe.d/00-nvidia.conf new file mode 100644 index 0000000..21066c7 --- /dev/null +++ b/mkosi.extra/usr/lib/modprobe.d/00-nvidia.conf @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: none + +# NVreg_UsePageAttributeTable=1 (Default 0) - Activating the better memory +# management method (PAT). The PAT method creates a partition type table at a +# specific address mapped inside the register and utilizes the memory +# architecture and instruction set more efficiently and faster. If your system +# can support this feature, it should improve CPU performance. +# +# NVreg_InitializeSystemMemoryAllocations=0 (Default 1) - Disables clearing +# system memory allocation before using it for the GPU. Potentially improves +# performance, but at the cost of increased security risks. Write "options +# nvidia NVreg_InitializeSystemMemoryAllocations=1" in +# /etc/modprobe.d/nvidia.conf, if you want to return the default value. Note: +# It is possible to use more memory (?) + +options nvidia NVreg_UsePageAttributeTable=1 \ + NVreg_InitializeSystemMemoryAllocations=0 diff --git a/mkosi.extra/usr/lib/udev/rules.d/80-nvidia-power-management.rules b/mkosi.extra/usr/lib/udev/rules.d/80-nvidia-power-management.rules new file mode 100644 index 0000000..953baf4 --- /dev/null +++ b/mkosi.extra/usr/lib/udev/rules.d/80-nvidia-power-management.rules @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: none + +# Enable runtime power management for NVIDIA VGA/3D controller devices on driver bind. +ACTION=="add|bind", SUBSYSTEM=="pci", DRIVERS=="nvidia", \ + ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \ + TEST=="power/control", ATTR{power/control}="auto" + +# Disable runtime power management for NVIDIA VGA/3D controller devices on driver unbind. +ACTION=="remove|unbind", SUBSYSTEM=="pci", DRIVERS=="nvidia", \ + ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \ + TEST=="power/control", ATTR{power/control}="on" + +# Enable runtime power management for NVIDIA VGA/3D controller devices on adding device. +ACTION=="add", SUBSYSTEM=="pci", \ + ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", \ + TEST=="power/control", ATTR{power/control}="auto" + +ACTION=="add", SUBSYSTEM=="pci", \ + ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", \ + TEST=="power/control", ATTR{power/control}="auto"