mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 01:29:24 +08:00
modules.system.kernel: add amdgpu patch
This commit is contained in:
83
modules/system/kernel/amdgpu.patch
Normal file
83
modules/system/kernel/amdgpu.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
From 1fb710793ce2619223adffaf981b1ff13cd48f17 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Thu, 18 Sep 2025 19:48:00 -0500
|
||||
Subject: [PATCH] drm/amdgpu: Enable MES lr_compute_wa by default
|
||||
|
||||
The MES set resources packet has an optional bit 'lr_compute_wa'
|
||||
which can be used for preventing MES hangs on long compute jobs.
|
||||
|
||||
Set this bit by default.
|
||||
|
||||
Co-developed-by: Yifan Zhang <yifan1.zhang@amd.com>
|
||||
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
|
||||
Acked-by: Alex Deucher <alexander.deucher@amd.com>
|
||||
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
|
||||
---
|
||||
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 6 ++++++
|
||||
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 5 +++++
|
||||
drivers/gpu/drm/amd/include/mes_v11_api_def.h | 3 ++-
|
||||
drivers/gpu/drm/amd/include/mes_v12_api_def.h | 3 ++-
|
||||
4 files changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
|
||||
index 3b91ea601add41..e82188431f7969 100644
|
||||
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
|
||||
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
|
||||
@@ -713,6 +713,12 @@ static int mes_v11_0_set_hw_resources(struct amdgpu_mes *mes)
|
||||
mes_set_hw_res_pkt.enable_reg_active_poll = 1;
|
||||
mes_set_hw_res_pkt.enable_level_process_quantum_check = 1;
|
||||
mes_set_hw_res_pkt.oversubscription_timer = 50;
|
||||
+ if ((mes->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x7f)
|
||||
+ mes_set_hw_res_pkt.enable_lr_compute_wa = 1;
|
||||
+ else
|
||||
+ dev_info_once(mes->adev->dev,
|
||||
+ "MES FW version must be >= 0x7f to enable LR compute workaround.\n");
|
||||
+
|
||||
if (amdgpu_mes_log_enable) {
|
||||
mes_set_hw_res_pkt.enable_mes_event_int_logging = 1;
|
||||
mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr =
|
||||
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
|
||||
index 998893dff08e93..aff06f06aeeecf 100644
|
||||
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
|
||||
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
|
||||
@@ -769,6 +769,11 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes, int pipe)
|
||||
mes_set_hw_res_pkt.use_different_vmid_compute = 1;
|
||||
mes_set_hw_res_pkt.enable_reg_active_poll = 1;
|
||||
mes_set_hw_res_pkt.enable_level_process_quantum_check = 1;
|
||||
+ if ((mes->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 0x82)
|
||||
+ mes_set_hw_res_pkt.enable_lr_compute_wa = 1;
|
||||
+ else
|
||||
+ dev_info_once(adev->dev,
|
||||
+ "MES FW version must be >= 0x82 to enable LR compute workaround.\n");
|
||||
|
||||
/*
|
||||
* Keep oversubscribe timer for sdma . When we have unmapped doorbell
|
||||
diff --git a/drivers/gpu/drm/amd/include/mes_v11_api_def.h b/drivers/gpu/drm/amd/include/mes_v11_api_def.h
|
||||
index 15680c3f49704e..ab1cfc92dbeb1b 100644
|
||||
--- a/drivers/gpu/drm/amd/include/mes_v11_api_def.h
|
||||
+++ b/drivers/gpu/drm/amd/include/mes_v11_api_def.h
|
||||
@@ -238,7 +238,8 @@ union MESAPI_SET_HW_RESOURCES {
|
||||
uint32_t enable_mes_sch_stb_log : 1;
|
||||
uint32_t limit_single_process : 1;
|
||||
uint32_t is_strix_tmz_wa_enabled :1;
|
||||
- uint32_t reserved : 13;
|
||||
+ uint32_t enable_lr_compute_wa : 1;
|
||||
+ uint32_t reserved : 12;
|
||||
};
|
||||
uint32_t uint32_t_all;
|
||||
};
|
||||
diff --git a/drivers/gpu/drm/amd/include/mes_v12_api_def.h b/drivers/gpu/drm/amd/include/mes_v12_api_def.h
|
||||
index c04bd351b2505d..69611c7e30e355 100644
|
||||
--- a/drivers/gpu/drm/amd/include/mes_v12_api_def.h
|
||||
+++ b/drivers/gpu/drm/amd/include/mes_v12_api_def.h
|
||||
@@ -287,7 +287,8 @@ union MESAPI_SET_HW_RESOURCES {
|
||||
uint32_t limit_single_process : 1;
|
||||
uint32_t unmapped_doorbell_handling: 2;
|
||||
uint32_t enable_mes_fence_int: 1;
|
||||
- uint32_t reserved : 10;
|
||||
+ uint32_t enable_lr_compute_wa : 1;
|
||||
+ uint32_t reserved : 9;
|
||||
};
|
||||
uint32_t uint32_all;
|
||||
};
|
||||
@@ -76,6 +76,7 @@ inputs:
|
||||
};
|
||||
structuredExtraConfig.BTRFS_EXPERIMENTAL = inputs.lib.kernel.yes;
|
||||
}];
|
||||
amdgpu = [{ name = "amdgpu"; patch = ./amdgpu.patch; }];
|
||||
};
|
||||
in builtins.concatLists (builtins.map (name: patches.${name}) kernel.patches);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user