Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge queue: embarking master (b98df18) and [#1285 + #1282] together #1306

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ See code for all available configurations.
| [Apple Macs with a T2 Chip](apple/t2) | `<nixos-hardware/apple/t2>` |
| [Asus Pro WS X570-ACE](asus/pro-ws-x570-ace) | `<nixos-hardware/asus/pro-ws-x570-ace>` |
| [Asus ROG Ally RC71L (2023)](asus/ally/rc71l) | `<nixos-hardware/asus/ally/rc71l>` |
| [Asus ROG Flow X13 GV302X\* (2023)](asus/zephyrus/gv302x/amdgpu) | `<nixos-hardware/asus/flow/gv302x/amdgpu>` |
| [Asus ROG Flow X13 GV302X\* (2023)](asus/zephyrus/gv302x/nvidia) | `<nixos-hardware/asus/flow/gv302x/nvidia>` |
| [Asus ROG Strix G513IM](asus/rog-strix/g513im) | `<nixos-hardware/asus/rog-strix/g513im>` |
| [Asus ROG Strix G713IE](asus/rog-strix/g713ie) | `<nixos-hardware/asus/rog-strix/g713ie>` |
| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `<nixos-hardware/asus/rog-strix/g733qs>` |
Expand Down Expand Up @@ -335,6 +337,7 @@ See code for all available configurations.
| [Raspberry Pi 4](raspberry-pi/4) | `<nixos-hardware/raspberry-pi/4>` |
| [Raspberry Pi 5](raspberry-pi/5) | `<nixos-hardware/raspberry-pi/5>` |
| [Samsung Series 9 NP900X3C](samsung/np900x3c) | `<nixos-hardware/samsung/np900x3c>` |
| [Slimbook Hero RPL-RTX](slimbook/hero/rpl-rtx) | `<nixos-hardware/slimbook/hero/rpl-rtx>` |
| [StarFive VisionFive v1](starfive/visionfive/v1) | `<nixos-hardware/starfive/visionfive/v1>` |
| [StarFive VisionFive 2](starfive/visionfive/v2) | `<nixos-hardware/starfive/visionfive/v2>` |
| [StarLabs StarLite 5 (I5)](starlabs/starlite/i5) | `<nixos-hardware/starlabs/starlite/i5>` |
Expand Down
44 changes: 44 additions & 0 deletions asus/flow/gv302x/amdgpu/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{ config,
lib,
...
}:

let
inherit (lib) mkEnableOption mkIf mkMerge;
cfg = config.hardware.asus.flow.gv302x;

in {
imports = [
../shared.nix
];

options.hardware.asus.flow.gv302x.amdgpu = {
recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; };
sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; };
psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; };
};

config = mkMerge [
(mkIf cfg.amdgpu.recovery.enable {
# Hopefully fixes for where the kernel sometimes hangs when suspending or hibernating
# (Though, I'm very suspicious of the Mediatek Wifi...)
boot.kernelParams = [
"amdgpu.gpu_recovery=1"
];
})

(mkIf (!cfg.amdgpu.sg_display.enable) {
# Can help solve flickering/glitching display issues since Scatter/Gather code was reenabled
boot.kernelParams = [
"amdgpu.sg_display=0"
];
})

(mkIf (!cfg.amdgpu.psr.enable) {
# Can help solve flickering/glitching display issues since Scatter/Gather code was reenabled
boot.kernelParams = [
"amdgpu.dcdebugmask=0x10"
];
})
];
}
58 changes: 58 additions & 0 deletions asus/flow/gv302x/nvidia/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{ lib,
pkgs,
config,
...
}:

let
inherit (lib) mkDefault;

in {
imports = [
../shared.nix
## "prime.nix" loads this, aleady:
# ../../../common/gpu/nvidia
../../../../common/gpu/nvidia/prime.nix
../../../../common/gpu/nvidia/ada-lovelace

];

# NVIDIA GeForce RTX 4070 Mobile

boot = {
blacklistedKernelModules = [ "nouveau" ];
};



hardware = {
## Enable the Nvidia card, as well as Prime and Offload:
amdgpu.initrd.enable = mkDefault true;

nvidia = {

#to avoid problems with gnome 47 vulkan
package = mkDefault config.boot.kernelPackages.nvidiaPackages.beta;

modesetting.enable = true;
nvidiaSettings = mkDefault true;

prime = {
offload = {
enable = mkDefault true;
enableOffloadCmd = mkDefault true;
};
amdgpuBusId = "PCI:69:0:0";
nvidiaBusId = "PCI:1:0:0";
};

powerManagement = {
enable = mkDefault true;
finegrained = mkDefault true;
};

dynamicBoost.enable = mkDefault true;

};
};
}
106 changes: 106 additions & 0 deletions asus/flow/gv302x/shared.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{ config,
pkgs,
lib,
...
}:

let
inherit (lib) mkDefault mkEnableOption mkIf mkMerge version versionAtLeast versionOlder;

cfg = config.hardware.asus.flow.gv302x;
in {

imports = [
../../../common/cpu/amd
# Better power-savings from AMD PState:
../../../common/cpu/amd/pstate.nix
../../../common/gpu/amd
../../../common/pc/laptop
../../../common/pc/ssd
];

options.hardware.asus.flow.gv302x = {
# Kernels earlier than 6.9 (possibly even earlier) tend to take 1-2 key-presses
# to wake-up the internal keyboard after the device is suspended.
# Therefore, this option disables auto-suspend for the keyboard by default, but
# enables it for kernel 6.9.x onwards.
#
# Note: the device name is "ASUS N-KEY Device".
keyboard.autosuspend.enable = (
mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Flow GV302X"
) // {
default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9";
defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\"";
};
# The ASUS 8295 ITE device will cause an immediate wake-up when trying to suspend the laptop.
# After the first successful hibernate, it will work as expected, however.
# NOTE: I'm not actually sure what this device, as neither the touchpad nor the M1-M4 keys cause a wake-up.
ite-device.wakeup.enable = mkEnableOption "Enable power wakeup on the internal USB keyboard-like device (8295 ITE Device) on Flow GV302X";
};

config = mkMerge [
{
# Configure basic system settings:
boot = {
kernelModules = [ "kvm-amd" ];
kernelParams = [
"mem_sleep_default=deep"
"pcie_aspm.policy=powersupersave"
];
};

services = {
asusd = {
enable = mkDefault true;
enableUserService = mkDefault true;
};

supergfxd.enable = mkDefault true;

udev = {
extraHwdb = ''
# Fixes mic mute button
evdev:name:*:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
KEYBOARD_KEY_ff31007c=f20
'';
};
};

#flow devices are 2 in 1 laptops
hardware.sensor.iio.enable = mkDefault true;

}

(mkIf (! cfg.keyboard.autosuspend.enable) {
services.udev.extraRules = ''
# Disable power auto-suspend for the ASUS N-KEY device, i.e. USB Keyboard.
# Otherwise on certain kernel-versions, it will tend to take 1-2 key-presses to wake-up after the device suspends.
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend", ATTR{idVendor}=="0b05", ATTR{idProduct}=="19b6", ATTR{power/autosuspend}="-1"
'';
})

(mkIf (! cfg.ite-device.wakeup.enable) {
services.udev.extraRules = ''
# Disable power wakeup for the 8295 ITE device.
# Otherwise on certain kernel-versions, it will tend to cause the laptop to immediately wake-up when suspending.
# ACTION=="add|change", SUBSYSTEM=="usb", DRIVER="usb", TEST="power/wakeup", ATTR{idVendor}=="0b05", ATTR{idProduct}=="193b", ATTR{power/wakeup}="disabled"
ACTION=="add|change", SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", ATTR{idProduct}=="193b", ATTR{power/wakeup}="disabled"
'';
})

(mkIf (config.networking.wireless.iwd.enable && config.networking.wireless.scanOnLowSignal) {
# Meditek doesn't seem to be quite sensitive enough on the default roaming settings:
# https://wiki.archlinux.org/title/Wpa_supplicant#Roaming
# https://wiki.archlinux.org/title/Iwd#iwd_keeps_roaming
#
# But NixOS doesn't have the tweaks for IWD, yet.
networking.wireless.iwd.settings = {
General = {
RoamThreshold = -75;
RoamThreshold5G = -80;
RoamRetryInterval = 20;
};
};
})
];
}
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
asus-fx506hm = import ./asus/fx506hm;
asus-fa507nv = import ./asus/fa507nv;
asus-fa507rm = import ./asus/fa507rm;
asus-flow-gv302x-amdgpu = import ./asus/flow/gv302x/amdgpu;
asus-flow-gv302x-nvidia = import ./asus/flow/gv302x/nvidia;
asus-pro-ws-x570-ace = import ./asus/pro-ws-x570-ace;
asus-rog-strix-g513im = import ./asus/rog-strix/g513im;
asus-rog-strix-g713ie = import ./asus/rog-strix/g713ie;
Expand Down Expand Up @@ -285,6 +287,7 @@
raspberry-pi-5 = import ./raspberry-pi/5;
kobol-helios4 = import ./kobol/helios4;
samsung-np900x3c = import ./samsung/np900x3c;
slimbook-hero-rpl-rtx = import ./slimbook/hero/rpl-rtx;
starfive-visionfive-v1 = import ./starfive/visionfive/v1;
starfive-visionfive-2 = import ./starfive/visionfive/v2;
starlabs-starlite-i5 = import ./starlabs/starlite/i5;
Expand Down
123 changes: 123 additions & 0 deletions slimbook/hero/rpl-rtx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# [Slimbook HERO](https://slimbook.com/en/shop/product/hero-intel-i7-13620h-1115)

This configuration is for the Slimbook Hero with an i7-13620H and an RTX 4060.
Model name: SLIMBOOK HERO-RPL-RTX.

To run software on your Nvidia GPU, use the `nvidia-offload` command. For example:
```bash
nvidia-offload `nix-shell -p glxinfo --run 'glxgears'`
```
For more information, visit: https://wiki.nixos.org/wiki/NVIDIA#Offload_mode

<details><summary>System information</summary>

```bash
>neofetch
OS: NixOS 24.11.20241216.3945713 (Vicuna) x86_64
Host: SLIMBOOK HERO-RPL-RTX
Kernel: 6.6.66
Uptime: 37 mins
Packages: 1296 (nix-system), 893 (nix-user), 2 (nix-default), 9 (flatpak)
Shell: bash 5.2.37
Resolution: 2560x1440
DE: GNOME 47.1 (Wayland)
WM: Mutter
WM Theme: Adwaita
Theme: Adwaita [GTK2/3]
Icons: Adwaita [GTK2/3]
Terminal: kgx
CPU: 13th Gen Intel i7-13620H (16) @ 4.700GHz
GPU: Intel Raptor Lake-P [UHD Graphics]
GPU: NVIDIA GeForce RTX 4060 Max-Q / Mobile
Memory: 4448MiB / 15734MiB

$ lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation Device [8086:a715]
00:01.0 PCI bridge [0604]: Intel Corporation Raptor Lake PCI Express 5.0 Graphics Port (PEG010) [8086:a70d]
00:02.0 VGA compatible controller [0300]: Intel Corporation Raptor Lake-P [UHD Graphics] [8086:a7a8] (rev 04)
00:04.0 Signal processing controller [1180]: Intel Corporation Raptor Lake Dynamic Platform and Thermal Framework Processor Participant [8086:a71d]
00:06.0 PCI bridge [0604]: Intel Corporation Raptor Lake PCIe 4.0 Graphics Port [8086:a74d]
00:06.2 PCI bridge [0604]: Intel Corporation Device [8086:a73d]
00:08.0 System peripheral [0880]: Intel Corporation GNA Scoring Accelerator module [8086:a74f]
00:0a.0 Signal processing controller [1180]: Intel Corporation Raptor Lake Crashlog and Telemetry [8086:a77d] (rev 01)
00:14.0 USB controller [0c03]: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller [8086:51ed] (rev 01)
00:14.2 RAM memory [0500]: Intel Corporation Alder Lake PCH Shared SRAM [8086:51ef] (rev 01)
00:14.3 Network controller [0280]: Intel Corporation Raptor Lake PCH CNVi WiFi [8086:51f1] (rev 01)
00:15.0 Serial bus controller [0c80]: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 [8086:51e8] (rev 01)
00:16.0 Communication controller [0780]: Intel Corporation Alder Lake PCH HECI Controller [8086:51e0] (rev 01)
00:1c.0 PCI bridge [0604]: Intel Corporation Alder Lake PCH-P PCI Express Root Port #9 [8086:51bf] (rev 01)
00:1f.0 ISA bridge [0601]: Intel Corporation Raptor Lake LPC/eSPI Controller [8086:519d] (rev 01)
00:1f.3 Audio device [0403]: Intel Corporation Raptor Lake-P/U/H cAVS [8086:51ca] (rev 01)
00:1f.4 SMBus [0c05]: Intel Corporation Alder Lake PCH-P SMBus Host Controller [8086:51a3] (rev 01)
00:1f.5 Serial bus controller [0c80]: Intel Corporation Alder Lake-P PCH SPI Controller [8086:51a4] (rev 01)
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD107M [GeForce RTX 4060 Max-Q / Mobile] [10de:28a0] (rev a1)
01:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:22be] (rev a1)
02:00.0 Non-Volatile memory controller [0108]: MAXIO Technology (Hangzhou) Ltd. NVMe SSD Controller MAP1202 (DRAM-less) [1e4b:1202] (rev 01)
03:00.0 Non-Volatile memory controller [0108]: Micron Technology Inc 2550 NVMe SSD (DRAM-less) [1344:5416] (rev 01)
04:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
```

</details>

## Power Management
My testing shows suspend issues (tested in GNOME) when using `hardware.nvidia.powerManagement.enabled = true`, regardless of the value of `hardware.nvidia.powerManagement.finegrained`.
This seems related to this [issue](https://github.com/NixOS/nixpkgs/issues/336723), which is offered a solution in [this discouse thread](https://discourse.nixos.org/t/suspend-resume-cycling-on-system-resume/32322/12) with this config:

<details>

```nix
systemd = {
services."gnome-suspend" = {
description = "suspend gnome shell";
before = [
"systemd-suspend.service"
"systemd-hibernate.service"
"nvidia-suspend.service"
"nvidia-hibernate.service"
];
wantedBy = [
"systemd-suspend.service"
"systemd-hibernate.service"
];
serviceConfig = {
Type = "oneshot";
ExecStart = ''${pkgs.procps}/bin/pkill -f -STOP ${pkgs.gnome-shell}/bin/gnome-shell'';
};
};
services."gnome-resume" = {
description = "resume gnome shell";
after = [
"systemd-suspend.service"
"systemd-hibernate.service"
"nvidia-resume.service"
];
wantedBy = [
"systemd-suspend.service"
"systemd-hibernate.service"
];
serviceConfig = {
Type = "oneshot";
ExecStart = ''${pkgs.procps}/bin/pkill -f -CONT ${pkgs.gnome-shell}/bin/gnome-shell'';
};
};
};
```

</details>

At the same time, the Nvidia driver reports power management to still be working even with `nvidia.powerManagement.enable = false`:
```bash
>cat /proc/driver/nvidia/gpus/0000:01:00.0/power
Runtime D3 status: Enabled (fine-grained)
Video Memory: Off

GPU Hardware Support:
Video Memory Self Refresh: Supported
Video Memory Off: Supported

S0ix Power Management:
Platform Support: Supported
Status: Disabled
```

For more information see the [Nvidia documentation](https://download.nvidia.com/XFree86/Linux-x86_64/565.77/README/powermanagement.html), chapters 21 and 22.
Loading
Loading