From: Evan Quan <evan.quan@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alexander.Deucher@amd.com, Lijo.Lazar@amd.com,
Evan Quan <evan.quan@amd.com>,
rui.huang@amd.com
Subject: [PATCH 08/12] drm/amd/pm: add proper check for amdgpu_dpm before granting pp_dpm_load_fw
Date: Fri, 11 Feb 2022 15:52:05 +0800 [thread overview]
Message-ID: <20220211075209.894833-8-evan.quan@amd.com> (raw)
In-Reply-To: <20220211075209.894833-1-evan.quan@amd.com>
Make sure the interface get granted only when amdgpu_dpm enabled.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: Ia1d1123470fab89b41b24ea80dcb319570aa7438
---
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 6 ++++++
drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c | 3 ---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
index 4c709f7bcd51..e95893556147 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
@@ -49,6 +49,9 @@ static int amd_powerplay_create(struct amdgpu_device *adev)
hwmgr->adev = adev;
hwmgr->not_vf = !amdgpu_sriov_vf(adev);
+ hwmgr->pp_one_vf = amdgpu_sriov_is_pp_one_vf(adev);
+ hwmgr->pm_en = (amdgpu_dpm && (hwmgr->not_vf || hwmgr->pp_one_vf))
+ ? true : false;
hwmgr->device = amdgpu_cgs_create_device(adev);
mutex_init(&hwmgr->msg_lock);
hwmgr->chip_family = adev->family;
@@ -275,6 +278,9 @@ static int pp_dpm_load_fw(void *handle)
{
struct pp_hwmgr *hwmgr = handle;
+ if (!hwmgr->pm_en)
+ return -EOPNOTSUPP;
+
if (!hwmgr || !hwmgr->smumgr_funcs || !hwmgr->smumgr_funcs->start_smu)
return -EINVAL;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c
index 4fd61d7f6c70..c0c2f36094fa 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c
@@ -217,9 +217,6 @@ int hwmgr_hw_init(struct pp_hwmgr *hwmgr)
{
int ret = 0;
- hwmgr->pp_one_vf = amdgpu_sriov_is_pp_one_vf((struct amdgpu_device *)hwmgr->adev);
- hwmgr->pm_en = (amdgpu_dpm && (hwmgr->not_vf || hwmgr->pp_one_vf))
- ? true : false;
if (!hwmgr->pm_en)
return 0;
--
2.29.0
next prev parent reply other threads:[~2022-02-11 7:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 7:51 [PATCH 01/12] drm/amd/pm: drop unused structure members Evan Quan
2022-02-11 7:51 ` [PATCH 02/12] drm/amd/pm: drop unused interfaces Evan Quan
2022-02-11 7:52 ` [PATCH 03/12] drm/amd/pm: drop unneeded !smu->pm_enabled check Evan Quan
2022-02-11 7:52 ` [PATCH 04/12] drm/amd/pm: use adev->pm.dpm_enabled for dpm enablement check Evan Quan
2022-02-11 7:52 ` [PATCH 05/12] drm/amd/pm: move the check for dpm enablement to amdgpu_dpm.c Evan Quan
2022-02-11 8:06 ` Chen, Guchun
2022-02-17 1:53 ` Quan, Evan
2022-02-11 13:39 ` Lazar, Lijo
2022-02-17 2:35 ` Quan, Evan
2022-02-17 4:55 ` Lazar, Lijo
2022-02-11 7:52 ` [PATCH 06/12] drm/amd/pm: correct the checks for sriov(pp_one_vf) Evan Quan
2022-02-11 7:52 ` [PATCH 07/12] drm/amd/pm: correct the checks for granting gpu reset APIs Evan Quan
2022-02-14 4:04 ` Lazar, Lijo
2022-02-17 2:48 ` Quan, Evan
2022-02-17 5:00 ` Lazar, Lijo
2022-02-11 7:52 ` Evan Quan [this message]
2022-02-11 7:52 ` [PATCH 09/12] drm/amd/pm: drop redundant !pp_funcs check Evan Quan
2022-02-11 7:52 ` [PATCH 10/12] drm/amd/pm: drop nonsense !smu->ppt_funcs check Evan Quan
2022-02-11 7:52 ` [PATCH 11/12] drm/amd/pm: drop extra non-necessary null pointers checks Evan Quan
2022-02-11 7:52 ` [PATCH 12/12] drm/amd/pm: revise the implementations for asic reset Evan Quan
2022-02-11 13:21 ` Lazar, Lijo
2022-02-17 2:53 ` Quan, Evan
2022-02-11 7:55 ` [PATCH 01/12] drm/amd/pm: drop unused structure members Christian König
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=20220211075209.894833-8-evan.quan@amd.com \
--to=evan.quan@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Lijo.Lazar@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=rui.huang@amd.com \
/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