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

I2C Interface like ATOMbios but through driver/cmdline #32

Closed
rbartl opened this issue Sep 28, 2017 · 8 comments
Closed

I2C Interface like ATOMbios but through driver/cmdline #32

rbartl opened this issue Sep 28, 2017 · 8 comments

Comments

@rbartl
Copy link

rbartl commented Sep 28, 2017

Is it possible to access the I2C Interfaces that control the Voltage Regulator through the i2c-dev interface ?

this should return the ID of the installed VRM on a sapphire nitro+ (43)
let a=0; while [ $a -lt 20 ] ; do let a=$a+1 ; i2cget -y $a 0x30 0x92 b ; done
but returns 00 (or 27 if used with 2 byte return)

@AlainCo
Copy link

AlainCo commented Oct 22, 2017

I have same problem as you, to detect, dump, read and write the i2c of ROCk.
I've found the documentation:
https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver/blob/master/Documentation/i2c
But it refers to i2c-dev that is already used by i2c-tools providing i2cget,i2cdump,i2cdetect...

Maye is is needed to upgrade the i2c-tools according to
https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver/blob/master/Documentation/i2c/upgrading-clients

Whatever is the solution, it seems possible as some people do use i2c to control the VRM.

@REELcoder
Copy link

Whatever is the solution, it seems possible as some people do use i2c to control the VRM.

This people claim that /dev/mem is used, i.e. bypassing all drivers and talking directly to the device. Any idea where to find some documentation on the needed address spaces and registers descriptions?

@AlainCo
Copy link

AlainCo commented Jan 16, 2018

I've analysed amdgpu code, and

  • i2c for VRM are not usable from userspace
  • I've seen code to control VRM but indeed it seems to be via system address space... I need to investigate more, but I'm too busy

my dream would be to reactivate the /dev/i2c which are disabled... hard to make your dream come true.

@REELcoder
Copy link

REELcoder commented Jan 17, 2018

There seems to be old tool for other GPUs: https://github.com/ius/radeonvolt

Where did you find VRM code in amdgpu? I just found the stuff for populating the VR config which is uploaded to the SMU, or the i2c stuff for comunicating with attached monitors (DDC).

@AlainCo
Copy link

AlainCo commented Jan 17, 2018

Right, I only found useless i2c sysfs, and some code to control onitors as you say.

I've found the code where voltage gathered, scaled and send to othe layers, finishing in some write to emory that I don't understand... I did not get enough time to understand, and moreover I just vaguely discovered how it works... I was following that
https://www.phoronix.com/forums/forum/linux-graphics-x-org-drivers/amd-linux/918649-underclocking-undervolting-the-rx-470-with-amdgpu-pro-success
I was debugging all, but recently I migrated to v 17.50 and all is to redo...
I endedn when I discovered the voltage set in bios where correctly read but ,I know my card don't apply it, so I was in despair...
I work cro-magnon style (vi+make; no way to cross compile on eclipse?), ...

Finally the good news on phoronix is maybe that it will be accessible in kernel 4.17
https://www.phoronix.com/forums/forum/phoronix/latest-phoronix-articles/1001523-gpu-voltage-control-support-coming-to-amdgpu-driver

@REELcoder
Copy link

REELcoder commented Jan 17, 2018

We seem to be a the same point. I knew the older phoronix thread. *BTW vi+make rules...

The news sounds interesting. I hope there is unlimited control possible. Now I have tweaked the core voltage in amd/powerplay/smumgr/polaris10_smc.c:

@@ -689,6 +695,7 @@
 	struct phm_ppt_v1_information *table_info =
 			(struct phm_ppt_v1_information *)(hwmgr->pptable);
 	SMU_SclkSetting curr_sclk_setting = { 0 };
+	uint32_t min = 800;
 
 	result = polaris10_calculate_sclk_params(hwmgr, clock, &curr_sclk_setting);
 
@@ -697,6 +704,11 @@
 			table_info->vdd_dep_on_sclk, clock,
 			&level->MinVoltage, &mvdd);
 
+	if(level->MinVoltage > min) {
+		level->MinVoltage = (level->MinVoltage & 0xFFFF0000) + min*VOLTAGE_SCALE;
+		pr_info("polaris10_populate_single_graphic_level(): forcing voltage to %u mV for CR %4u\n", min, clock/100);
+	}
+
 	PP_ASSERT_WITH_CODE((0 == result),
 			"can not find VDDC voltage value for "
 			"VDDC engine clock dependency table",

But even when choosing insanely low values the GPU works robust. I assume there is a range limitation somewhere further downstream...

Direct access to the VRM might still be the preferred approach.

@whatwhat-what-zz
Copy link

whatwhat-what-zz commented May 25, 2018

Maybe someone more adroit can take some cues from this project.

Hope this helps.

@jlgreathouse
Copy link
Contributor

Hi all,

While we may not officially support configuration of our VRMs over I2C, we do now support configuring the DPM tables directly, which will allow you to set a requested voltage level for each of the DPM states. Additionally, you can request that only a particular DPM state (or subset of DPM states) be used, essentially forcing desired frequency/voltages.

For instance, please see this post where I describe how to use rocm-smi to control the DPM states on a GPU. Essentially:

  • Boot your system with the driver configuration parameter amdgpu.ppfeaturemask=0xffffffff in either your kernel parameter line or in a modprobe configuration file.
  • Use rocm-smi --showclkvolt to see the various DPM states, their frequencies, and their requested voltages.
  • Use rocm-smi --setslevel SCLKLEVEL SCLK SVOLT to set the requested GPU clock (SCLK) and voltage (SVOLT in millivolts) for a particular DPM level
  • Use you can then use rocm-smi --setperflevel manual and rocm-smi --setsclk SCLKLEVEL to request that your GPU stay at a particular DPM state and voltage.

Note that there are rules for how the DPM table must be configured (described in my other post). However, these mechanisms should allow you to set desired voltages that will be associated with desired frequencies.

If you do not want to use rocm-smi, note that it is just a Python script that is built up around accessing sysfs entries that you could also access yourself. The --setslevel and --setmlevel commands are wrappers around the pp_od_clk_voltage files in sysfs.

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

No branches or pull requests

6 participants