All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/5] drm/amd/pm/smu7: return error on message send failure
Date: Thu, 02 Jul 2026 16:56:53 +0000	[thread overview]
Message-ID: <20260702165655.383E71F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <b284acc0dd71b46fbb402ed60f1da23604259e0a.1783009338.git.mirq-linux@rere.qmqm.pl>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Changing `smu7_send_msg_to_smc` to return error codes (like `-EOPNOTSUPP`) breaks caller contracts across the powerplay subsystem, leading to severe initialization failures and incomplete hardware teardowns.
--

commit 69f2b8c2068f5f9f311a575e997b86049cf9f826
Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Subject: drm/amd/pm/smu7: return error on message send failure

This commit changes smu7_send_msg_to_smc() to return standard error codes
like -EOPNOTSUPP and -EIO when the SMU message fails or is unsupported.
Previously, the function always returned 0 regardless of the SMU response.

> diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
> index ffe3ce87d9073..2e6dfe864306c 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/smu7_smumgr.c
> @@ -141,12 +141,16 @@ int smu7_send_msg_to_smc(struct pp_hwmgr *hwmgr, uint16_t msg)
>  
>  	ret = PHM_READ_FIELD(hwmgr->device, SMC_RESP_0, SMC_RESP);
>  
> -	if (ret == 0xFE)
> +	switch (ret) {
> +	case 1:
> +		return 0;
> +	case 0xFE:
>  		dev_dbg(adev->dev, "SMU message %#x was not supported\n", msg);
> -	else if (ret != 1)
> +		return -EOPNOTSUPP;

[Severity: High]
Does returning -EOPNOTSUPP here break caller contracts across the powerplay
subsystem?

Many callers appear to rely on the previous behavior where unsupported
messages (0xFE) still returned 0. For example, in smu7_stop_dpm():

drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c:smu7_stop_dpm() {
        ...
        PP_ASSERT_WITH_CODE(
                (smum_send_msg_to_smc(hwmgr,
                                      PPSMC_MSG_PCIeDPM_Disable,
                                      NULL) == 0),
                "Failed to disable pcie DPM during DPM Stop Function!",
                return -EINVAL);
        ...
}

If the hardware doesn't support PPSMC_MSG_PCIeDPM_Disable, the function now
returns -EOPNOTSUPP. Will this cause smu7_stop_dpm() to abort early and
skip critical teardown steps like smu7_disable_sclk_mclk_dpm()?

Similarly, in fiji_thermal_setup_fan_table(), an unsupported
PPSMC_MSG_SetFanMinPwm message will cause the return value to be non-zero,
which might mistakenly disable microcode fan control entirely.

> +	default:
>  		dev_info(adev->dev, "SMU message %#x failed: response is %d\n", msg, ret);
> -
> -	return 0;
> +		return ret != 0xFFFF ? -EIO : -ENXIO;
> +	}
>  }
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783009338.git.mirq-linux@rere.qmqm.pl?part=3

  reply	other threads:[~2026-07-02 16:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 16:24 [PATCH 0/5] Random debugging quality-of-life improvements Michał Mirosław
2026-07-02 16:24 ` [PATCH 1/5] drm/amd/display/amdgpu_dm: show error names Michał Mirosław
2026-07-02 16:24 ` [PATCH 4/5] drm/amd/amdgpu/cgs: Avoid redundant copying of firmware filename Michał Mirosław
2026-07-02 16:24 ` [PATCH 3/5] drm/amd/pm/smu7: return error on message send failure Michał Mirosław
2026-07-02 16:56   ` sashiko-bot [this message]
2026-07-02 16:24 ` [PATCH 2/5] drm/amd/pm/smu7: make SMU message reports more readable Michał Mirosław
2026-07-02 16:24 ` [PATCH 5/5] drm/amdgpu: debugfs: avoid extra EOLs in amdgpu_gem_info Michał Mirosław
2026-07-02 17:06   ` sashiko-bot

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=20260702165655.383E71F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.