Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6800U is doesn't work #210

Closed
danyi opened this issue Aug 16, 2022 · 104 comments
Closed

6800U is doesn't work #210

danyi opened this issue Aug 16, 2022 · 104 comments

Comments

@danyi
Copy link

danyi commented Aug 16, 2022

I used the latest version, V0.11.1.
But it doesn't work
This issue causes me to be unable to adjust on SteamOS

ryzenadj.exe -i
CPU Family: Rembrandt
SMU BIOS Interface Version: 18
Version: v0.11.1
request_table_ver_and_size is not supported on this family
Unable to init power metric table: -1, this does not affect adjustments because it is only needed for monitoring.

ryzenadj.exe --dump-table
request_table_ver_and_size is not supported on this family
Unable to init power metric table: -1, this does not affect adjustments because it is only needed for monitoring.

@pastaq
Copy link

pastaq commented Aug 16, 2022

A little more background on the issue: In HandyPT I use dump-table to read the current values to set the initial level of the UI and to validate the settings took accurately. This ensures that I'm not constantly spamming the system with TDP settings and ensures I can let the user know if another tool/setting/mode has changed the TDP as well. The --stapm-limit, --fast-limit, and --TCTL-temp flags all appear to set, but cannot be validated with -i or -dump-table in Linux or Windows. Is this an oversight, or is there a technical limitation that prevents the Rembrandt series from exposing the entire settings table?

@FlyGoat
Copy link
Owner

FlyGoat commented Aug 16, 2022

Hmm, it just means that nobody had reverse engineering this table version (which can be affected by processor model and AGESA rev).

Let's see if anybody will put effort on it. We should be able to reverse it from uProf.

@pastaq
Copy link

pastaq commented Aug 16, 2022

Sweet. Do you have an example/general outline of what to do? I've never used uProf before.

This seems to be the correct package:
https://aur.archlinux.org/packages/amduprof

@pastaq
Copy link

pastaq commented Aug 16, 2022

Installed uProf and started geting familiar with it. What info do you need? My laptop is a 4800U but I'd like to write a step by step for the testers with the 6000 series to make it a bit more simple to get the data we need.

@pastaq
Copy link

pastaq commented Aug 23, 2022

Hmm, it just means that nobody had reverse engineering this table version (which can be affected by processor model and AGESA rev).

Let's see if anybody will put effort on it. We should be able to reverse it from uProf.

I have two users standing by with 6000 series chips. What uProf data is required for this?

@ruineka
Copy link

ruineka commented Aug 26, 2022

Hmm, it just means that nobody had reverse engineering this table version (which can be affected by processor model and AGESA rev).

Let's see if anybody will put effort on it. We should be able to reverse it from uProf.

I'm pretty sure you'd need the information from uProf controllers am I correct?

It looks like the newer versions have an issue where these options are missing and the archive options no longer list the version where it was visible. I disabled SVM and it isn't visible for me still, it appears as though doing this helped people on Windows however. I may need to install Windows to try and get this information.

@dylangerdaly
Copy link

I have a 6900HS, I'm happy to take a look at reverse engineering whatever is required to get this working, where should I start looking?

@patrickschur
Copy link
Collaborator

We are already working on support for Rembrandt. The problem is that none of us has a device with such an APU and that makes it harder for us to add and test the support for Rembrandt. If someone wants to help, could he or she please run the following script?

https://gist.github.com/patrickschur/4645f81601fe6f8ff16c7a90e848d7cb

Just download the script and run the following command:

sudo python3 pmtable.py

Please run the script two times and let us know the result of both executions.

@dylangerdaly
Copy link

Hm, I don't have a kernel that supports /dev/mem

table base address: 0x3e300000
table version: 0x450004
transfer table: [0, 8, 0, 0, 0]
Traceback (most recent call last):
  File "pmtable.py", line 61, in <module>
    print(f"{i:04X}: {struct.unpack(f, os.read(devmem, 4))[0]}")
PermissionError: [Errno 1] Operation not permitted

Is there any way around this? If not I can compile a kernel with /dev/mem support.

@patrickschur
Copy link
Collaborator

As far as I know there is no way around this (at least not from userland).

@ruineka
Copy link

ruineka commented Sep 8, 2022

As far as I know there is no way around this (at least not from userland).

I attempted this on Pop OS and I got the same issue. Does this work on Arch Linux?

@patrickschur
Copy link
Collaborator

Yes, if you compile the kernel with /dev/mem support (see CONFIG_DEVMEM and CONFIG_STRICT_DEVMEM).

@ruineka
Copy link

ruineka commented Sep 8, 2022

Yes, if you compile the kernel with /dev/mem support (see CONFIG_DEVMEM and CONFIG_STRICT_DEVMEM).

Cool, I'll compile the kernel now and try to get you the information.

@GreyXor
Copy link

GreyXor commented Sep 9, 2022

I'll have a 6850U soon and I'll be happy to help in this

@hh1599
Copy link

hh1599 commented Sep 14, 2022

Yes, if you compile the kernel with /dev/mem support (see CONFIG_DEVMEM and CONFIG_STRICT_DEVMEM).

so just to confirm,

CONFIG_DEMEM=Y
CONFIG_STRICT_DEVMEM=N

@patrickschur
Copy link
Collaborator

@hh1599 STRICT_DEVMEM is optional and only needed if you want to restrict the access. Here is my config:

CONFIG_DEVMEM=y
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
CONFIG_STRICT_DEVMEM=y
# CONFIG_IO_STRICT_DEVMEM is not set

You can get the config using grep DEVMEM /lib/modules/$(uname -r)/build/.config.

@ruineka
Copy link

ruineka commented Sep 15, 2022

@hh1599 STRICT_DEVMEM is optional and only needed if you want to restrict the access. Here is my config:

CONFIG_DEVMEM=y
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
CONFIG_STRICT_DEVMEM=y
# CONFIG_IO_STRICT_DEVMEM is not set

You can get the config using grep DEVMEM /lib/modules/$(uname -r)/build/.config.

I tested a build using this config here. https://github.com/ruineka/linux/releases/download/v6.0-rc5-asus-fix/config
I get the same File "/home/gamer/Downloads/pmtable.py", line 61, in <module> print(f"{i:04X}: {struct.unpack('f', os.read(devmem, 4))[0]}") PermissionError: [Errno 1] Operation not permitted [gamer@chimeraos Downloads]$

@patrickschur
Copy link
Collaborator

@ruineka CONFIG_IO_STRICT_DEVMEM is not set in my config. Can you please disable it and try it again? If that's also not working, I would need the table base address and the output of sudo cat /proc/iomem. It might be possible that the command to get the base address is different on Rembrandt.

@hh1599
Copy link

hh1599 commented Sep 19, 2022

@patrickschur

I compiled a kernel with strict_devmem=n and io_strict_devmem not set and this is the result of sudo python3 pmtable.py

same result both times except transfer table: [0, 3, 0, 0, 0] on the second run

table base address: 0xfe300000
table version: 0x450004
transfer table: []
0000: nan
0004: nan
0008: nan
000C: nan
0010: nan
0014: nan
...
...
0A88: nan
0A8C: nan
0A90: nan
0A94: nan
0A98: nan
0A9C: nan
0AA0: nan

(every address outputs "nan")

@hh1599
Copy link

hh1599 commented Sep 19, 2022

@patrickschur
this is the result of sudo cat /proc/iomem
https://gist.github.com/hh1599/55e78fce3bd2d18232198df4c2483091

@GreyXor
Copy link

GreyXor commented Sep 20, 2022

I have a 6850U running Arch Linux, how can I help with support for this processor?

@hh1599
Copy link

hh1599 commented Sep 20, 2022

@GreyXor As of right now, the instructions have been to run pmtable.py (#210 (comment)) and sudo cat /proc/iomem.

you might have to compile a kernel with devmem support (devmem=y, strict_devmem=n is what i did).

@hh1599
Copy link

hh1599 commented Sep 20, 2022

Devs,
I have full devmem access and AMDuProf working on Arch with a 6800U. If there are any scripts or AMDuProfCLI commands you want me to run please let me know.

@ruineka
Copy link

ruineka commented Sep 20, 2022

Devs,
I have full devmem access and AMDuProf working on Arch with a 6800U. If there are any scripts or AMDuProfCLI commands you want me to run please let me know.

https://gist.github.com/patrickschur/4645f81601fe6f8ff16c7a90e848d7cb

Just download the script and run the following command:

sudo python3 pmtable.py

Please run the script two times and let us know the result of both executions.

@hh1599
Copy link

hh1599 commented Sep 20, 2022

@ruineka
?
I did that above. #210 (comment)

@ruineka
Copy link

ruineka commented Sep 20, 2022

@ruineka
?
I did that above. #210 (comment)

Oh sorry I should have read the name more closely 😂

@JadedTuna
Copy link

JadedTuna commented Sep 21, 2022

@patrickschur I ran the script two times, both yielded the same output.
That output and a dump of iomem can be found here: https://gist.github.com/JadedTuna/9a75f2c327da4cda116ab7e464ab2067

The CPU I have is a 6850U.

@hh1599
Copy link

hh1599 commented Sep 21, 2022

@JadedTuna any insight as so why my pmtable just outputs "nan"? is it a 6800U vs 6850U thing or did I screw something up?

I definitely have devmem access as indicated by running this command: sudo dd if=/dev/mem of=/dev/null bs=1 skip=1048576 count=1

@GreyXor
Copy link

GreyXor commented Sep 22, 2022

T14s Gen3 AMD with 6850U here
Outputs of 2 executions of pmtable.py and cat of /proc/iomem
https://gist.github.com/GreyXor/4424925d61e0a519c8af10e02efc6720
Is there anything else you'd like ?

@cyrus0880
Copy link

ok let me build it to try

@bowes332frank
Copy link

@cyrus0880 Windows should also be supported. But you have to compile the latest version yourself until @FlyGoat creates a new release.

@bowes332frank It's already fixed! See #210 (comment)!

Nope. It only works for flash installed holoiso in ARKZOE, not in GPDWINMAX2 with Manjaro Linux with Linux 6.1 Kernel.

@patrickschur
Copy link
Collaborator

@bowes332frank Any error message? Does it fail to map /dev/mem? Then please make sure your kernel is compiled with /dev/mem support or try to add iomem=relaxed as a boot paramter.

@ewagner12
Copy link

Reporting another success with a 6850U in Linux with iomem=relaxed and secure boot off ofc. After increasing PPT LIMIT SLOW from stock (24W) it looks like it's actually working as it's pulling more power and performing slightly better.

sudo ./ryzenadj -i
CPU Family: Rembrandt
SMU BIOS Interface Version: 18
Version: v0.11.1 
PM Table Version: 450005
|        Name         |   Value   |      Paramter      |
|---------------------|-----------|--------------------|
| STAPM LIMIT         |    30.000 | stapm-limit        |
| STAPM VALUE         |    29.962 |                    |
| PPT LIMIT FAST      |    30.000 | fast-limit         |
| PPT VALUE FAST      |    29.231 |                    |
| PPT LIMIT SLOW      |    28.000 | slow-limit         |
| PPT VALUE SLOW      |    27.986 |                    |
| StapmTimeConst      |       nan | stapm-time         |
| SlowPPTTimeConst    |       nan | slow-time          |
| PPT LIMIT APU       |    41.000 | apu-slow-limit     |
| PPT VALUE APU       |     0.000 |                    |
| TDC LIMIT VDD       |    50.000 | vrm-current        |
| TDC VALUE VDD       |    26.078 |                    |
| TDC LIMIT SOC       |    13.000 | vrmsoc-current     |
| TDC VALUE SOC       |     2.580 |                    |
| EDC LIMIT VDD       |   105.000 | vrmmax-current     |
| EDC VALUE VDD       |    72.833 |                    |
| EDC LIMIT SOC       |    17.000 | vrmsocmax-current  |
| EDC VALUE SOC       |     0.182 |                    |
| THM LIMIT CORE      |   100.000 | tctl-temp          |
| THM VALUE CORE      |    79.701 |                    |
| STT LIMIT APU       |    46.000 | apu-skin-temp      |
| STT VALUE APU       |    39.153 |                    |
| STT LIMIT dGPU      |     0.000 | dgpu-skin-temp     |
| STT VALUE dGPU      |     0.000 |                    |
| CCLK Boost SETPOINT |       nan | power-saving /     |
| CCLK BUSY VALUE     |       nan | max-performance    |

@cyrus0880
Copy link

cyrus0880 commented Nov 30, 2022

@cyrus0880 Windows should also be supported. But you have to compile the latest version yourself until @FlyGoat creates a new release.
@bowes332frank It's already fixed! See #210 (comment)!

Nope. It only works for flash installed holoiso in ARKZOE, not in GPDWINMAX2 with Manjaro Linux with Linux 6.1 Kernel.

i tested download source code to build is work, thx

CPU Family: Rembrandt
SMU BIOS Interface Version: 18
Version: v0.11.1
PM Table Version: 450005

Name Value Paramter
STAPM LIMIT 348049317925163235048438573826048.000 stapm-limit
STAPM VALUE 296295168.000
PPT LIMIT FAST -0.000 fast-limit
PPT VALUE FAST 296959.781
PPT LIMIT SLOW 426988.281 slow-limit
PPT VALUE SLOW 549699534655256564596736.000
StapmTimeConst nan stapm-time
SlowPPTTimeConst nan slow-time
PPT LIMIT APU 524246.250 apu-slow-limit
PPT VALUE APU 426668.406
TDC LIMIT VDD -8171693757714226795773952.000 vrm-current
TDC VALUE VDD -nan
TDC LIMIT SOC -0.000 vrmsoc-current
TDC VALUE SOC 0.000
EDC LIMIT VDD -0.000 vrmmax-current
EDC VALUE VDD 1167598208.000
EDC LIMIT SOC -0.000 vrmsocmax-current
EDC VALUE SOC -0.000
THM LIMIT CORE -0.000 tctl-temp
THM VALUE CORE -0.000
STT LIMIT APU -0.000 apu-skin-temp
STT VALUE APU 0.000
STT LIMIT dGPU -7803014248353306180059136.000 dgpu-skin-temp
STT VALUE dGPU -nan
CCLK Boost SETPOINT nan power-saving /
CCLK BUSY VALUE nan max-performance

@cyrus0880
Copy link

cyrus0880 commented Nov 30, 2022

but i found the problem

if build at debug mode

Name Value Paramter
STAPM LIMIT 348049317925163235048438573826048.000 stapm-limit
STAPM VALUE 296295168.000
PPT LIMIT FAST -0.000 fast-limit
PPT VALUE FAST 296959.781
PPT LIMIT SLOW 426988.281 slow-limit
PPT VALUE SLOW 549699534655256564596736.000

if build at release

Name Value Paramter
STAPM LIMIT -0.000 stapm-limit
STAPM VALUE 0.000
PPT LIMIT FAST -1079879869136896.000 fast-limit
PPT VALUE FAST -904026728169472.000
PPT LIMIT SLOW -118327339943216302460295483370766336.000 slow-limit
PPT VALUE SLOW -0.000
StapmTimeConst nan stapm-time

some value show 0 , some value is -
and i run ./ryzenadj.exe --stapm-limit=15000 --fast-limit=15000 --slow-limit=15000 --tctl-temp=90
run -i again all value is not change

@FlyGoat
Copy link
Owner

FlyGoat commented Nov 30, 2022

@cyrus0880 Are you testing on Windows? If so please try binary here: https://github.com/FlyGoat/RyzenAdj/actions/runs/3580018117

@cyrus0880
Copy link

cyrus0880 commented Nov 30, 2022

@cyrus0880 Are you testing on Windows? If so please try binary here: https://github.com/FlyGoat/RyzenAdj/actions/runs/3580018117

i rebooted my winmax2 and use this binary
now all value is 0

no idea what problem
now use source code build debug & release got same problem all value is 0
this is amd drive problem or windows 22h2 problem?

~\Downloads\ryzenadj-win64
❯ .\ryzenadj.exe -i
CPU Family: Rembrandt
SMU BIOS Interface Version: 18
Version: v0.11.1
PM Table Version: 450005

Name Value Paramter
STAPM LIMIT 0.000 stapm-limit
STAPM VALUE 0.000
PPT LIMIT FAST 0.000 fast-limit
PPT VALUE FAST 0.000
PPT LIMIT SLOW 0.000 slow-limit
PPT VALUE SLOW 0.000
StapmTimeConst nan stapm-time
SlowPPTTimeConst nan slow-time
PPT LIMIT APU 0.000 apu-slow-limit
PPT VALUE APU 0.000
TDC LIMIT VDD 0.000 vrm-current
TDC VALUE VDD 0.000
TDC LIMIT SOC 0.000 vrmsoc-current
TDC VALUE SOC 0.000
EDC LIMIT VDD 0.000 vrmmax-current
EDC VALUE VDD 0.000
EDC LIMIT SOC 0.000 vrmsocmax-current
EDC VALUE SOC 0.000
THM LIMIT CORE 0.000 tctl-temp
THM VALUE CORE 0.000
STT LIMIT APU 0.000 apu-skin-temp
STT VALUE APU 0.000
STT LIMIT dGPU 0.000 dgpu-skin-temp
STT VALUE dGPU 0.000
CCLK Boost SETPOINT nan power-saving /
CCLK BUSY VALUE nan max-performance

@cyrus0880
Copy link

cyrus0880 commented Nov 30, 2022

@cyrus0880 Are you testing on Windows? If so please try binary here: https://github.com/FlyGoat/RyzenAdj/actions/runs/3580018117

source build before reboot
ryzenadj-r.exe
ryzenadj-d.exe

use your bin for win
ryzenadj.exe

if after reboot run ryzenadj.exe -i, ryzenadj-r.exe -i, ryzenadj-d.exe -i
will got all value 0

but i open vscode build debug again and run new binary got this
and run again ryzenadj.exe (your binary) all so get same

CPU Family: Rembrandt
SMU BIOS Interface Version: 18
Version: v0.11.1
PM Table Version: 450005

Name Value Paramter
STAPM LIMIT -231789628297997294940286245841483595776.000 stapm-limit
STAPM VALUE 0.000
PPT LIMIT FAST -0.000 fast-limit
PPT VALUE FAST -0.000
PPT LIMIT SLOW -380.168 slow-limit
PPT VALUE SLOW 0.000
StapmTimeConst nan stapm-time
SlowPPTTimeConst nan slow-time
PPT LIMIT APU -0.000 apu-slow-limit
PPT VALUE APU 1241759858019100226409859834183680.000
TDC LIMIT VDD -1328423184105472.000 vrm-current
TDC VALUE VDD 0.000
TDC LIMIT SOC -0.000 vrmsoc-current
TDC VALUE SOC -nan
EDC LIMIT VDD 4453270212684770443264.000 vrmmax-current
EDC VALUE VDD 4047223652352.000
EDC LIMIT SOC -207540.797 vrmsocmax-current
EDC VALUE SOC 0.000
THM LIMIT CORE -0.000 tctl-temp
THM VALUE CORE -0.000
STT LIMIT APU 0.000 apu-skin-temp
STT VALUE APU 36510418296301944832.000
STT LIMIT dGPU 14436438422585344.000 dgpu-skin-temp
STT VALUE dGPU 7.878
CCLK Boost SETPOINT nan power-saving /
CCLK BUSY VALUE nan max-performance

and wait 5min run again got all value 0 again

@FlyGoat
Copy link
Owner

FlyGoat commented Nov 30, 2022

@patrickschur Any thoughts? I'm going to make a release soonish.

@patrickschur
Copy link
Collaborator

@FlyGoat Unfortunately, I don't know why it doesn't work on Windows. But I also don't use Windows.

@hh1599
Copy link

hh1599 commented Dec 1, 2022

@patrickschur could it have something to do with the reason the 6800u requires iomem=relaxed but the 5800u doesn't?

@FlyGoat
Copy link
Owner

FlyGoat commented Dec 4, 2022

Can some one with access to those chips spare some time to test how many functions are working?

https://github.com/FlyGoat/RyzenAdj/wiki/Supported-Models

I think document those into our wiki can be useful.

@NikhilSaini38
Copy link

NikhilSaini38 commented Dec 9, 2022

Can some one with access to those chips spare some time to test how many functions are working?

https://github.com/FlyGoat/RyzenAdj/wiki/Supported-Models

I think document those into our wiki can be useful.

I can help, i have an aokzoe device with 6800u (their firmware is iffy though) @FlyGoat. Just tell me procedures to test.

@NikhilSaini38
Copy link

NikhilSaini38 commented Dec 9, 2022

readings from ryzenadj -i (AOKZOE A1 AR07)

CPU Family: Rembrandt
SMU BIOS Interface Version: 18
Version: v0.12.0
PM Table Version: 450005

Name Value Paramter
STAPM LIMIT 15.000 stapm-limit
STAPM VALUE 3.469
PPT LIMIT FAST 25.000 fast-limit
PPT VALUE FAST 7.940
PPT LIMIT SLOW 20.000 slow-limit
PPT VALUE SLOW 2.918
StapmTimeConst nan stapm-time
SlowPPTTimeConst nan slow-time
PPT LIMIT APU 41.000 apu-slow-limit
PPT VALUE APU 0.000
TDC LIMIT VDD 50.000 vrm-current
TDC VALUE VDD 1.329
TDC LIMIT SOC 13.000 vrmsoc-current
TDC VALUE SOC 0.000
EDC LIMIT VDD 105.000 vrmmax-current
EDC VALUE VDD 35.011
EDC LIMIT SOC 17.000 vrmsocmax-current
EDC VALUE SOC 0.047
THM LIMIT CORE 95.000 tctl-temp
THM VALUE CORE 48.004
STT LIMIT APU 0.000 apu-skin-temp
STT VALUE APU 0.000
STT LIMIT dGPU 0.000 dgpu-skin-temp
STT VALUE dGPU 0.000
CCLK Boost SETPOINT nan power-saving /
CCLK BUSY VALUE nan max-performance

@NikhilSaini38
Copy link

@FlyGoat btw gpu clock seems to be messed up after installing ryzenadj
image

@FlyGoat
Copy link
Owner

FlyGoat commented Dec 12, 2022

@NikhilSaini38 Just play around those parameters to see if they actually have affect to the system :-)

RyzenAdj may conflict with other software measuring the clock.

@NikhilSaini38
Copy link

NikhilSaini38 commented Dec 12, 2022

@FlyGoat it migh be due to vendor configuration, but so far only these parameters respond

--stapm-limit
--fast-limit
--slow-limit
--tctl-temp
--vrm-current
--vrmsoc-current
--vrmsocmax-current

@Falcosc
Copy link
Collaborator

Falcosc commented Dec 12, 2022

@patrickschur
Great job finding out that Rembrandt needed more than 32bit addresses. And thank you for checking where most of the important values are stored in the table.

Back to the windows issue: The only difference should be the 64bit memory address for the PM Table.

Unfortunately, Rembrandt is the first which needs a 64bit memory address, so none of us has a device to play around locally.

And to make things worse, on Windows you need something which runs on same mode like a driver, and it is kind of a problem to sign stuff. And without this process, you can't load a self compiled sys files as driver. That's why all are using this old inpoutx64.dll which contains a signed driver as far as I understood.

If you did confirm that the windows build has found a good memory address, then it is very likely that our inpoutx64.dll version doesn't support addresses larger than 32bit. I would highly recommend adding the non-supported error back into the Windows version until we find somebody how know how to deal with these kinds of topics.

If the Windows version does not create an error message, all tools relying on ryzenAdj would get incorrect values on Windows.

Update:
I found one of the resource which I did reject during research how to map memory into user space 2 years ago: https://github.com/starofrainnight/winio
I did reject this because it already doesn't work anymore since it isn't signed by a trusted CA. So we could Rembrandt PM Table working with that, but anybody who is using it would need to allow unsigned drivers on their Windows System.
So if anybody knows somebody with a bit of knowledge about this, we don't know how to find an already signed working driver or how to get one.

@ewagner12
Copy link

@Falcosc
The latest release version 0.12 works for me on windows 11 22H2 on my Thinkpad T14s (6850U) when I run it in a powershell window as admin. I talked to someone who said it worked for them on their ASUS Zephyrus G14 (6800HS). I don't know what the issue others are running into, but maybe it is device specific.

@Falcosc
Copy link
Collaborator

Falcosc commented Dec 12, 2022

@patrickschur could you create a build for @ewagner12 which prints out the memory address to confirm 64bit is working with inpoutx64.dll?

@ewagner12 Maybe your table memory address fits in a 32bit.

@cyrus0880 If patrick finds some time to create a version with table memory address output, could you try it as well? Maybe we have timing issues again with our SMU commands.

Update: that was the fix for the timing issues, without this fix some APUs did get uninitialized memory data as well, maybe it needs to be fine-tuned again 36fa8f0

RyzenAdj/lib/api.c

Lines 238 to 248 in 36fa8f0

if (resp == REP_MSG_CmdRejectedPrereq) {
//2nd try is needed for 2 usecase: if SMU got interrupted or first call after boot on Zen2
//we need to wait because if we don't wait 2nd call will fail, too: similar to Raven and Picasso issue but with real reject instead of 0 data response
//but because we don't have to check any physical memory values, don't waste CPU cycles and use sleep instead
Sleep(10);
resp = smu_service_req(ry->psmu, transfer_table_msg, &args);
if(resp == REP_MSG_CmdRejectedPrereq){
printf("request_transfer_table was rejected twice\n");
Sleep(100);
resp = smu_service_req(ry->psmu, transfer_table_msg, &args);
}

Raven and Picasso did get 0 data and for that reason we have a hack

@patrickschur I know I ask for much time, but if we actually did confirm that ewagner12 is successfully pulling data from 64bit memory addresses, maybe we have to just try to refresh table until we find plausible data?
For example we did retry table refresh on Raven and Picasso if we found 0 as data. But this hack doesn't work anymore if memory content in the address space above 32bit is non-empty by coincident

RyzenAdj/lib/api.c

Lines 288 to 294 in 36fa8f0

if(!ry->table_values[0]){
//Raven and Picasso don't get table refresh on the very first transfer call after boot, but respond with OK
//if we detact 0 data, do an initial 2nd call after a small delay (copy_from_phyaddr is enough delay)
//transfer, transfer, wait, wait longer; don't work
//transfer, wait, wait longer; don't work
//transfer, wait, transfer; does work
return refresh_table(ry);

@nicolasf
Copy link

nicolasf commented Dec 14, 2022

@Falcosc @patrickschur would the DSDT code help in figuring out these addresses?

I was looking into mine and was able to find some of the power parameters inside the DSDT, but not all of them. Also wasn't able to reverse engineer some values.

@kaichido
Copy link

kaichido commented Apr 4, 2023

@patrickschurBất kỳ suy nghĩ? Tôi sẽ sớm phát hành.

Thank you for your application, but may I ask how to add "you may need to add iomem=relaxed as a boot parameter for ryzenadj to work" I am really not good at programming

@bbkr
Copy link

bbkr commented May 3, 2023

Thank you for your application, but may I ask how to add "you may need to add iomem=relaxed as a boot parameter for ryzenadj to work" I am really not good at programming

That depends on your bootloader. Also some allow you to pass extra param on the fly (like in Grub) to test change before making it permanent in bootloader config. Just google for your Linux distribution name + "add boot flag".

In all cases you can verify if flag was passed correctly by issuing cat /proc/cmdline.

@bbkr
Copy link

bbkr commented May 3, 2023

I confirm it works on AMD 6800U machine GPD Win MAX 2 with vanilla Arch Linux, 6.2.12 stock kernel with iomem=relaxed set:

bbkr@gpd:~$ sudo ryzenadj --info

CPU Family: Rembrandt
SMU BIOS Interface Version: 18
Version: v0.13.0 
PM Table Version: 450005
|        Name         |   Value   |      Paramter      |
|---------------------|-----------|--------------------|
| STAPM LIMIT         |    22.000 | stapm-limit        |
| STAPM VALUE         |     1.584 |                    |
| PPT LIMIT FAST      |    24.000 | fast-limit         |
| PPT VALUE FAST      |     6.393 |                    |
| PPT LIMIT SLOW      |    24.000 | slow-limit         |
| PPT VALUE SLOW      |     1.402 |                    |
| StapmTimeConst      |       nan | stapm-time         |
| SlowPPTTimeConst    |       nan | slow-time          |
| PPT LIMIT APU       |    32.001 | apu-slow-limit     |
| PPT VALUE APU       |     0.000 |                    |
| TDC LIMIT VDD       |    50.000 | vrm-current        |
| TDC VALUE VDD       |     0.431 |                    |
| TDC LIMIT SOC       |    13.000 | vrmsoc-current     |
| TDC VALUE SOC       |     0.645 |                    |
| EDC LIMIT VDD       |   105.000 | vrmmax-current     |
| EDC VALUE VDD       |    92.684 |                    |
| EDC LIMIT SOC       |    17.000 | vrmsocmax-current  |
| EDC VALUE SOC       |     0.027 |                    |
| THM LIMIT CORE      |    95.000 | tctl-temp          |
| THM VALUE CORE      |    37.200 |                    |
| STT LIMIT APU       |     0.000 | apu-skin-temp      |
| STT VALUE APU       |     0.000 |                    |
| STT LIMIT dGPU      |     0.000 | dgpu-skin-temp     |
| STT VALUE dGPU      |     0.000 |                    |
| CCLK Boost SETPOINT |       nan | power-saving /     |
| CCLK BUSY VALUE     |       nan | max-performance    |

By "works" I mean it recognizes chip and displays this info. I haven't tried turning knobs yet.

@patrickschur
Copy link
Collaborator

After a longer break, I'm finally back! :)

@Falcosc Unfortunately, I can't help when it comes to fixing the Windows version. I don't even use Windows.

@danyi danyi closed this as completed Jun 27, 2023
@GloriousEggroll
Copy link

GloriousEggroll commented Jul 20, 2023

I confirm it works on AMD 6800U machine GPD Win MAX 2 with vanilla Arch Linux, 6.2.12 stock kernel with iomem=relaxed set:

bbkr@gpd:~$ sudo ryzenadj --info

CPU Family: Rembrandt
SMU BIOS Interface Version: 18
Version: v0.13.0 
PM Table Version: 450005
|        Name         |   Value   |      Paramter      |
|---------------------|-----------|--------------------|
| STAPM LIMIT         |    22.000 | stapm-limit        |
| STAPM VALUE         |     1.584 |                    |
| PPT LIMIT FAST      |    24.000 | fast-limit         |
| PPT VALUE FAST      |     6.393 |                    |
| PPT LIMIT SLOW      |    24.000 | slow-limit         |
| PPT VALUE SLOW      |     1.402 |                    |
| StapmTimeConst      |       nan | stapm-time         |
| SlowPPTTimeConst    |       nan | slow-time          |
| PPT LIMIT APU       |    32.001 | apu-slow-limit     |
| PPT VALUE APU       |     0.000 |                    |
| TDC LIMIT VDD       |    50.000 | vrm-current        |
| TDC VALUE VDD       |     0.431 |                    |
| TDC LIMIT SOC       |    13.000 | vrmsoc-current     |
| TDC VALUE SOC       |     0.645 |                    |
| EDC LIMIT VDD       |   105.000 | vrmmax-current     |
| EDC VALUE VDD       |    92.684 |                    |
| EDC LIMIT SOC       |    17.000 | vrmsocmax-current  |
| EDC VALUE SOC       |     0.027 |                    |
| THM LIMIT CORE      |    95.000 | tctl-temp          |
| THM VALUE CORE      |    37.200 |                    |
| STT LIMIT APU       |     0.000 | apu-skin-temp      |
| STT VALUE APU       |     0.000 |                    |
| STT LIMIT dGPU      |     0.000 | dgpu-skin-temp     |
| STT VALUE dGPU      |     0.000 |                    |
| CCLK Boost SETPOINT |       nan | power-saving /     |
| CCLK BUSY VALUE     |       nan | max-performance    |

By "works" I mean it recognizes chip and displays this info. I haven't tried turning knobs yet.

It's not working here. When you try to set -a -b -c the values get applied but the tdp does not change. You can test this easily by running the device on battery and running a game with mangohud showing cpu+gpu wattage.

Currently this statement holds true:

@FlyGoat it migh be due to vendor configuration, but so far only these parameters respond

--stapm-limit
--fast-limit
--slow-limit
--tctl-temp
--vrm-current
--vrmsoc-current
--vrmsocmax-current

But applying

--stapm-limit
--fast-limit
--slow-limit

Don't seem to have any effect.

--tcl-temp does work however. This can be used as a hacky way to lower tdp. Additionally GPD themselves have noted that their MotionAssistant software which controls TDP in windows does not actually touch TDP values:

https://www.reddit.com/r/gpdwin/comments/102yws7/comment/j352zji/?utm_source=reddit&utm_medium=web2x&context=3

So far I tested 6800U on both GPD Win Max 2 and GPD Win 4, both cannot lower TDP via -a -b -c (ex -a 15000 -b 15000 -c 15000)

As a workaround I use something like --tcl-temp 40 which forces tdp to around 12w under load (I used gears of war 5 for testing)

On the flipside -- my laptop has a 6900HS and I can modify TDP values on it with no problem

@bbkr
Copy link

bbkr commented Jul 20, 2023

Correct command is --tctl-temp=40 or -f 40.

And it does the trick, setting it to 45 on Win MAX 2 6800U avoids annoying fan reving up for a few seconds for example when heavy www page is opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests