How to softmod a graphics card on Linux?

Because not everyone might be familiar with what softmodding means, here a good definition: a softmod is a method of using software to modify the intended behavior of hardware, such as video cards, sound cards, or game consoles in a way that can overcome restrictions of the firmware or install custom firmware.
https://books.google.com/books?id=g5YC6-sPS5gC&lpg=PA50&dq=Forensic%20Investigation%20of%20the%20Soft-Modded%20PlayStation%20Portable%20(PSP)&pg=PA50#v=onepage&q=Forensic%20Investigation%20of%20the%20Soft-Modded%20PlayStation%20Portable%20(PSP)&f=false

Igorslab discovered where in the Windows-registry certain AMD-values for the 5700 XT are stored and how to modify it to get the desired values, the softpowerplay tables. This began because there is a need to clock the 5700 GPU higher, because those can clock higher than the maximum which AMD allows and give better performance. To make it easier Igorslab also developed the MorePowerTool: https://www.igorslab.media/morepowertool-amd-radeon-rx-5700-und-rx-5700-xt-tweaking-and-overclocking-software/
For the 5700 XT aftermarket-cards a new useful application has arisen. Some of the companies (ASUS is the worst offender) use overly agressive values: 1200 mV for the VSOC, 200A for the maximum current, 210W for the TDP, a 1940’ish MHz for the GPU with the so-called quiet BIOS. Here a screenshot of the default voltages and currents on the ASUS Strix 5700 XT:


If there is interest I will also show all the other values.
That the values are overly agressive is not just an opinion. Here the voltages and currents for the Sapphire Nitro 5700 XT:
This comes from Igorslab their review of the Sapphire Nitro. Here another useful article on their website: https://www.igorslab.media/en/making-the-radeon-rx-5700-and-rx-5700-xt-more-energy-efficient-and-significantly-quieter-with-the-morepowertool-tutorial/
They have done more reviews of 5700 (XT) cards and for their more recent reviews they show all the values, making it easy to compare.

It is known that the Nitro and the Strix have the same performance for games but because of these horrible default values the Strix has a much higher power draw resulting in considerably more noise while the cooling of the card is good. On Windows it is easy to fix this but that doesn’t do any good if you would like to game on Linux. I try to be environmentally responsible to some extend so this gets in the way of playing most games on Linux. Other than that I also believe that you shouldnt clock this higher than 1860-1900 MHz because there is a bad scaling between power consumption and FPS but this is a more subjective issue.

As I understand it it works on Windows like this. When you first plug in the graphics card and install the drivers then the data from the BIOS is read and based on this somehow in the registry certain values are stored for certain keys and other software (AMD-driver, AMD Settings, Afterburner…) determines based on these values what to do.

My question is straightforward, how can I accomplish the same on Linux as when I use the MorePowerTool on Windows? Where in the Linux file tree are these values stored? How (just editing a text file or also running some commands) do I change these values?

PS
If a moderator thinks that this topic is more suitable for another category then feel free to move it to there. Don’t blame me for the 720p-resolution of the first picture, that is due to Microsoft Paint refusing to store it at my monitor-resolution.

On Polaris, the file to modify using echo is /sys/class/drm/card0/device/pp_od_clk_voltage

This allows you to modify the Pstates, and you can customize the Powerplay table with /sys/class/drm/card0/device/pp_table but it’s in hex format, so you will need to find a editor.

This has some background:

Ultimately, it could be different generation to generation.

2 Likes

I have this file but how do I actually interact with it? When I cat it I don’t get any readable text (because it is a compiled file?) so I assume that there is some interface to interact with it?

Even the Archwiki has nothing on it. You refered to a Github program (?) which can be used to interact with these files? I have some very limited experience with programming but I have no experience with using Github for something like that. Is there a good source on how to do this?
For example, do the install instructions here work on Arch-base too if I just copy that? https://github.com/kobalicek/amdtweak/blob/master/README.md
Could I directly interact with these files without using such a tool or is there some advanced disassembly-stuff and hexa-editing going on?

On Windows I did this softmod and the 5700 XT Strix went from obnoxiously loud to not being annoying at all. Hardware Unboxed also complained about how loud the fan is at default settings. I would like to get this set up properly on Linux too.

Unfortunately on Linux you have to hex mod the Powerplay tables. Look for GUI tools to interpret the table into human readable format, then you can modify and write back the new powerplay table.

You could google ghex
Remember to copy the file to a backup before editing…
If you find an easier hex editor by googleing, report back.
Also let us know how you get on

Thanks @FurryJackman and @Trooper_ish , that clarifies it. This is going to be interesting…but it doesn’t harm to make a backup of the file in my home-folder and then experiment with it before trying it out for real. At the very least I will learn something. :slight_smile:
I have some experience with C, Python, assembly (basically ‘translating’ a simple function with a loop to assembly and vice versia) and Verilog (basically from an EE perspective, get an understanding of how software works and the relation between software and hardware). This is completely new for me.

By the way, I have a newfound appreciation for the registry in Windows. Say what you want about Windows, reading the BIOS, writing it to the registry when you install the driver and having other software (AMD Settings) use the registry allows for a wonderful simple and safe (if you don’t do anything dumb) hack.

This is what GHex shows.

The default values with regard to power:
1200 GFX
1200 SoC
750 GFX
750 SoC
210 GPU
200 TDC GFX
14 TDC SoC

I was hoping to find the numbers or some names in the file but you only see some loose digits and letters. Could it be that you need to translate the binary numbers to X86-instructions to figure it out? Would it be a good approach to just edit a single number and test somehow what the effect is by reading the powertable before and after editing it, for example with the program which Furryjackman refered to? If that program works for the new GPU’s, given that the writer says that he doesn’t use an AMD-GPU anymore?

You are right, you would need a tool to interpret the results.
I would Not edit a result without knowing, because I would rather not fry my cards

Obviously. How do I make sense of this hexadecimal output? I can read hexadecimal code but I don’t know what this file contains. Is it just X86-instructions like store value in register 3, add values from register 2 and 5 and jump to line 26? I am trying out that amdtweak tool, my system is compiling nodejs at the moment.

@Trooper_ish
@FurryJackman (I don’t want to bump the thread)
I just tried out AMDtweak, I do something wrong or AMD changed something which causes it not to work. The instruction on Github:

Basic usage:

$ ./amdtweak --verbose
–card @
–read-card-pp
–print

The output in the terminal.

Card 0 selected
WARNING: Card 0 already selected, skipping…
Card 0: ‘[root]’: Couldn’t find versioned type ‘PowerPlayTable$12’
Card 0: PP data loaded from ‘/sys/class/drm/card0/device/pp_table’
Card 0: {
“StructureSize”: 1674,
“TableFormatRevision”: 12,
“TableContentRevision”: 0
}

It is the right path for the pp_table but it can’t read it, it seems.

That directory needs root to modify the file. Try running as root.

It doesn’t make any difference.

It might not be updated for Navi. The tool might only be for Polaris and (maybe) Vega.

The usual. :wink:
CoreCtrl also still isn’t updated, I upgraded it yesterday hoping that it got the update but no, not yet.

In the meantime I discovered that there is a serious problem with the 5700 XT from ASUS (thermal throttling due to bad contact), I will elaborate on it in another thread at the most sensible place, I just point it out here as a word of warning.

If it’s the same as the Vega cards, it’s pretty simple. A Fuijpoly thermal pad replacement later and it’s good again.

This topic was automatically closed 273 days after the last reply. New replies are no longer allowed.