dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: dri-devel@lists.freedesktop.org
Subject: [Bug 201539] AMDGPU R9 390 automatic fan speed control in Linux 4.19/4.20/5.0
Date: Tue, 01 Dec 2020 21:54:54 +0000	[thread overview]
Message-ID: <bug-201539-2300-1eFwR5twmb@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-201539-2300@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=201539

fawz (fawz@negentropy.io) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fawz@negentropy.io

--- Comment #57 from fawz (fawz@negentropy.io) ---
Hi all!

I'm running a Radeon R9 290 with amdgpu.

I've had the same issue of pwm1_enable being set to MANUAL on boot, and then
being stuck to AUTO after switching to AUTO. I've had a quick browse of the
code and have a fix that seems to work for me.

See the attached patch for my fix/work-around.

Thoughts and explanations follow.

Some comments and questions on the code. My card seems to use the smu7_* code
for handling fan and power related functionality. I'm not sure if this is
correct, but it seems that MANUAL is simply the default state for the card at
boot, and the software (maybe on purpose? it's unclear) mirrors because there's
a variable called fan_ctrl_enabled which is never explicitly initialized, and
thus is default-initialized to false, which equates to MANUAL in the
get_pwm1_enable() logic, which again means you may set the fan speed manually.

For those who want to take a look themselves, this is roughly what happens when
you write 2 (auto) to pwm1_enable:

> amdgpu_pm.c: amdgpu_hwmon_set_pwm1()
> smu7_hwmgr.c: smu7_set_fan_control_mode()
> smu7_thermal.c: smu7_fan_ctrl_set_static_mode()
> smu7_thermal.c: smu7_fan_ctrl_start_smc_fan_control()
> 
> // Send PPSMC_StartFanControl with parameter FAN_CONTROL_TABLE
> smumgr.c: smum_send_msg_to_smc_with_parameter 
> smu7_thermal.c: hwmgr->fan_ctrl_enabled = true;

Note that fan_ctrl_enabled is now true. When reading pwm1_enable, this is the
value that's checked.

Now, this happens when we try to write 1 (manualy) to pwm1_enable again:

> amdgpu_pm.c: amdgpu_hwmon_set_pwm1_enable()
> smu7_hwmgr.c: smu7_set_fan_control_mode()
> smu7_hwmgr.c: smu7_fan_ctrl_stop_smc_fan_control
> 
> // Now, a so-called phm platform cap is checked
> // See hardwaremanager.h for its definition
> // Its description is simply "Fan is controlled by the SMC microcode."
> if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
>                       PHM_PlatformCaps_MicrocodeFanControl))
>               smu7_fan_ctrl_stop_smc_fan_control(hwmgr);

If the above check were to succeed, it would continue to send a smum message of
PPSMC_StopFanControl and set fan_ctrl_enabled = false, and we would be back in
MANUAL land. However, the PHM_PlatformCaps_MicrocodeFanControl cap is never
set. AFAICT, this cap is only ever set for vega12 and vega20 cards, in
vega20_processpptables.c and vega12_processpptables.c. It's checked in a bunch
of places for smu7, but never in a way that explicitly prevents manual fan
control once manual fan control is enabled, such as after boot.

Simply commenting out the check above fixed the problem for me, and I have seen
no strange side-effects yet. This makes sense to me; after boot, setting fan
speed manually works and the code responsible doesn't require the
MicrocodeFanControl cap to be set for that. However, I don't know what the
purpose of that cap is, whether the only reason for it being present in smu7
and elsewhere is a situation of copy-pasting skeleton code, or what.

From looking at vega10_hwmgr.c, it looks like vega10 (AMDGPU_FAMILY_AI, arctic
islands?) cards should have the same problem and I assume the same fix should
work, so I included it in the patch. It would be great if someone with an
arctic islands card (RX 400 series?) could test and confirm this.

Comments and feedback are very welcome.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-12-01 21:54 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27 12:32 [Bug 201539] New: AMDGPU R9 390 automatic fan speed control in Linux 4.19 bugzilla-daemon
2018-10-27 12:34 ` [Bug 201539] " bugzilla-daemon
2018-10-27 12:35 ` bugzilla-daemon
2018-10-27 12:45 ` bugzilla-daemon
2018-12-08  7:59 ` bugzilla-daemon
2018-12-21  1:30 ` bugzilla-daemon
2018-12-21  2:16 ` bugzilla-daemon
2018-12-21 15:06 ` bugzilla-daemon
2018-12-21 15:56 ` bugzilla-daemon
2018-12-24 11:55 ` [Bug 201539] AMDGPU R9 390 automatic fan speed control in Linux 4.19/4.20 bugzilla-daemon
2018-12-24 11:55 ` bugzilla-daemon
2018-12-31  9:06 ` bugzilla-daemon
2019-01-05 13:41 ` bugzilla-daemon
2019-03-04  2:17 ` [Bug 201539] AMDGPU R9 390 automatic fan speed control in Linux 4.19/4.20/5.0 bugzilla-daemon
2019-03-09  2:44 ` bugzilla-daemon
2019-04-17 10:37 ` bugzilla-daemon
2019-06-06 11:18 ` bugzilla-daemon
2019-06-06 11:44 ` bugzilla-daemon
2019-06-06 12:18 ` bugzilla-daemon
2019-06-07  1:41 ` bugzilla-daemon
2019-06-18 17:42 ` bugzilla-daemon
2019-06-24  2:18 ` bugzilla-daemon
2019-10-05 13:19 ` bugzilla-daemon
2019-11-03  4:08 ` bugzilla-daemon
2019-11-03  4:16 ` bugzilla-daemon
2019-11-03  4:29 ` bugzilla-daemon
2019-11-03  4:37 ` bugzilla-daemon
2019-11-05 23:47 ` bugzilla-daemon
2019-11-06  9:35 ` bugzilla-daemon
2019-11-16  0:42 ` bugzilla-daemon
2019-11-16  0:57 ` bugzilla-daemon
2019-11-16 12:07 ` bugzilla-daemon
2019-11-16 13:36 ` bugzilla-daemon
2019-11-16 14:15 ` bugzilla-daemon
2019-11-16 22:35 ` bugzilla-daemon
2019-11-17  0:43 ` bugzilla-daemon
2019-11-17  7:46 ` bugzilla-daemon
2019-12-05 17:00 ` bugzilla-daemon
2019-12-06  2:58 ` bugzilla-daemon
2019-12-06  3:04 ` bugzilla-daemon
2019-12-06  3:22 ` bugzilla-daemon
2019-12-06  4:30 ` bugzilla-daemon
2019-12-06  4:32 ` bugzilla-daemon
2019-12-06  4:45 ` bugzilla-daemon
2019-12-06  5:01 ` bugzilla-daemon
2019-12-06  5:52 ` bugzilla-daemon
2019-12-06  5:56 ` bugzilla-daemon
2019-12-07 19:48 ` bugzilla-daemon
2019-12-07 20:05 ` bugzilla-daemon
2019-12-07 20:20 ` bugzilla-daemon
2019-12-07 20:46 ` bugzilla-daemon
2019-12-07 21:04 ` bugzilla-daemon
2019-12-09  0:33 ` bugzilla-daemon
2019-12-09  0:55 ` bugzilla-daemon
2019-12-09 21:26 ` bugzilla-daemon
2019-12-10  1:03 ` bugzilla-daemon
2020-05-21 15:31 ` bugzilla-daemon
2020-06-03  8:26 ` bugzilla-daemon
2020-08-10  0:26 ` bugzilla-daemon
2020-12-01 21:54 ` bugzilla-daemon [this message]
2020-12-01 21:57 ` bugzilla-daemon
2020-12-01 22:47 ` bugzilla-daemon
2020-12-01 23:01 ` bugzilla-daemon
2020-12-02  1:33 ` bugzilla-daemon
2020-12-02  3:30 ` bugzilla-daemon
2020-12-02  3:34 ` bugzilla-daemon
2020-12-02  8:38 ` bugzilla-daemon
2020-12-02  9:57 ` bugzilla-daemon
2020-12-02 16:21 ` bugzilla-daemon
2020-12-02 19:31 ` bugzilla-daemon
2020-12-02 20:16 ` bugzilla-daemon
2020-12-02 21:11 ` bugzilla-daemon
2020-12-03  1:04 ` bugzilla-daemon
2020-12-13 23:56 ` bugzilla-daemon
2020-12-14 23:05 ` bugzilla-daemon
2020-12-14 23:26 ` bugzilla-daemon
2020-12-14 23:44 ` bugzilla-daemon
2021-02-06  5:34 ` bugzilla-daemon
2022-02-05 21:59 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-201539-2300-1eFwR5twmb@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).