-
-
Notifications
You must be signed in to change notification settings - Fork 14k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #271342 from PhDyellow/ryzen_smu
ryzen_smu: init at 0.1.5, ryzen_monitor_ng: init at 2.0.5
- Loading branch information
Showing
8 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ config | ||
, lib | ||
, ... | ||
}: | ||
let | ||
inherit (lib) mkEnableOption mkIf; | ||
cfg = config.hardware.cpu.amd.ryzen-smu; | ||
ryzen-smu = config.boot.kernelPackages.ryzen-smu; | ||
in | ||
{ | ||
options.hardware.cpu.amd.ryzen-smu = { | ||
enable = mkEnableOption '' | ||
ryzen_smu, a linux kernel driver that exposes access to the SMU (System Management Unit) for certain AMD Ryzen Processors. | ||
WARNING: Damage cause by use of your AMD processor outside of official AMD specifications or outside of factory settings are not covered under any AMD product warranty and may not be covered by your board or system manufacturer's warranty | ||
''; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
boot.kernelModules = [ "ryzen-smu" ]; | ||
boot.extraModulePackages = [ ryzen-smu ]; | ||
environment.systemPackages = [ ryzen-smu ]; | ||
}; | ||
|
||
meta.maintainers = with lib.maintainers; [ Cryolitia phdyellow ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ pkgs | ||
, config | ||
, lib | ||
, ... | ||
}: | ||
let | ||
inherit (lib) mkEnableOption mkPackageOption mkIf; | ||
cfg = config.programs.ryzen-monitor-ng; | ||
in | ||
{ | ||
options = { | ||
programs.ryzen-monitor-ng = { | ||
enable = mkEnableOption '' | ||
ryzen_monitor_ng, a userspace application for setting and getting Ryzen SMU (System Management Unit) parameters via the ryzen_smu kernel driver. | ||
Monitor power information of Ryzen processors via the PM table of the SMU. | ||
SMU Set and Get for many parameters and CO counts. | ||
https://github.com/mann1x/ryzen_monitor_ng | ||
WARNING: Damage cause by use of your AMD processor outside of official AMD specifications or outside of factory settings are not covered under any AMD product warranty and may not be covered by your board or system manufacturer's warranty | ||
''; | ||
|
||
package = mkPackageOption pkgs "ryzen-monitor-ng" {}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
environment.systemPackages = [ cfg.package ]; | ||
hardware.cpu.amd.ryzen-smu.enable = true; | ||
}; | ||
|
||
meta.maintainers = with lib.maintainers; [ Cryolitia phdyellow ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ lib, stdenv, fetchFromGitHub }: | ||
|
||
stdenv.mkDerivation { | ||
pname = "ryzen-monitor-ng"; | ||
version = "2.0.5-unstable-2023-11-05"; | ||
|
||
# Upstream has not updated ryzen_smu header version | ||
# This fork corrects ryzen_smu header version and | ||
# adds support for Matisse AMD CPUs. | ||
src = fetchFromGitHub { | ||
owner = "plasmin"; | ||
repo = "ryzen_monitor_ng"; | ||
rev = "8b7854791d78de731a45ce7d30dd17983228b7b1"; | ||
hash = "sha256-fcW2fEsCFliRnMFnboR0jchzVIlCYbr2AE6AS06cb6o="; | ||
}; | ||
|
||
## Remove binaries committed into upstream repo | ||
preBuild = '' | ||
rm src/ryzen_monitor | ||
''; | ||
|
||
makeTargets = [ "clean" "install" ]; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/bin | ||
mv ./src/ryzen_monitor $out/bin | ||
runHook postInstall | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Access Ryzen SMU information exposed by the ryzen_smu driver"; | ||
homepage = "https://github.com/mann1x/ryzen_monitor_ng"; | ||
license = licenses.agpl3Only; | ||
platforms = [ "x86_64-linux" ]; | ||
maintainers = with maintainers; [ phdyellow ]; | ||
mainProgram = "ryzen_monitor"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ lib | ||
, stdenv | ||
, fetchFromGitHub | ||
, kernel | ||
}: | ||
|
||
let | ||
version = "0.1.5-unstable-2024-01-03"; | ||
|
||
## Upstream has not been merging PRs. | ||
## Nixpkgs maintainers are providing a | ||
## repo with PRs merged until upstream is | ||
## updated. | ||
src = fetchFromGitHub { | ||
owner = "Cryolitia"; | ||
repo = "ryzen_smu"; | ||
rev = "ce1aa918efa33ca79998f0f7d467c04d4b07016c"; | ||
hash = "sha256-s9SSmbL6ixWqZUKEhrZdxN4xoWgk+8ClZPoKq2FDAAE="; | ||
}; | ||
|
||
monitor-cpu = stdenv.mkDerivation { | ||
pname = "monitor-cpu"; | ||
inherit version src; | ||
|
||
makeFlags = [ | ||
"-C userspace" | ||
]; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
install userspace/monitor_cpu -Dm755 -t $out/bin | ||
runHook postInstall | ||
''; | ||
}; | ||
|
||
in | ||
stdenv.mkDerivation { | ||
pname = "ryzen-smu-${kernel.version}"; | ||
inherit version src; | ||
|
||
hardeningDisable = [ "pic" ]; | ||
|
||
nativeBuildInputs = kernel.moduleBuildDependencies; | ||
|
||
makeFlags = [ | ||
"TARGET=${kernel.modDirVersion}" | ||
"KERNEL_BUILD=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" | ||
]; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
install ryzen_smu.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/ryzen_smu | ||
install ${monitor-cpu}/bin/monitor_cpu -Dm755 -t $out/bin | ||
runHook postInstall | ||
''; | ||
|
||
meta = with lib; { | ||
description = "A Linux kernel driver that exposes access to the SMU (System Management Unit) for certain AMD Ryzen Processors"; | ||
homepage = "https://gitlab.com/leogx9r/ryzen_smu"; | ||
license = licenses.gpl2Plus; | ||
maintainers = with maintainers; [ Cryolitia phdyellow ]; | ||
platforms = [ "x86_64-linux" ]; | ||
mainProgram = "monitor_cpu"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters