mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-05 17:27:50 +00:00
[Hardware/AMD] Automatically use amd_pstate=active|guided on kernels supporting it
This commit is contained in:
parent
30d825feba
commit
c2ece764da
1 changed files with 9 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ with lib;
|
|||
let
|
||||
generalCfg = config.aviallon.general;
|
||||
cpuIsZen = ! isNull (builtins.match "znver[0-9]" generalCfg.cpu.arch);
|
||||
kernelVersion = getVersion config.boot.kernelPackages.kernel;
|
||||
in {
|
||||
config = mkIf (generalCfg.cpu.vendor == "amd") {
|
||||
boot.kernel.sysctl = {
|
||||
|
|
@ -13,7 +14,14 @@ in {
|
|||
};
|
||||
|
||||
aviallon.boot.cmdline = {
|
||||
"amd_pstate" = "passive";
|
||||
"amd_pstate" =
|
||||
if versionAtLeast kernelVersion "6.4" then
|
||||
"guided"
|
||||
else if versionAtLeast kernelVersion "6.3" then
|
||||
"active"
|
||||
else
|
||||
"passive"
|
||||
;
|
||||
} // optionalAttrs (generalCfg.cpu.arch == "znver2") {
|
||||
# Required for Zen 2
|
||||
"amd_pstate.shared_memory" = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue