What can be done to make it work in Secure Boot mode? # sudo ryzenadj --power-saving pcilib: sysfs_write: write failed: Operation not permitted pcilib: sysfs_write: write failed: Operation not permitted pcilib: sysfs_write: write failed: Operation not permitted pcilib: sysfs_write: write failed: Operation not permitted pcilib: sysfs_write: write failed: Operation not permitted PCI Bus is not writeable, check secure boot Faild to get SMU, SMU_TYPE: 0 Unable to get MP1 SMU Obj Unable to init ryzenadj results in: Lockdown: ryzenadj: direct PCI access is restricted; see man kernel_lockdown.7 Lockdown: ryzenadj: direct PCI access is restricted; see man kernel_lockdown.7 Lockdown: ryzenadj: direct PCI access is restricted; see man kernel_lockdown.7 Lockdown: ryzenadj: direct PCI access is restricted; see man kernel_lockdown.7 Lockdown: ryzenadj: direct PCI access is restricted; see man kernel_lockdown.7 I asked this question 8 years ago, however I don't remember how it all ended. Back then it was a different low level utility for Intel CPUs. Most features ryzenadj configures are not exposed via any kernel interfaces: setting maximum operating temperature, setting power consumption limits, etc. etc. etc. Is it possible to whitelist the PCI memory region it works with?
Mario, This bug will probably never be resolved just like the previous one, so at the very least I would love to see the options (/sys files) to: -a, --stapm-limit=<u32> Sustained Power Limit - STAPM LIMIT (mW) -b, --fast-limit=<u32> Actual Power Limit - PPT LIMIT FAST (mW) -c, --slow-limit=<u32> Average Power Limit - PPT LIMIT SLOW (mW) -d, --slow-time=<u32> Slow PPT Constant Time (s) -e, --stapm-time=<u32> STAPM constant time (s) -f, --tctl-temp=<u32> Tctl Temperature Limit (degree C) --apu-skin-temp=<u32> APU Skin Temperature Limit - STT LIMIT APU (degree C) --dgpu-skin-temp=<u32> dGPU Skin Temperature Limit - STT LIMIT dGPU (degree C) --power-saving Hidden options to improve power efficiency (is set when AC unplugged): behavior depends on CPU generation, Device and Manufacture --max-performance Hidden options to improve performance (is set when AC plugged in): behavior depends on CPU generation, Device and Manufacture AFAIK nothing is exposed at the moment which is a huge bummer. I don't like my APU running at 100C while consuming ~51W. It doesn't look safe. I don't know which registers RyzenAdj writes to to enable `--power-saving` mode but it cuts idle power consumption for my 7840HS in half, so I really want to get it as well.
> I don't know which registers RyzenAdj writes to to enable `--power-saving` > mode but it cuts idle power consumption for my 7840HS in half, so I really > want to get it as well. It's actually more than that. By default my 7840HS APU idles around 4W. With --power-saving enabled it's down to 0.4W. There's a massive difference in temperatures as well. 49C vs 43C. I've gone ahead and simply disabled Secure Boot. It's near useless under Linux anyways considering only the kernel and its modules are signed and the entire user space is not. I guess what I'm asking for will never be implemented because of "trade secrets" and other considerations. Here's what the utility does: # ryzenadj --power-saving SMU_SERVICE REQ_ID:0x12 SMU_SERVICE REQ: arg0: 0x0, arg1:0x0, arg2:0x0, arg3:0x0, arg4: 0x0, arg5: 0x0 SMU_SERVICE REP: REP: 0x1, arg0: 0x0, arg1:0x0, arg2:0x0, arg3:0x0, arg4: 0x0, arg5: 0x0 Sucessfully enable power_saving I really hope AMD Linux engineers could implement a /sys knob to enable that. And I decided not to limit PPT but limit the upper temperature instead: # ryzenadj --tctl-temp=85 SMU_SERVICE REQ_ID:0x19 SMU_SERVICE REQ: arg0: 0x55, arg1:0x0, arg2:0x0, arg3:0x0, arg4: 0x0, arg5: 0x0 SMU_SERVICE REP: REP: 0x1, arg0: 0x55, arg1:0x0, arg2:0x0, arg3:0x0, arg4: 0x0, arg5: 0x0 Sucessfully set tctl_temp to 85 Again, would be great to see a knob for that along with allowing to limit PPT (power consumption).
Can you please share an acpidump and a dmesg with dynamic debugging enabled for amd-pmf? I need to better understand some things about your system.
Created attachment 304688 [details] acpidump (In reply to Mario Limonciello (AMD) from comment #3) > Can you please share an acpidump and a dmesg with dynamic debugging enabled > for amd-pmf? I'm using Fedora's kernel, does that mean I'll have to build my own? I've checked the module and debugging must be enabled during config time. > > I need to better understand some things about your system. acpidump is attached. I've just found out that after suspend/resume --power-saving cancels and I need to rerun the utility to activate it.
Created attachment 304689 [details] CPU frequency global Limit enforced by BIOS Lastly, I've emailed you personally but looks like the email never reached you: my laptop's firmware restricts my CPU operating frequency to 4.5GHz. I've tried to contact HP five times already but I cannot pass through their first line of support, consecutively they are not aware of the limitation and they will probably never lift/fix it. I know AMD has people who work with OEMs, is it possible to get in touch with them to force HP release fixed firmware? There's seemingly nothing I can do from my side. https://www.hwinfo.com/forum/threads/frequency-limit-global-for-ryzen-7-7840hs-zen-4-phoenix-cpu.9044/
> acpidump Name (_HID, "AMDI0102") // _HID: Hardware ID Your system should be using amd-pmf for managing some power states. I need to see your dmesg with amd-pmf dynamic debugging to comment further. > I'm using Fedora's kernel, does that mean I'll have to build my own? I've > checked the module and debugging must be enabled during config time. Fedora's kernel is fine for what I'm asking [1]. You just need to add amd_pmf.dyndbg=+p to your kernel command line or `rmmod amd-pmf` followed by `modprobe amd-pmf dyndbg=+p` [1] https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html > Lastly, I've emailed you personally but looks like the email never reached > you: my laptop's firmware restricts my CPU operating frequency to 4.5GHz. > I've tried to contact HP five times already but I cannot pass through their > first line of support, consecutively they are not aware of the limitation and > they will probably never lift/fix it. I didn't receive this message, but as I said I don't have enough information about the whole picture of your laptop to comment on it.
(In reply to Mario Limonciello (AMD) from comment #6) > > acpidump > > Name (_HID, "AMDI0102") // _HID: Hardware ID > > Your system should be using amd-pmf for managing some power states. I need > to see your dmesg with amd-pmf dynamic debugging to comment further. > > > I'm using Fedora's kernel, does that mean I'll have to build my own? I've > > checked the module and debugging must be enabled during config time. > > Fedora's kernel is fine for what I'm asking [1]. You just need to add > amd_pmf.dyndbg=+p to your kernel command line or `rmmod amd-pmf` followed by > `modprobe amd-pmf dyndbg=+p` [ 205.216161] amd-pmf AMDI0102:00: registered PMF device successfully [45870.908318] amd-pmf AMDI0102:00: supported functions:0xe0c3 notifications:0x10 [45870.908366] amd-pmf AMDI0102:00: system params mask:0x3 flags:0x1 cmd_code:0x0 heartbeat:60 [45870.908375] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS [45870.908461] amd-pmf AMDI0102:00: registered PMF device successfully [45933.040354] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS [45994.483802] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS > > [1] > https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html > > > Lastly, I've emailed you personally but looks like the email never reached > > you: my laptop's firmware restricts my CPU operating frequency to 4.5GHz. > > I've tried to contact HP five times already but I cannot pass through their > > first line of support, consecutively they are not aware of the limitation > and > > they will probably never lift/fix it. > > I didn't receive this message, but as I said I don't have enough information > about the whole picture of your laptop to comment on it. Please check the attached screenshot, it says it all. I'm ready to provide any info you need including a root shell to my laptop if needed.
This message amd-pmf AMDI0102:00: Sending heartbeat to SBIOS gets repeated almost every 60 seconds: [45933.040354] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS [45994.483802] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS [46055.926823] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS [46117.369459] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS [46178.812572] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS [46240.255525] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS [46301.698908] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS Though it's far from exact 60 seconds.
> [ 205.216161] amd-pmf AMDI0102:00: registered PMF device successfully > [45870.908318] amd-pmf AMDI0102:00: supported functions:0xe0c3 > notifications:0x10 > [45870.908366] amd-pmf AMDI0102:00: system params mask:0x3 flags:0x1 > cmd_code:0x0 heartbeat:60 > [45870.908375] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS > [45870.908461] amd-pmf AMDI0102:00: registered PMF device successfully > [45933.040354] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS > [45994.483802] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS Your system is similar to the bug report https://bugzilla.kernel.org/show_bug.cgi?id=217571 It supports PMF FN8. That is these two patches may help: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=review-hans&id=25e3e5ba62e55b156ec0077211451241256ccba5 https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=review-hans&id=747fb5141bb12f271b528a2ef0d25e50f85945bf They will enable SPS for EC notification. This turns on ACPI platform profile support as well. See if that improves things when you select "power saver" in power-profile-daemon. > Please check the attached screenshot, it says it all. I'm sorry; but it doesn't. PMF works as a coordination between many components not just the APU. That's why I wanted to see the dynamic debugging output. > amd-pmf AMDI0102:00: Sending heartbeat to SBIOS > gets repeated almost every 60 seconds: > [45933.040354] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS Yes; this is expected.
(In reply to Mario Limonciello (AMD) from comment #9) > > [ 205.216161] amd-pmf AMDI0102:00: registered PMF device successfully > > [45870.908318] amd-pmf AMDI0102:00: supported functions:0xe0c3 > > notifications:0x10 > > [45870.908366] amd-pmf AMDI0102:00: system params mask:0x3 flags:0x1 > > cmd_code:0x0 heartbeat:60 > > [45870.908375] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS > > [45870.908461] amd-pmf AMDI0102:00: registered PMF device successfully > > [45933.040354] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS > > [45994.483802] amd-pmf AMDI0102:00: Sending heartbeat to SBIOS > > Your system is similar to the bug report > https://bugzilla.kernel.org/show_bug.cgi?id=217571 I've no problems with frequency scaling. Also it looks like the OP uses amd-pstate and I use acpi-cpufreq since amd-pstate is not enabled by default. Under the specific AMD driver idle power consumption without RyzenAdj remains very equally high. > > It supports PMF FN8. > > That is these two patches may help: > > https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86. > git/commit/?h=review-hans&id=25e3e5ba62e55b156ec0077211451241256ccba5 > https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86. > git/commit/?h=review-hans&id=747fb5141bb12f271b528a2ef0d25e50f85945bf Is the second patch queued for 6.5? I wouldn't want to compile the kernel just yet but I can check Fedora's 6.5-rc3. > > They will enable SPS for EC notification. This turns on ACPI platform > profile support as well. > See if that improves things when you select "power saver" in > power-profile-daemon. > > > Please check the attached screenshot, it says it all. > > I'm sorry; but it doesn't. PMF works as a coordination between many > components not just the APU. That's why I wanted to see the dynamic > debugging output. My laptop hits a 4.5GHz frequency wall under Windows 10, Windows 11 and Linux despite power consumption or temperature which are far below this system limits ~51W/100C. I've now tried to open five support requests with HP but they don't even want to confirm the bug. I hoped you would ask me to provide certain CPU registers values to confirm it's a firmware limit. A HWiNFO64 developer refused to confirm the bug citing the global CPU frequency limit confidentiality/NDA: https://www.hwinfo.com/forum/threads/frequency-limit-global-for-ryzen-7-7840hs-zen-4-phoenix-cpu.9044/post-40967
Could you explain the nature of the second patch? From its description I understood nothing at all. Does it fix (improve) very high idle power consumption? Why is it needed? I don't think it'll help me break through the frequency wall my laptop's firmware is imposing on me.
> I've no problems with frequency scaling. Also it looks like the OP uses > amd-pstate and I use acpi-cpufreq since amd-pstate is not enabled by default. > Under the specific AMD driver idle power consumption without RyzenAdj remains > very equally high. amd-pstate vs acpi-cpufreq is actually irrelevant for the issue at hand. From your debug log I believe the issue is that for your machine a component outside of the Linux kernel is supposed to influence power targets. It's either the EC or something that runs in the APU's TEE environment. More on this later in my response. > Is the second patch queued for 6.5? I wouldn't want to compile the kernel > just yet but I can check Fedora's 6.5-rc3. No it's not in 6.5 right now. Hans is OOO, but I expect will be queued for a future 6.5-rc when he returns. > Could you explain the nature of the second patch? From its description I > understood nothing at all. In Linux the static power slider (SPS) is exported from amd-pmf as an ACPI platform profile. Power-profiles daemon uses this to let you pick "Power saver", "balanced" or "performance" modes. Until that patch SPS is only exported if targets are adjustable directly via PMF driver. But your system advertises that power slider changes should notify the SBIOS because your system doesn't adjust targets via the PMF driver. > Does it fix (improve) very high idle power consumption? Why is it needed? I > don't think it'll help me break through the frequency wall my laptop's > firmware is imposing on me. I don't have visibility into your EC code, but if it's by EC the patch will fix it when you pick "power saver" or "performance" in power profiles daemon. If the EC doesn't do it, it will probably require some code that we'll be releasing later for some other PMF features.
Thanks a ton for you help and replies, Mario. Applying patch to Fedora's kernel has proved to be an insurmountable task for me - I've no idea how to build it: rpmbuild --rebuild fails with a ton of errors. Let's get back to this bug a bit later if you don't mind. I have no mental strength to build a kernel for my laptop just yet. I've always done it for my desktop PC but laptops are a whole different beast. It looks like the provided patch must work with 6.4 which makes it easier for me but again later.
No worry. Look forward to your results later.
OK, I'm now running the system with the patched amd-pmf driver. I've no idea what the power profile daemon is. Is there a /sys interface to alter power profiles? There are over 1000 files in /sys named '*power*', I'm lost and not a lot called "profile". There's /sys/firmware/acpi/platform_profile which now contains "balanced". /sys/firmware/acpi/platform_profile_choices contains: low_power balanced performance OK, let's try "performance". Still stuck at 4.5GHz. There's also /sys/firmware/acpi/pm_profile which has "2" in it. No idea what that is. P.S. What's worst of all I cannot make my touchpad work. With Fedora's kernel I get this: input: ELAN07A8:00 04F3:31EC Mouse as /devices/platform/AMDI0010:00/i2c-0/i2c-ELAN07A8:00/0018:04F3:31EC.0001/input/input5 input: ELAN07A8:00 04F3:31EC Touchpad as /devices/platform/AMDI0010:00/i2c-0/i2c-ELAN07A8:00/0018:04F3:31EC.0001/input/input7 hid-generic 0018:04F3:31EC.0001: input,hidraw0: I2C HID v1.00 Mouse [ELAN07A8:00 04F3:31EC] on i2c-ELAN07A8:00 input: ELAN07A8:00 04F3:31EC Mouse as /devices/platform/AMDI0010:00/i2c-0/i2c-ELAN07A8:00/0018:04F3:31EC.0001/input/input9 input: ELAN07A8:00 04F3:31EC Touchpad as /devices/platform/AMDI0010:00/i2c-0/i2c-ELAN07A8:00/0018:04F3:31EC.0001/input/input11 hid-multitouch 0018:04F3:31EC.0001: input,hidraw0: I2C HID v1.00 Mouse [ELAN07A8:00 04F3:31EC] on i2c-ELAN07A8:00 With my custom compiled kernel I get none of these messages. I'm missing some kernel options obviously but I've no idea which.
Artem, you can take Fedora's kernel config as a start for your local build kernel, copy it over the .config file and then run "make oldconfig". You can find Fedora's kernel config e.g. here: /lib/modules/6.4.4-200.fc38.x86_64/config
You might also check if CONFIG_I2C_HID and CONFIG_I2C_HID_ACPI enabled.
The touchpad troubles have been solved - I needed to enable far from obvious options: CONFIG_PINCTRL_AMD=y CONFIG_I2C_DESIGNWARE_PLATFORM=m CONFIG_I2C_DESIGNWARE_AMDPSP=y Thanks to the person who created this page: https://wiki.gentoo.org/wiki/HP_Elitebook_845_G10 Sorry for the noise.
> /sys/firmware/acpi/platform_profile which now contains "balanced". > /sys/firmware/acpi/platform_profile_choices contains: > low_power balanced performance OK good news and bad news. * The good news: this means the patch "works" and you're now seeing the extra values for power slider notifications. * The bad news: It appears that HP's EC doesn't do "all" the power state change notifications. Some of it is handled by code that runs in the APU's TEE environment. > [45870.908318] amd-pmf AMDI0102:00: supported functions:0xe0c3 > notifications:0x10 There are some other bits not yet supported by amd-pmf in Linux. Let's leave this issue opened until that code is submitted.
I'm a little bit lost in all of that. Originally I was looking for a way to control my APU TDP(TTP) and maximum temperature threshold *without* using ryzenadj because CPU control registers are locked in secure boot mode. The second issue is my 7840HS never going above 4.5GHZ either in Linux or Windows. Trusted Execution Environment (TEE) or not I wonder if my firmware is simply buggy and there's an artificial CPU frequency limit set by HP for no reasons and whether I should continue pushing them to released fixed firmware or if your fellow AMD engineers could politely ask HP to remove the restriction.
The patched driver outputs slightly different debug messages: amd-pmf AMDI0102:00: registered PMF device successfully amd-pmf AMDI0102:00: supported functions:0xe0c3 notifications:0x10 amd-pmf AMDI0102:00: system params mask:0x3 flags:0x1 cmd_code:0x0 heartbeat:60 amd-pmf AMDI0102:00: Failed to register SPS support, this is most likely an SBIOS bug: -17 amd-pmf AMDI0102:00: SPS enabled and Platform Profiles registered amd-pmf AMDI0102:00: registered PMF device successfully amd-pmf AMDI0102:00: Sending heartbeat to SBIOS
> The patched driver outputs slightly different debug messages: This looks correct to me now for what amd-pmf can support today. > Originally I was looking for a way to control my APU TDP(TTP) and maximum > temperature threshold *without* using ryzenadj because CPU control registers > are locked in secure boot mode. This isn't something AMD supports. The APU coefficients are set by system designers in their firmware as a result of the hardware design decisions. That's why I'm fixating on getting the method of coefficient configuration working. Some OEMs do it entirely in their EC, some do it entirely in PMF, some do a combination and some it with the involvement of code running in TEE. We will need to wait until the other bits are supported by amd-pmf to revisit this issue.
Please disregard unless you have spare time and kindness in your heart. ------------------------------------------------------------ It has just dawned on me that I had one more request as part of this bug report and that was getting my APU to the optimized power saving mode enabled by ryzenadj --power-saving which is also impossible with Secure Boot mode on Linux. I raised the issue of reprogramming CPU registers for Intel systems 7 years ago on LKML because I was in the exact same situation and that is I needed direct access to be able to contain my system temperatures, now 7 years later AMD gives me the same grim and depressing response: "You want to use Linux with secure boot? Enjoy much higher system temps, noisier fans and reduced fan life". Why does "open" Linux allow so much less freedom to tune my system than the ostensibly closed OS? Under Windows with Secure Boot I have the full freedom to use RyzenAdj, ThrottleStop, ZenTimings, RyzenTuner, AMD's own Ryzen Master (which does exactly that BTW) and a ton of other low level utilities to tune and monitor my system. Please do not take this personally but sometimes I just get extremely frustrated with using Linux (been using it for over 25 years now). I'm not demanding to implement hypothetical Vulkan 2.0 spec, I'm not asking something outlandish. I'm asking to expose a feature you've got full control over and which probably takes 100 lines of code to implement. Is it also about "trade secrets"? You can perfectly hide it behind scary looking module options, can't you? E.g. i_am_ok_with_destroying_my_system_and_setting_my_house_on_fire=1 Laptops users have no say in what their OEMs/vendors push on them. I cannot go and ask HP to add these options to BIOS, it's just not possible. I will be ignored completely. Oddly enough smaller vendors have been adding memory tuning options to barebones based on Ryzen APUs, e.g. Minisforum UM790 Pro 7940HS Mini PC. I guess this is not going to happen ever with the likes of Dell, HP, ASUS, Lenovo, Samsung, etc. Maybe with MSI.
I'm a Linux guy myself and I fully understand and appreciate your request. As much as I hate to play the "outside of my pay grade" card, this is the reality of the ecosystem today. I will raise the concern with some internal people, but please understand that it's not up to me alone. I would also like to drop a really interesting link for you. Some vendors *do* let you toy around with coefficients. Here's an example: https://github.com/FrameworkComputer/EmbeddedController/blob/lotus-zephyr/zephyr/program/lotus/azalea/src/cpu_power.c
It would help if AMD could publish some sort of official documentation regarding the interface used by the "Ryzen Master" utility, because then a proper driver could be implemented. For example, the k10temp driver once was able to monitor voltage/current sensors on ryzen processors. This feature however was removed after it caused problems on some systems and the register locations where experimental at best. Without some sort of documentation, the risk of causing an accidental killer poke is too high.
(In reply to Armin Wolf from comment #25) > It would help if AMD could publish some sort of official documentation > regarding the interface used by the "Ryzen Master" utility, because then a > proper driver could be implemented. For example, the k10temp driver once was > able to monitor voltage/current sensors on ryzen processors. This feature > however was removed after it caused problems on some systems and the > register locations where experimental at best. Without some sort of > documentation, the risk of causing an accidental killer poke is too high. Unfortunately, it would probably take as much effort to prepare appropriate documentation for public consumption as it would to actually implement support. Comes down to resources.
Dear Mario Limonciello and Alex Deucher, I've discovered multiple other HP laptops affected by the issue of AMD Phoenix APUs never reaching their advertised boost speeds. It's not about Linux AMD PMF driver, it's under Windows: HP OMEN by HP Gaming Laptop 16-xd0xxx, 7840HS - 4619MHz limit https://browser.geekbench.com/v6/cpu/1868206.gb6 HP HP ZBook Power 15.6 inch G10 A Mobile Workstation PC, 7840HS - 4500MHz limit https://browser.geekbench.com/v6/cpu/2027018.gb6 HP Victus by HP Gaming Laptop 16-s0xxx, 7840HS - 4619MHz limit https://browser.geekbench.com/v6/cpu/1638542.gb6 HP EliteBook 845 14 inch G10 Notebook PC, 7840HS - 4500MHz limit https://browser.geekbench.com/v6/cpu/1946323.gb6 HP EliteBook 845 14 inch G10 Notebook PC, 7940HS - 4500MHz limit https://browser.geekbench.com/v6/cpu/1958365.gb6 I know you know people in AMD who work with your partners - would be great if they contacted HP and ask them to remove the artificial limit. Thank you very much!