Attempt individual kernel module build
This commit is contained in:
parent
74f8e77311
commit
cb97b90ca3
3 changed files with 78 additions and 1 deletions
38
hosts/default/amdgpu.nix
Normal file
38
hosts/default/amdgpu.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{ pkgs
|
||||||
|
, lib
|
||||||
|
, kernel ? pkgs.linuxPackages_latest.kernel
|
||||||
|
}:
|
||||||
|
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
|
pname = "amdgpu-kernel-module";
|
||||||
|
inherit (kernel) src version postPatch nativeBuildInputs;
|
||||||
|
|
||||||
|
kernel_dev = kernel.dev;
|
||||||
|
kernelVersion = kernel.modDirVersion;
|
||||||
|
|
||||||
|
modulePath = "drivers/gpu/drm/amd/amdgpu";
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
|
||||||
|
|
||||||
|
cp $BUILT_KERNEL/Module.symvers .
|
||||||
|
cp $BUILT_KERNEL/.config .
|
||||||
|
cp $kernel_dev/vmlinux .
|
||||||
|
|
||||||
|
make "-j$NIX_BUILD_CORES" modules_prepare
|
||||||
|
make "-j$NIX_BUILD_CORES" M=$modulePath modules
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
make \
|
||||||
|
INSTALL_MOD_PATH="$out" \
|
||||||
|
XZ="xz -T$NIX_BUILD_CORES" \
|
||||||
|
M="$modulePath" \
|
||||||
|
modules_install
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "AMD GPU kernel module";
|
||||||
|
license = lib.licenses.gpl3;
|
||||||
|
};
|
||||||
|
}
|
|
@ -10,6 +10,13 @@
|
||||||
|
|
||||||
{ config, pkgs, inputs, ... }:
|
{ config, pkgs, inputs, ... }:
|
||||||
|
|
||||||
|
# Direct patching to enable async reprojection (for SteamVR) on AMD
|
||||||
|
let
|
||||||
|
amdgpu-kernel-module = pkgs.callPackage ./amdgpu.nix {
|
||||||
|
# Make sure the module targets the same kernel as your system is using.
|
||||||
|
kernel = config.boot.kernelPackages.kernel;
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports =
|
imports =
|
||||||
[ # Include the results of the hardware scan.
|
[ # Include the results of the hardware scan.
|
||||||
|
@ -60,9 +67,15 @@
|
||||||
# kvm-amd - AMD virtualization support
|
# kvm-amd - AMD virtualization support
|
||||||
boot.kernelModules = [ "kvm-amd" "nct6775" ];
|
boot.kernelModules = [ "kvm-amd" "nct6775" ];
|
||||||
|
|
||||||
# Problems with hangs on RX6700
|
# Fix problems with hanging on RX6700 (disables PSR - Panel Self Refresh)
|
||||||
boot.kernelParams = [ "amdgpu.dcdebugmask=0x10" ];
|
boot.kernelParams = [ "amdgpu.dcdebugmask=0x10" ];
|
||||||
|
|
||||||
|
boot.extraModulePackages = [
|
||||||
|
(amdgpu-kernel-module.overrideAttrs (_: {
|
||||||
|
patches = [ ./patches/cap_sys_nice_begone.patch ];
|
||||||
|
}))
|
||||||
|
];
|
||||||
|
|
||||||
# Direct patching for enabling for async reprojection (for SteamVR) on AMD
|
# Direct patching for enabling for async reprojection (for SteamVR) on AMD
|
||||||
# boot.kernelPatches = [
|
# boot.kernelPatches = [
|
||||||
# {
|
# {
|
||||||
|
|
26
hosts/default/patches/cap_sys_nice_begone.patch
Normal file
26
hosts/default/patches/cap_sys_nice_begone.patch
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
From fe059b4c373639fc5d69067e62de3f2a0e44a037 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
|
Date: Fri, 17 Mar 2023 16:50:57 +0100
|
||||||
|
Subject: [PATCH] amdgpu: allow any ctx priority
|
||||||
|
|
||||||
|
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
|
||||||
|
---
|
||||||
|
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
|
||||||
|
index d2139ac12159..c7f1d36329c8 100644
|
||||||
|
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
|
||||||
|
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
|
||||||
|
@@ -107,7 +107,7 @@ static int amdgpu_ctx_priority_permit(struct drm_file *filp,
|
||||||
|
if (drm_is_current_master(filp))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- return -EACCES;
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum amdgpu_gfx_pipe_priority amdgpu_ctx_prio_to_gfx_pipe_prio(int32_t prio)
|
||||||
|
--
|
||||||
|
2.39.2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue