Ryzenadj and ryzen_smu


I am trying to use the ryzenadj package that is in nixpkgs (see https://github.com/NixOS/nixpkgs/issues/125689. As far as I know, this software need a kernel driver that is not in nixpkgs, and thus is currently not functional.

I have made a derivation for the kernel driver found here:
this is my code:

{ stdenv, lib, fetchFromGitLab, kernel, kmod }:

stdenv.mkDerivation rec {
  name = "ryzen_smu-${version}-${kernel.version}";
  version = "0.1.5";

  src = fetchFromGitLab {
    owner = "leogx9r";
    repo = "ryzen_smu";
    rev = "v${version}";
    sha256 = "n4uWikGg0Kcki/TvV4BiRO3/VE5M6/KopPncj5RQFAQ=";

  hardeningDisable = [ "pic" "format" ];                               
  nativeBuildInputs = kernel.moduleBuildDependencies;           

  makeFlags = [

  installPhase =
      mkdir -p $out/lib/modules/${kernel.version}/misc/
      cp *.ko $out/lib/modules/${kernel.version}/misc/
  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.gpl2;
    maintainers = [];
    platforms = platforms.linux;

that I load with

  boot.extraModulePackages =
        ryzen_smu = config.boot.kernelPackages.callPackage ./ryzen_smu.nix {};
        [ ryzen_smu ];

  boot.kernelModules = [ "ryzen_smu" ];

I do have the module in /run/current-system/kernel-modules/lib/modules/6.3.11/misc/ryzen_smu.ko but nothing is happening. I only get that output

$ dmesg | grep ryzen_smu
[    6.980137] ryzen_smu: loading out-of-tree module taints kernel.

and I have no sysfs interface at /sys/kernel/ryzen_smu_drv.

Does anybody has a working version of that module?

Which CPU are you using?

you may like to read this: Module doesn't start (#20) · Issues · Leonardo Gates / Ryzen SMU · GitLab

Well, that was it. That commit add support for my Rembrandt CPU.

  src = fetchFromGitLab {
    owner = "leogx9r";
    repo = "ryzen_smu";
    rev = "cdfe728b3299400b7cd17d31bdfe5bedab6b1cc9";
    sha256 = "sha256-YFsTTjGvg1CbojhcqQN5fX8Hfsj5rA/t/7sWnU/4n4s=";

Thank you so much for pointing this out!

1 Like

You’re welecome.

A PR on nixpkgs https://github.com/NixOS/nixpkgs/pull/271342 is working on it.