You are not logged in.

#1 2024-10-30 14:17:57

The_Stig
Member
Registered: 2024-10-30
Posts: 5

[SOLVED] BTF compilation error on zen-kernel-6.11.5-zen1

Hello,

I'm trying to patch and compile latest zen-kernel using the ABS guide here: https://wiki.archlinux.org/title/Kernel … ild_system

I've modified the PKGBUILD file to match version, apply patch and add "zero-rpm-patch" tag.
Issue trying to patch: https://gitlab.freedesktop.org/drm/amd/-/issues/3489 - actual patch: https://lists.freedesktop.org/archives/ … 15857.html

Error registered in terminal:

make: se entra en el directorio 'linux/src/zen-kernel-6.11.5-zen1/tools/bpf/bpftool'

  GEN     vmlinux.h
libbpf: failed to find '.BTF' ELF section in linux/src/zen-kernel-6.11.5-zen1/vmlinux
Error: failed to load BTF from linux/src/zen-kernel-6.11.5-zen1/vmlinux: No data available
make: *** [Makefile:209: vmlinux.h] Error 195
make: *** Se borra el archivo 'vmlinux.h'
make: se sale del directorio 'linux/src/zen-kernel-6.11.5-zen1/tools/bpf/bpftool'
==> ERROR: Se produjo un fallo en build().
    Cancelando...

Tried several configurations regarding BTF subsystem and debug options, same result so far.

Any kind of guidance or help it's really appreciated. Many thanks in advance.

Kind regards

Last edited by The_Stig (2024-10-31 14:33:56)

Offline

#2 2024-10-30 14:27:43

gromit
Package Maintainer (PM)
From: Germany
Registered: 2024-02-10
Posts: 658
Website

Re: [SOLVED] BTF compilation error on zen-kernel-6.11.5-zen1

Could you be more specific on how you got that error i.e. which build command you used? Also which diff do you currently have applied to the upstream PKGBUILD?

Online

#3 2024-10-30 17:45:33

The_Stig
Member
Registered: 2024-10-30
Posts: 5

Re: [SOLVED] BTF compilation error on zen-kernel-6.11.5-zen1

gromit wrote:

Could you be more specific on how you got that error i.e. which build command you used? Also which diff do you currently have applied to the upstream PKGBUILD?

Thanks for replying. Here's the diff between the original file and the modified one I'm using:

diff PKGBUILD_BASE.BAK PKGBUILD 
3,4c3,5
< pkgbase=linux
< pkgver=6.11.5.arch1
---
> pkgbase=linux-zen-git-zerorpm-patch
> pkgver=6.11.5.zen1
> realpkgver=6.11.5-zen1
6,7c7,8
< pkgdesc='Linux'
< url='https://github.com/archlinux/linux'
---
> pkgdesc='Linux-Zen-Git Patched'
> url='https://github.com/zen-kernel/zen-kernel'
32c33
< _srcname=linux-${pkgver%.*}
---
> _srcname=zen-kernel-${realpkgver}
35,36c36,38
<   https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.{xz,sign}
<   $url/releases/download/$_srctag/linux-$_srctag.patch.zst{,.sig}
---
>   https://github.com/zen-kernel/zen-kernel/archive/refs/tags/v${realpkgver}.tar.gz
> #  $url/releases/download/$_srctag/linux-$_srctag.patch.zst
>   zero-rpm.patch.zst
39,43c41
< validpgpkeys=(
<   ABAF11C65A2970B130ABE3C479BE3E4300411886  # Linus Torvalds
<   647F28654894E3BD457199BE38DBBDC86092693E  # Greg Kroah-Hartman
<   83BC8889351B5DEBBB68416EB8AC08600F108CDF  # Jan Alexander Steffens (heftig)
< )
---
> 
45,47c43,44
< sha256sums=('471485b3b7f2fb637bd8fe3d00944c4c135c7d8ee02f357f33690baab0752a07'
<             'SKIP'
<             'a2654b42fbca1da939059ae96da323b369f27134aaf149e393f531fb2d8d9aa1'
---
> sha256sums=('SKIP'
> #            'SKIP'
49,54c46,47
<             'fb5245563b6f320007b1dac7e2e2b415e8b5901e4a93337491ddb3134a05e46b')
< b2sums=('8749d9f78cca3d64e97d081b3ededf506c07c7fe894253e7435afb37eb7c86b690a65293fb4b582ecd951229ca61f13679d10197e4629352262db776352b96dc'
<         'SKIP'
<         '89a29006215d5f156e9394271255ce3bb55037bea70174819cd15bc2df31f84d75334a0847fe4c80c8b4e02ddc51066ce16ff14487ae5ba61e420b1469fb9cd8'
<         'SKIP'
<         '2454f23cf2ebfad6ca78d5955b982837351f0c77d5583c806462a62186c7701069981184307d06b038170fed5157b9e1f3270da557c7c1e74bed2f04a7a79044')
---
>             'SKIP')
> #b2sums=('SKIP')
79a73,74
>   echo "Por favor revise la configuración antes de continuar"
>   make menuconfig
88c83,84
<   make all
---
>   make all -j16
> #  make localmodconfig -j10

The base file is this one.

The line producing the error is

  make -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1

I've been searching on the web about this issue and it seems to be related to BPF subsystem options that needs other development options activated to work properly, but I still haven't found the right combination of options for this to work.

Offline

#4 2024-10-30 18:00:21

loqs
Member
Registered: 2014-03-06
Posts: 18,034

Re: [SOLVED] BTF compilation error on zen-kernel-6.11.5-zen1

If you remove the use of `make menuconfig` so you use Arch's config does that work?

@gromit if you have time could you please have a look at https://bbs.archlinux.org/viewtopic.php?id=299945

Offline

#5 2024-10-30 18:46:23

The_Stig
Member
Registered: 2024-10-30
Posts: 5

Re: [SOLVED] BTF compilation error on zen-kernel-6.11.5-zen1

loqs wrote:

If you remove the use of `make menuconfig` so you use Arch's config does that work?

@gromit if you have time could you please have a look at https://bbs.archlinux.org/viewtopic.php?id=299945

Thanks for replying. I added that line so I could try different settings on the config file, arch's config is accepted but compiling ends up in that error anyways.

Offline

#6 2024-10-30 19:20:48

ptr1337
Member
Registered: 2024-09-24
Posts: 9

Re: [SOLVED] BTF compilation error on zen-kernel-6.11.5-zen1

Do you do modifications on the config? Normally this error happens if you disable BTF or any other debug related things in the kernel config.

Offline

#7 2024-10-30 19:32:58

loqs
Member
Registered: 2014-03-06
Posts: 18,034

Re: [SOLVED] BTF compilation error on zen-kernel-6.11.5-zen1

Builds for me a clean chroot with the linked patch applied. diff of changes I made and patch used below:

diff --git a/PKGBUILD b/PKGBUILD
index 8708582..274903f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -34,6 +34,7 @@ _srctag=v${pkgver%.*}-${pkgver##*.}
 source=(
   https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.{xz,sign}
   $url/releases/download/$_srctag/linux-$_srctag.patch.zst{,.sig}
+  zero-rpm.patch
   config  # the main kernel config file
 )
 validpgpkeys=(
@@ -46,11 +47,13 @@ sha256sums=('471485b3b7f2fb637bd8fe3d00944c4c135c7d8ee02f357f33690baab0752a07'
             'SKIP'
             '4a964f479e6ae80ba4c8d2011bcb18d7c3a80c6d6f978150929bb12a6b7fc793'
             'SKIP'
+            'e460972e35f03ff247571849408b1fc000da73f941ac149ccf8b8a7ae1befceb'
             'ecce63909193c800737ef63a9fea49ee7a1c02d7b82ccc7891f9b62c21a842a2')
 b2sums=('8749d9f78cca3d64e97d081b3ededf506c07c7fe894253e7435afb37eb7c86b690a65293fb4b582ecd951229ca61f13679d10197e4629352262db776352b96dc'
         'SKIP'
         'fdcce31ac05993a746e107cc794ae2872daa4a70c5f3319cffa451785835db22a5b0f2d208c458aa44cf263d4dce2dd69bc14bbf7445e962b6441385aec32091'
         'SKIP'
+        'cd277ce5db2cd26f1c204b9a1c332af7f81a8fa2f4d1165e1cf4058edff150d9802a1db77891103b4a2d171558b11138ae2f77382472af3ccb21281bd8fe916d'
         '065415d629861f1942c2d241a8a752fdce2aa00bba2039d87050523c9b68566368b5579c52294c0f7fd1f0b95f5170e79a3dca21796ee706c7fa5324d0b24a58')
 
 export KBUILD_BUILD_HOST=archlinux
diff --git a/zero-rpm.patch b/zero-rpm.patch
new file mode 100644
index 0000000..0bee07e
--- /dev/null
+++ b/zero-rpm.patch
@@ -0,0 +1,385 @@
+ Documentation/gpu/amdgpu/thermal.rst          |  6 ++
+ .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
+ drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 62 +++++++++++++++++++
+ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 +
+ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  2 +
+ drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  1 +
+ .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 55 +++++++++++++++-
+ .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 55 +++++++++++++++-
+ 8 files changed, 183 insertions(+), 2 deletions(-)
+
+diff --git a/Documentation/gpu/amdgpu/thermal.rst b/Documentation/gpu/amdgpu/thermal.rst
+index 6d942b5c5..442b242f9 100644
+--- a/Documentation/gpu/amdgpu/thermal.rst
++++ b/Documentation/gpu/amdgpu/thermal.rst
+@@ -100,6 +100,12 @@ fan_minimum_pwm
+ .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
+    :doc: fan_minimum_pwm
+ 
++fan_zero_rpm
++----------------------
++
++.. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
++   :doc: fan_zero_rpm
++
+ GFXOFF
+ ======
+ 
+diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+index 2fa71f682..c6343e813 100644
+--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
++++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+@@ -119,6 +119,7 @@ enum pp_clock_type {
+ 	OD_ACOUSTIC_TARGET,
+ 	OD_FAN_TARGET_TEMPERATURE,
+ 	OD_FAN_MINIMUM_PWM,
++	OD_FAN_ZERO_RPM,
+ };
+ 
+ enum amd_pp_sensors {
+@@ -199,6 +200,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
+ 	PP_OD_EDIT_ACOUSTIC_TARGET,
+ 	PP_OD_EDIT_FAN_TARGET_TEMPERATURE,
+ 	PP_OD_EDIT_FAN_MINIMUM_PWM,
++	PP_OD_EDIT_FAN_ZERO_RPM,
+ };
+ 
+ struct pp_states_info {
+diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+index ea9407733..52efc5ac6 100644
+--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
++++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+@@ -4109,6 +4109,60 @@ static umode_t fan_minimum_pwm_visible(struct amdgpu_device *adev)
+ 	return umode;
+ }
+ 
++/**
++ * DOC: fan_zero_rpm
++ *
++ * The amdgpu driver provides a sysfs API for checking and adjusting the
++ * zero RPM feature.
++ *
++ * Reading back the file shows you the current setting and the permitted
++ * ranges if changable.
++ *
++ * Writing an integer to the file, change the setting accordingly.
++ *
++ * When you have finished the editing, write "c" (commit) to the file to commit
++ * your changes.
++ *
++ * If you want to reset to the default value, write "r" (reset) to the file to
++ * reset them.
++ */
++static ssize_t fan_zero_rpm_show(struct kobject *kobj,
++					   struct kobj_attribute *attr,
++					   char *buf)
++{
++	struct od_kobj *container = container_of(kobj, struct od_kobj, kobj);
++	struct amdgpu_device *adev = (struct amdgpu_device *)container->priv;
++
++	return (ssize_t)amdgpu_retrieve_od_settings(adev, OD_FAN_ZERO_RPM, buf);
++}
++
++static ssize_t fan_zero_rpm_store(struct kobject *kobj,
++					    struct kobj_attribute *attr,
++					    const char *buf,
++					    size_t count)
++{
++	struct od_kobj *container = container_of(kobj, struct od_kobj, kobj);
++	struct amdgpu_device *adev = (struct amdgpu_device *)container->priv;
++
++	return (ssize_t)amdgpu_distribute_custom_od_settings(adev,
++							     PP_OD_EDIT_FAN_ZERO_RPM,
++							     buf,
++							     count);
++}
++
++static umode_t fan_zero_rpm_visible(struct amdgpu_device *adev)
++{
++	umode_t umode = 0000;
++
++	if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_ZERO_RPM_RETRIEVE)
++		umode |= S_IRUSR | S_IRGRP | S_IROTH;
++
++	if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_ZERO_RPM_SET)
++		umode |= S_IWUSR;
++
++	return umode;
++}
++
+ static struct od_feature_set amdgpu_od_set = {
+ 	.containers = {
+ 		[0] = {
+@@ -4154,6 +4208,14 @@ static struct od_feature_set amdgpu_od_set = {
+ 						.store = fan_minimum_pwm_store,
+ 					},
+ 				},
++				[5] = {
++					.name = "fan_zero_rpm",
++					.ops = {
++						.is_visible = fan_zero_rpm_visible,
++						.show = fan_zero_rpm_show,
++						.store = fan_zero_rpm_store,
++					},
++				},
+ 			},
+ 		},
+ 	},
+diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
+index f5bf41f21..be8de30ae 100644
+--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
++++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
+@@ -328,6 +328,8 @@ struct config_table_setting
+ #define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET		BIT(7)
+ #define OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE		BIT(8)
+ #define OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET		BIT(9)
++#define OD_OPS_SUPPORT_FAN_ZERO_RPM_RETRIEVE		BIT(10)
++#define OD_OPS_SUPPORT_FAN_ZERO_RPM_SET		BIT(11)
+ 
+ struct amdgpu_pm {
+ 	struct mutex		mutex;
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+index accc96a03..3c6b14f7b 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+@@ -2874,6 +2874,8 @@ static enum smu_clk_type smu_convert_to_smuclk(enum pp_clock_type type)
+ 		clk_type = SMU_OD_FAN_TARGET_TEMPERATURE; break;
+ 	case OD_FAN_MINIMUM_PWM:
+ 		clk_type = SMU_OD_FAN_MINIMUM_PWM; break;
++	case OD_FAN_ZERO_RPM:
++		clk_type = SMU_OD_FAN_ZERO_RPM; break;
+ 	default:
+ 		clk_type = SMU_CLK_COUNT; break;
+ 	}
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
+index e71a721c1..4d0558470 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
++++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
+@@ -313,6 +313,7 @@ enum smu_clk_type {
+ 	SMU_OD_ACOUSTIC_TARGET,
+ 	SMU_OD_FAN_TARGET_TEMPERATURE,
+ 	SMU_OD_FAN_MINIMUM_PWM,
++	SMU_OD_FAN_ZERO_RPM,
+ 	SMU_CLK_COUNT,
+ };
+ 
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+index 3e2277abc..092fd4806 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+@@ -107,6 +107,7 @@
+ #define PP_OD_FEATURE_FAN_ACOUSTIC_TARGET		8
+ #define PP_OD_FEATURE_FAN_TARGET_TEMPERATURE		9
+ #define PP_OD_FEATURE_FAN_MINIMUM_PWM			10
++#define PP_OD_FEATURE_FAN_ZERO_RPM			11
+ 
+ #define LINK_SPEED_MAX					3
+ 
+@@ -1130,6 +1131,10 @@ static void smu_v13_0_0_get_od_setting_limits(struct smu_context *smu,
+ 		od_min_setting = overdrive_lowerlimits->FanMinimumPwm;
+ 		od_max_setting = overdrive_upperlimits->FanMinimumPwm;
+ 		break;
++	case PP_OD_FEATURE_FAN_ZERO_RPM:
++		od_min_setting = overdrive_lowerlimits->FanZeroRpmEnable;
++		od_max_setting = overdrive_upperlimits->FanZeroRpmEnable;
++		break;
+ 	default:
+ 		od_min_setting = od_max_setting = INT_MAX;
+ 		break;
+@@ -1450,6 +1455,24 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
+ 				      min_value, max_value);
+ 		break;
+ 
++	case SMU_OD_FAN_ZERO_RPM:
++		if (!smu_v13_0_0_is_od_feature_supported(smu,
++							 PP_OD_FEATURE_ZERO_FAN_BIT))
++			break;
++
++		size += sysfs_emit_at(buf, size, "FAN_ZERO_RPM:\n");
++		size += sysfs_emit_at(buf, size, "%d\n",
++					(int)od_table->OverDriveTable.FanZeroRpmEnable);
++
++		size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
++		smu_v13_0_0_get_od_setting_limits(smu,
++						  PP_OD_FEATURE_FAN_ZERO_RPM,
++						  &min_value,
++						  &max_value);
++		size += sysfs_emit_at(buf, size, "ZERO_RPM: %u %u\n",
++				      min_value, max_value);
++		break;
++
+ 	case SMU_OD_RANGE:
+ 		if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) &&
+ 		    !smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) &&
+@@ -1547,6 +1570,11 @@ static int smu_v13_0_0_od_restore_table_single(struct smu_context *smu, long inp
+ 		od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
+ 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ 		break;
++	case PP_OD_EDIT_FAN_ZERO_RPM:
++		od_table->OverDriveTable.FanZeroRpmEnable =
++					boot_overdrive_table->OverDriveTable.FanZeroRpmEnable;
++		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
++		break;
+ 	default:
+ 		dev_info(adev->dev, "Invalid table index: %ld\n", input);
+ 		return -EINVAL;
+@@ -1840,6 +1868,27 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
+ 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ 		break;
+ 
++	case PP_OD_EDIT_FAN_ZERO_RPM:
++		if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_ZERO_FAN_BIT)) {
++			dev_warn(adev->dev, "Zero RPM setting not supported!\n");
++			return -ENOTSUPP;
++		}
++
++		smu_v13_0_0_get_od_setting_limits(smu,
++						  PP_OD_FEATURE_FAN_ZERO_RPM,
++						  &minimum,
++						  &maximum);
++		if (input[0] < minimum ||
++		    input[0] > maximum) {
++			dev_info(adev->dev, "zero RPM setting(%ld) must be within [%d, %d]!\n",
++				 input[0], minimum, maximum);
++			return -EINVAL;
++		}
++
++		od_table->OverDriveTable.FanZeroRpmEnable = input[0];
++		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
++		break;
++
+ 	case PP_OD_RESTORE_DEFAULT_TABLE:
+ 		if (size == 1) {
+ 			ret = smu_v13_0_0_od_restore_table_single(smu, input[0]);
+@@ -2110,7 +2159,9 @@ static void smu_v13_0_0_set_supported_od_feature_mask(struct smu_context *smu)
+ 					    OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE |
+ 					    OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET |
+ 					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE |
+-					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET;
++					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET |
++					    OD_OPS_SUPPORT_FAN_ZERO_RPM_RETRIEVE|
++					    OD_OPS_SUPPORT_FAN_ZERO_RPM_SET;
+ }
+ 
+ static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
+@@ -2176,6 +2227,8 @@ static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
+ 			user_od_table_bak.OverDriveTable.FanTargetTemperature;
+ 		user_od_table->OverDriveTable.FanMinimumPwm =
+ 			user_od_table_bak.OverDriveTable.FanMinimumPwm;
++		user_od_table->OverDriveTable.FanZeroRpmEnable =
++			user_od_table_bak.OverDriveTable.FanZeroRpmEnable;
+ 	}
+ 
+ 	smu_v13_0_0_set_supported_od_feature_mask(smu);
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+index 23f133884..735ed3d4f 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+@@ -83,6 +83,7 @@
+ #define PP_OD_FEATURE_FAN_ACOUSTIC_TARGET		8
+ #define PP_OD_FEATURE_FAN_TARGET_TEMPERATURE		9
+ #define PP_OD_FEATURE_FAN_MINIMUM_PWM			10
++#define PP_OD_FEATURE_FAN_ZERO_RPM			11
+ 
+ #define LINK_SPEED_MAX					3
+ 
+@@ -1119,6 +1120,10 @@ static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu,
+ 		od_min_setting = overdrive_lowerlimits->FanMinimumPwm;
+ 		od_max_setting = overdrive_upperlimits->FanMinimumPwm;
+ 		break;
++	case PP_OD_FEATURE_FAN_ZERO_RPM:
++		od_min_setting = overdrive_lowerlimits->FanZeroRpmEnable;
++		od_max_setting = overdrive_upperlimits->FanZeroRpmEnable;
++		break;
+ 	default:
+ 		od_min_setting = od_max_setting = INT_MAX;
+ 		break;
+@@ -1439,6 +1444,24 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
+ 				      min_value, max_value);
+ 		break;
+ 
++	case SMU_OD_FAN_ZERO_RPM:
++		if (!smu_v13_0_7_is_od_feature_supported(smu,
++							 PP_OD_FEATURE_ZERO_FAN_BIT))
++			break;
++
++		size += sysfs_emit_at(buf, size, "FAN_ZERO_RPM:\n");
++		size += sysfs_emit_at(buf, size, "%d\n",
++					(int)od_table->OverDriveTable.FanZeroRpmEnable);
++
++		size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
++		smu_v13_0_7_get_od_setting_limits(smu,
++						  PP_OD_FEATURE_FAN_ZERO_RPM,
++						  &min_value,
++						  &max_value);
++		size += sysfs_emit_at(buf, size, "ZERO_RPM: %u %u\n",
++				      min_value, max_value);
++		break;
++
+ 	case SMU_OD_RANGE:
+ 		if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) &&
+ 		    !smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) &&
+@@ -1535,6 +1558,11 @@ static int smu_v13_0_7_od_restore_table_single(struct smu_context *smu, long inp
+ 		od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
+ 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ 		break;
++	case PP_OD_EDIT_FAN_ZERO_RPM:
++		od_table->OverDriveTable.FanZeroRpmEnable =
++					boot_overdrive_table->OverDriveTable.FanZeroRpmEnable;
++		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
++		break;
+ 	default:
+ 		dev_info(adev->dev, "Invalid table index: %ld\n", input);
+ 		return -EINVAL;
+@@ -1828,6 +1856,27 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
+ 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ 		break;
+ 
++	case PP_OD_EDIT_FAN_ZERO_RPM:
++		if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_ZERO_FAN_BIT)) {
++			dev_warn(adev->dev, "Zero RPM setting not supported!\n");
++			return -ENOTSUPP;
++		}
++
++		smu_v13_0_7_get_od_setting_limits(smu,
++						  PP_OD_FEATURE_FAN_ZERO_RPM,
++						  &minimum,
++						  &maximum);
++		if (input[0] < minimum ||
++		    input[0] > maximum) {
++			dev_info(adev->dev, "zero RPM setting(%ld) must be within [%d, %d]!\n",
++				 input[0], minimum, maximum);
++			return -EINVAL;
++		}
++
++		od_table->OverDriveTable.FanZeroRpmEnable = input[0];
++		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
++		break;
++
+ 	case PP_OD_RESTORE_DEFAULT_TABLE:
+ 		if (size == 1) {
+ 			ret = smu_v13_0_7_od_restore_table_single(smu, input[0]);
+@@ -2094,7 +2143,9 @@ static void smu_v13_0_7_set_supported_od_feature_mask(struct smu_context *smu)
+ 					    OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE |
+ 					    OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET |
+ 					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE |
+-					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET;
++					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET |
++					    OD_OPS_SUPPORT_FAN_ZERO_RPM_RETRIEVE|
++					    OD_OPS_SUPPORT_FAN_ZERO_RPM_SET;
+ }
+ 
+ static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
+@@ -2160,6 +2211,8 @@ static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
+ 			user_od_table_bak.OverDriveTable.FanTargetTemperature;
+ 		user_od_table->OverDriveTable.FanMinimumPwm =
+ 			user_od_table_bak.OverDriveTable.FanMinimumPwm;
++		user_od_table->OverDriveTable.FanZeroRpmEnable =
++			user_od_table_bak.OverDriveTable.FanZeroRpmEnable;
+ 	}
+ 
+ 	smu_v13_0_7_set_supported_od_feature_mask(smu);
+
+base-commit: 3631f572ee38bed4c3d0a9003570c63eaa9fd4e3
+-- 
+2.47.0

Offline

#8 2024-10-31 14:33:09

The_Stig
Member
Registered: 2024-10-30
Posts: 5

Re: [SOLVED] BTF compilation error on zen-kernel-6.11.5-zen1

loqs wrote:

Builds for me a clean chroot with the linked patch applied. diff of changes I made and patch used below:

diff --git a/PKGBUILD b/PKGBUILD
index 8708582..274903f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -34,6 +34,7 @@ _srctag=v${pkgver%.*}-${pkgver##*.}
 source=(
   https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/${_srcname}.tar.{xz,sign}
   $url/releases/download/$_srctag/linux-$_srctag.patch.zst{,.sig}
+  zero-rpm.patch
   config  # the main kernel config file
 )
 validpgpkeys=(
@@ -46,11 +47,13 @@ sha256sums=('471485b3b7f2fb637bd8fe3d00944c4c135c7d8ee02f357f33690baab0752a07'
             'SKIP'
             '4a964f479e6ae80ba4c8d2011bcb18d7c3a80c6d6f978150929bb12a6b7fc793'
             'SKIP'
+            'e460972e35f03ff247571849408b1fc000da73f941ac149ccf8b8a7ae1befceb'
             'ecce63909193c800737ef63a9fea49ee7a1c02d7b82ccc7891f9b62c21a842a2')
 b2sums=('8749d9f78cca3d64e97d081b3ededf506c07c7fe894253e7435afb37eb7c86b690a65293fb4b582ecd951229ca61f13679d10197e4629352262db776352b96dc'
         'SKIP'
         'fdcce31ac05993a746e107cc794ae2872daa4a70c5f3319cffa451785835db22a5b0f2d208c458aa44cf263d4dce2dd69bc14bbf7445e962b6441385aec32091'
         'SKIP'
+        'cd277ce5db2cd26f1c204b9a1c332af7f81a8fa2f4d1165e1cf4058edff150d9802a1db77891103b4a2d171558b11138ae2f77382472af3ccb21281bd8fe916d'
         '065415d629861f1942c2d241a8a752fdce2aa00bba2039d87050523c9b68566368b5579c52294c0f7fd1f0b95f5170e79a3dca21796ee706c7fa5324d0b24a58')
 
 export KBUILD_BUILD_HOST=archlinux
diff --git a/zero-rpm.patch b/zero-rpm.patch
new file mode 100644
index 0000000..0bee07e
--- /dev/null
+++ b/zero-rpm.patch
@@ -0,0 +1,385 @@
+ Documentation/gpu/amdgpu/thermal.rst          |  6 ++
+ .../gpu/drm/amd/include/kgd_pp_interface.h    |  2 +
+ drivers/gpu/drm/amd/pm/amdgpu_pm.c            | 62 +++++++++++++++++++
+ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 +
+ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  2 +
+ drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  1 +
+ .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 55 +++++++++++++++-
+ .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 55 +++++++++++++++-
+ 8 files changed, 183 insertions(+), 2 deletions(-)
+
+diff --git a/Documentation/gpu/amdgpu/thermal.rst b/Documentation/gpu/amdgpu/thermal.rst
+index 6d942b5c5..442b242f9 100644
+--- a/Documentation/gpu/amdgpu/thermal.rst
++++ b/Documentation/gpu/amdgpu/thermal.rst
+@@ -100,6 +100,12 @@ fan_minimum_pwm
+ .. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
+    :doc: fan_minimum_pwm
+ 
++fan_zero_rpm
++----------------------
++
++.. kernel-doc:: drivers/gpu/drm/amd/pm/amdgpu_pm.c
++   :doc: fan_zero_rpm
++
+ GFXOFF
+ ======
+ 
+diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+index 2fa71f682..c6343e813 100644
+--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
++++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+@@ -119,6 +119,7 @@ enum pp_clock_type {
+ 	OD_ACOUSTIC_TARGET,
+ 	OD_FAN_TARGET_TEMPERATURE,
+ 	OD_FAN_MINIMUM_PWM,
++	OD_FAN_ZERO_RPM,
+ };
+ 
+ enum amd_pp_sensors {
+@@ -199,6 +200,7 @@ enum PP_OD_DPM_TABLE_COMMAND {
+ 	PP_OD_EDIT_ACOUSTIC_TARGET,
+ 	PP_OD_EDIT_FAN_TARGET_TEMPERATURE,
+ 	PP_OD_EDIT_FAN_MINIMUM_PWM,
++	PP_OD_EDIT_FAN_ZERO_RPM,
+ };
+ 
+ struct pp_states_info {
+diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+index ea9407733..52efc5ac6 100644
+--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
++++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+@@ -4109,6 +4109,60 @@ static umode_t fan_minimum_pwm_visible(struct amdgpu_device *adev)
+ 	return umode;
+ }
+ 
++/**
++ * DOC: fan_zero_rpm
++ *
++ * The amdgpu driver provides a sysfs API for checking and adjusting the
++ * zero RPM feature.
++ *
++ * Reading back the file shows you the current setting and the permitted
++ * ranges if changable.
++ *
++ * Writing an integer to the file, change the setting accordingly.
++ *
++ * When you have finished the editing, write "c" (commit) to the file to commit
++ * your changes.
++ *
++ * If you want to reset to the default value, write "r" (reset) to the file to
++ * reset them.
++ */
++static ssize_t fan_zero_rpm_show(struct kobject *kobj,
++					   struct kobj_attribute *attr,
++					   char *buf)
++{
++	struct od_kobj *container = container_of(kobj, struct od_kobj, kobj);
++	struct amdgpu_device *adev = (struct amdgpu_device *)container->priv;
++
++	return (ssize_t)amdgpu_retrieve_od_settings(adev, OD_FAN_ZERO_RPM, buf);
++}
++
++static ssize_t fan_zero_rpm_store(struct kobject *kobj,
++					    struct kobj_attribute *attr,
++					    const char *buf,
++					    size_t count)
++{
++	struct od_kobj *container = container_of(kobj, struct od_kobj, kobj);
++	struct amdgpu_device *adev = (struct amdgpu_device *)container->priv;
++
++	return (ssize_t)amdgpu_distribute_custom_od_settings(adev,
++							     PP_OD_EDIT_FAN_ZERO_RPM,
++							     buf,
++							     count);
++}
++
++static umode_t fan_zero_rpm_visible(struct amdgpu_device *adev)
++{
++	umode_t umode = 0000;
++
++	if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_ZERO_RPM_RETRIEVE)
++		umode |= S_IRUSR | S_IRGRP | S_IROTH;
++
++	if (adev->pm.od_feature_mask & OD_OPS_SUPPORT_FAN_ZERO_RPM_SET)
++		umode |= S_IWUSR;
++
++	return umode;
++}
++
+ static struct od_feature_set amdgpu_od_set = {
+ 	.containers = {
+ 		[0] = {
+@@ -4154,6 +4208,14 @@ static struct od_feature_set amdgpu_od_set = {
+ 						.store = fan_minimum_pwm_store,
+ 					},
+ 				},
++				[5] = {
++					.name = "fan_zero_rpm",
++					.ops = {
++						.is_visible = fan_zero_rpm_visible,
++						.show = fan_zero_rpm_show,
++						.store = fan_zero_rpm_store,
++					},
++				},
+ 			},
+ 		},
+ 	},
+diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
+index f5bf41f21..be8de30ae 100644
+--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
++++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
+@@ -328,6 +328,8 @@ struct config_table_setting
+ #define OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET		BIT(7)
+ #define OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE		BIT(8)
+ #define OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET		BIT(9)
++#define OD_OPS_SUPPORT_FAN_ZERO_RPM_RETRIEVE		BIT(10)
++#define OD_OPS_SUPPORT_FAN_ZERO_RPM_SET		BIT(11)
+ 
+ struct amdgpu_pm {
+ 	struct mutex		mutex;
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+index accc96a03..3c6b14f7b 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+@@ -2874,6 +2874,8 @@ static enum smu_clk_type smu_convert_to_smuclk(enum pp_clock_type type)
+ 		clk_type = SMU_OD_FAN_TARGET_TEMPERATURE; break;
+ 	case OD_FAN_MINIMUM_PWM:
+ 		clk_type = SMU_OD_FAN_MINIMUM_PWM; break;
++	case OD_FAN_ZERO_RPM:
++		clk_type = SMU_OD_FAN_ZERO_RPM; break;
+ 	default:
+ 		clk_type = SMU_CLK_COUNT; break;
+ 	}
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
+index e71a721c1..4d0558470 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
++++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
+@@ -313,6 +313,7 @@ enum smu_clk_type {
+ 	SMU_OD_ACOUSTIC_TARGET,
+ 	SMU_OD_FAN_TARGET_TEMPERATURE,
+ 	SMU_OD_FAN_MINIMUM_PWM,
++	SMU_OD_FAN_ZERO_RPM,
+ 	SMU_CLK_COUNT,
+ };
+ 
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+index 3e2277abc..092fd4806 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+@@ -107,6 +107,7 @@
+ #define PP_OD_FEATURE_FAN_ACOUSTIC_TARGET		8
+ #define PP_OD_FEATURE_FAN_TARGET_TEMPERATURE		9
+ #define PP_OD_FEATURE_FAN_MINIMUM_PWM			10
++#define PP_OD_FEATURE_FAN_ZERO_RPM			11
+ 
+ #define LINK_SPEED_MAX					3
+ 
+@@ -1130,6 +1131,10 @@ static void smu_v13_0_0_get_od_setting_limits(struct smu_context *smu,
+ 		od_min_setting = overdrive_lowerlimits->FanMinimumPwm;
+ 		od_max_setting = overdrive_upperlimits->FanMinimumPwm;
+ 		break;
++	case PP_OD_FEATURE_FAN_ZERO_RPM:
++		od_min_setting = overdrive_lowerlimits->FanZeroRpmEnable;
++		od_max_setting = overdrive_upperlimits->FanZeroRpmEnable;
++		break;
+ 	default:
+ 		od_min_setting = od_max_setting = INT_MAX;
+ 		break;
+@@ -1450,6 +1455,24 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
+ 				      min_value, max_value);
+ 		break;
+ 
++	case SMU_OD_FAN_ZERO_RPM:
++		if (!smu_v13_0_0_is_od_feature_supported(smu,
++							 PP_OD_FEATURE_ZERO_FAN_BIT))
++			break;
++
++		size += sysfs_emit_at(buf, size, "FAN_ZERO_RPM:\n");
++		size += sysfs_emit_at(buf, size, "%d\n",
++					(int)od_table->OverDriveTable.FanZeroRpmEnable);
++
++		size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
++		smu_v13_0_0_get_od_setting_limits(smu,
++						  PP_OD_FEATURE_FAN_ZERO_RPM,
++						  &min_value,
++						  &max_value);
++		size += sysfs_emit_at(buf, size, "ZERO_RPM: %u %u\n",
++				      min_value, max_value);
++		break;
++
+ 	case SMU_OD_RANGE:
+ 		if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) &&
+ 		    !smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) &&
+@@ -1547,6 +1570,11 @@ static int smu_v13_0_0_od_restore_table_single(struct smu_context *smu, long inp
+ 		od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
+ 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ 		break;
++	case PP_OD_EDIT_FAN_ZERO_RPM:
++		od_table->OverDriveTable.FanZeroRpmEnable =
++					boot_overdrive_table->OverDriveTable.FanZeroRpmEnable;
++		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
++		break;
+ 	default:
+ 		dev_info(adev->dev, "Invalid table index: %ld\n", input);
+ 		return -EINVAL;
+@@ -1840,6 +1868,27 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
+ 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ 		break;
+ 
++	case PP_OD_EDIT_FAN_ZERO_RPM:
++		if (!smu_v13_0_0_is_od_feature_supported(smu, PP_OD_FEATURE_ZERO_FAN_BIT)) {
++			dev_warn(adev->dev, "Zero RPM setting not supported!\n");
++			return -ENOTSUPP;
++		}
++
++		smu_v13_0_0_get_od_setting_limits(smu,
++						  PP_OD_FEATURE_FAN_ZERO_RPM,
++						  &minimum,
++						  &maximum);
++		if (input[0] < minimum ||
++		    input[0] > maximum) {
++			dev_info(adev->dev, "zero RPM setting(%ld) must be within [%d, %d]!\n",
++				 input[0], minimum, maximum);
++			return -EINVAL;
++		}
++
++		od_table->OverDriveTable.FanZeroRpmEnable = input[0];
++		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
++		break;
++
+ 	case PP_OD_RESTORE_DEFAULT_TABLE:
+ 		if (size == 1) {
+ 			ret = smu_v13_0_0_od_restore_table_single(smu, input[0]);
+@@ -2110,7 +2159,9 @@ static void smu_v13_0_0_set_supported_od_feature_mask(struct smu_context *smu)
+ 					    OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE |
+ 					    OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET |
+ 					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE |
+-					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET;
++					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET |
++					    OD_OPS_SUPPORT_FAN_ZERO_RPM_RETRIEVE|
++					    OD_OPS_SUPPORT_FAN_ZERO_RPM_SET;
+ }
+ 
+ static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
+@@ -2176,6 +2227,8 @@ static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
+ 			user_od_table_bak.OverDriveTable.FanTargetTemperature;
+ 		user_od_table->OverDriveTable.FanMinimumPwm =
+ 			user_od_table_bak.OverDriveTable.FanMinimumPwm;
++		user_od_table->OverDriveTable.FanZeroRpmEnable =
++			user_od_table_bak.OverDriveTable.FanZeroRpmEnable;
+ 	}
+ 
+ 	smu_v13_0_0_set_supported_od_feature_mask(smu);
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+index 23f133884..735ed3d4f 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+@@ -83,6 +83,7 @@
+ #define PP_OD_FEATURE_FAN_ACOUSTIC_TARGET		8
+ #define PP_OD_FEATURE_FAN_TARGET_TEMPERATURE		9
+ #define PP_OD_FEATURE_FAN_MINIMUM_PWM			10
++#define PP_OD_FEATURE_FAN_ZERO_RPM			11
+ 
+ #define LINK_SPEED_MAX					3
+ 
+@@ -1119,6 +1120,10 @@ static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu,
+ 		od_min_setting = overdrive_lowerlimits->FanMinimumPwm;
+ 		od_max_setting = overdrive_upperlimits->FanMinimumPwm;
+ 		break;
++	case PP_OD_FEATURE_FAN_ZERO_RPM:
++		od_min_setting = overdrive_lowerlimits->FanZeroRpmEnable;
++		od_max_setting = overdrive_upperlimits->FanZeroRpmEnable;
++		break;
+ 	default:
+ 		od_min_setting = od_max_setting = INT_MAX;
+ 		break;
+@@ -1439,6 +1444,24 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
+ 				      min_value, max_value);
+ 		break;
+ 
++	case SMU_OD_FAN_ZERO_RPM:
++		if (!smu_v13_0_7_is_od_feature_supported(smu,
++							 PP_OD_FEATURE_ZERO_FAN_BIT))
++			break;
++
++		size += sysfs_emit_at(buf, size, "FAN_ZERO_RPM:\n");
++		size += sysfs_emit_at(buf, size, "%d\n",
++					(int)od_table->OverDriveTable.FanZeroRpmEnable);
++
++		size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
++		smu_v13_0_7_get_od_setting_limits(smu,
++						  PP_OD_FEATURE_FAN_ZERO_RPM,
++						  &min_value,
++						  &max_value);
++		size += sysfs_emit_at(buf, size, "ZERO_RPM: %u %u\n",
++				      min_value, max_value);
++		break;
++
+ 	case SMU_OD_RANGE:
+ 		if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_GFXCLK_BIT) &&
+ 		    !smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_UCLK_BIT) &&
+@@ -1535,6 +1558,11 @@ static int smu_v13_0_7_od_restore_table_single(struct smu_context *smu, long inp
+ 		od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
+ 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ 		break;
++	case PP_OD_EDIT_FAN_ZERO_RPM:
++		od_table->OverDriveTable.FanZeroRpmEnable =
++					boot_overdrive_table->OverDriveTable.FanZeroRpmEnable;
++		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
++		break;
+ 	default:
+ 		dev_info(adev->dev, "Invalid table index: %ld\n", input);
+ 		return -EINVAL;
+@@ -1828,6 +1856,27 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
+ 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ 		break;
+ 
++	case PP_OD_EDIT_FAN_ZERO_RPM:
++		if (!smu_v13_0_7_is_od_feature_supported(smu, PP_OD_FEATURE_ZERO_FAN_BIT)) {
++			dev_warn(adev->dev, "Zero RPM setting not supported!\n");
++			return -ENOTSUPP;
++		}
++
++		smu_v13_0_7_get_od_setting_limits(smu,
++						  PP_OD_FEATURE_FAN_ZERO_RPM,
++						  &minimum,
++						  &maximum);
++		if (input[0] < minimum ||
++		    input[0] > maximum) {
++			dev_info(adev->dev, "zero RPM setting(%ld) must be within [%d, %d]!\n",
++				 input[0], minimum, maximum);
++			return -EINVAL;
++		}
++
++		od_table->OverDriveTable.FanZeroRpmEnable = input[0];
++		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
++		break;
++
+ 	case PP_OD_RESTORE_DEFAULT_TABLE:
+ 		if (size == 1) {
+ 			ret = smu_v13_0_7_od_restore_table_single(smu, input[0]);
+@@ -2094,7 +2143,9 @@ static void smu_v13_0_7_set_supported_od_feature_mask(struct smu_context *smu)
+ 					    OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_RETRIEVE |
+ 					    OD_OPS_SUPPORT_FAN_TARGET_TEMPERATURE_SET |
+ 					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_RETRIEVE |
+-					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET;
++					    OD_OPS_SUPPORT_FAN_MINIMUM_PWM_SET |
++					    OD_OPS_SUPPORT_FAN_ZERO_RPM_RETRIEVE|
++					    OD_OPS_SUPPORT_FAN_ZERO_RPM_SET;
+ }
+ 
+ static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
+@@ -2160,6 +2211,8 @@ static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
+ 			user_od_table_bak.OverDriveTable.FanTargetTemperature;
+ 		user_od_table->OverDriveTable.FanMinimumPwm =
+ 			user_od_table_bak.OverDriveTable.FanMinimumPwm;
++		user_od_table->OverDriveTable.FanZeroRpmEnable =
++			user_od_table_bak.OverDriveTable.FanZeroRpmEnable;
+ 	}
+ 
+ 	smu_v13_0_7_set_supported_od_feature_mask(smu);
+
+base-commit: 3631f572ee38bed4c3d0a9003570c63eaa9fd4e3
+-- 
+2.47.0
ptr1337 wrote:

Do you do modifications on the config? Normally this error happens if you disable BTF or any other debug related things in the kernel config.

Thank you very much for replying. I finally managed to compile the kernel this morning. Turns out I had some options active by default in my kernel config:

#
# Compile-time checks and compiler options
#
CONFIG_DEBUG_INFO=y
CONFIG_AS_HAS_NON_CONST_ULEB128=y
# CONFIG_DEBUG_INFO_NONE is not set
# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
# CONFIG_DEBUG_INFO_DWARF4 is not set
CONFIG_DEBUG_INFO_DWARF5=y
CONFIG_DEBUG_INFO_REDUCED=y
# CONFIG_DEBUG_INFO_COMPRESSED_NONE is not set
# CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set
CONFIG_DEBUG_INFO_COMPRESSED_ZSTD=1
CONFIG_DEBUG_INFO_SPLIT=y
CONFIG_DEBUG_INFO_BTF=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
# CONFIG_DEBUG_INFO_BTF_MODULES is not set
# CONFIG_MODULE_ALLOW_BTF_MISMATCH is not set
CONFIG_GDB_SCRIPTS=y
CONFIG_FRAME_WARN=2048
CONFIG_STRIP_ASM_SYMS=y
# CONFIG_READABLE_ASM is not set
# CONFIG_HEADERS_INSTALL is not set
# CONFIG_DEBUG_SECTION_MISMATCH is not set
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
CONFIG_OBJTOOL=y
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# end of Compile-time checks and compiler options 

This option set resulted in successful compilation:

#
# Compile-time checks and compiler options
#
CONFIG_DEBUG_INFO=y
CONFIG_AS_HAS_NON_CONST_ULEB128=y
# CONFIG_DEBUG_INFO_NONE is not set
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
# CONFIG_DEBUG_INFO_DWARF4 is not set
# CONFIG_DEBUG_INFO_DWARF5 is not set
# CONFIG_DEBUG_INFO_REDUCED is not set
CONFIG_DEBUG_INFO_COMPRESSED_NONE=y
# CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set
# CONFIG_DEBUG_INFO_COMPRESSED_ZSTD is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_BTF=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
CONFIG_DEBUG_INFO_BTF_MODULES=y
# CONFIG_MODULE_ALLOW_BTF_MISMATCH is not set
CONFIG_GDB_SCRIPTS=y
CONFIG_FRAME_WARN=2048
CONFIG_STRIP_ASM_SYMS=y
# CONFIG_READABLE_ASM is not set
# CONFIG_HEADERS_INSTALL is not set
# CONFIG_DEBUG_SECTION_MISMATCH is not set
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
CONFIG_OBJTOOL=y
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# end of Compile-time checks and compiler options 

Still don't know how or when that section was changed since I copied the config from the precompiled zen kernel I was running, and used it as base to tune very few options like architecture specifics or scheduler options. Anyway, while researching I found more people having this issue in other forums, so I hope this helps.

Thank you all very much for your quick and helpful responses. Adding solved tag to the title.

Last edited by The_Stig (2024-10-31 14:36:00)

Offline

Board footer

Powered by FluxBB