From: <boyuan.zhang@amd.com>
To: <amd-gfx@lists.freedesktop.org>, <leo.liu@amd.com>,
<christian.koenig@amd.com>, <alexander.deucher@amd.com>,
<sunil.khatri@amd.com>
Cc: Boyuan Zhang <boyuan.zhang@amd.com>
Subject: [PATCH 04/18] drm/amd/pm: add inst to set_powergating_by_smu
Date: Fri, 4 Oct 2024 14:44:30 -0400 [thread overview]
Message-ID: <20241004184444.435356-5-boyuan.zhang@amd.com> (raw)
In-Reply-To: <20241004184444.435356-1-boyuan.zhang@amd.com>
From: Boyuan Zhang <boyuan.zhang@amd.com>
Add an instance parameter to set_powergating_by_smu() function, and
re-write all amd_pm functions accordingly. Then use the instance to
call smu_dpm_set_vcn_enable().
v2: remove duplicated functions.
remove for-loop in smu_dpm_set_power_gate(), and temporarily move it to
to amdgpu_dpm_set_powergating_by_smu(), in order to keep the exact same
logic as before, until further separation in next patch.
Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
---
drivers/gpu/drm/amd/include/kgd_pp_interface.h | 4 +++-
drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 10 ++++++++--
drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 4 +++-
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 4 +++-
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 14 ++++++--------
5 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
index 2fa71f68205e..f24bc61df9a7 100644
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
@@ -405,7 +405,9 @@ struct amd_pm_funcs {
int (*load_firmware)(void *handle);
int (*wait_for_fw_loading_complete)(void *handle);
int (*set_powergating_by_smu)(void *handle,
- uint32_t block_type, bool gate);
+ uint32_t block_type,
+ bool gate,
+ int inst);
int (*set_clockgating_by_smu)(void *handle, uint32_t msg_id);
int (*set_power_limit)(void *handle, uint32_t n);
int (*get_power_limit)(void *handle, uint32_t *limit,
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
index 9dc82f4d7c93..bcedbeec082f 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
@@ -88,7 +88,6 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t block
case AMD_IP_BLOCK_TYPE_UVD:
case AMD_IP_BLOCK_TYPE_VCE:
case AMD_IP_BLOCK_TYPE_GFX:
- case AMD_IP_BLOCK_TYPE_VCN:
case AMD_IP_BLOCK_TYPE_SDMA:
case AMD_IP_BLOCK_TYPE_JPEG:
case AMD_IP_BLOCK_TYPE_GMC:
@@ -96,7 +95,14 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t block
case AMD_IP_BLOCK_TYPE_VPE:
if (pp_funcs && pp_funcs->set_powergating_by_smu)
ret = (pp_funcs->set_powergating_by_smu(
- (adev)->powerplay.pp_handle, block_type, gate));
+ (adev)->powerplay.pp_handle, block_type, gate, 0));
+ break;
+ case AMD_IP_BLOCK_TYPE_VCN:
+ if (pp_funcs && pp_funcs->set_powergating_by_smu) {
+ for (int i = 0; i < adev->vcn.num_vcn_inst; i++)
+ ret = (pp_funcs->set_powergating_by_smu(
+ (adev)->powerplay.pp_handle, block_type, gate, i));
+ }
break;
default:
break;
diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
index 2cd6cb991f29..af7da780b58b 100644
--- a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
+++ b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
@@ -3287,7 +3287,9 @@ static int kv_dpm_read_sensor(void *handle, int idx,
}
static int kv_set_powergating_by_smu(void *handle,
- uint32_t block_type, bool gate)
+ uint32_t block_type,
+ bool gate,
+ int inst)
{
switch (block_type) {
case AMD_IP_BLOCK_TYPE_UVD:
diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
index f193c77cc141..de5ee1c5503f 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
@@ -1241,7 +1241,9 @@ static void pp_dpm_powergate_sdma(void *handle, bool gate)
}
static int pp_set_powergating_by_smu(void *handle,
- uint32_t block_type, bool gate)
+ uint32_t block_type,
+ bool gate,
+ int inst)
{
int ret = 0;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 786241fa8d2c..0da84e390d0d 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -353,10 +353,10 @@ static int smu_set_mall_enable(struct smu_context *smu)
*/
static int smu_dpm_set_power_gate(void *handle,
uint32_t block_type,
- bool gate)
+ bool gate,
+ int inst)
{
struct smu_context *smu = handle;
- struct amdgpu_device *adev = smu->adev;
int ret = 0;
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
@@ -373,12 +373,10 @@ static int smu_dpm_set_power_gate(void *handle,
*/
case AMD_IP_BLOCK_TYPE_UVD:
case AMD_IP_BLOCK_TYPE_VCN:
- for (int i = 0; i < adev->vcn.num_vcn_inst; i++) {
- ret = smu_dpm_set_vcn_enable(smu, !gate, i);
- if (ret)
- dev_err(smu->adev->dev, "Failed to power %s VCN!\n",
- gate ? "gate" : "ungate");
- }
+ ret = smu_dpm_set_vcn_enable(smu, !gate, inst);
+ if (ret)
+ dev_err(smu->adev->dev, "Failed to power %s VCN!\n",
+ gate ? "gate" : "ungate");
break;
case AMD_IP_BLOCK_TYPE_GFX:
ret = smu_gfx_off_control(smu, gate);
--
2.34.1
next prev parent reply other threads:[~2024-10-04 18:45 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 18:44 [PATCH 00/18] Separating vcn power management by instance boyuan.zhang
2024-10-04 18:44 ` [PATCH 01/18] drm/amd/pm: add inst to dpm_set_vcn_enable boyuan.zhang
2024-10-04 18:44 ` [PATCH 02/18] drm/amd/pm: power up or down vcn by instance boyuan.zhang
2024-10-04 18:44 ` [PATCH 03/18] drm/amd/pm: add inst to smu_dpm_set_vcn_enable boyuan.zhang
2024-10-04 18:44 ` boyuan.zhang [this message]
2024-10-04 19:14 ` [PATCH 04/18] drm/amd/pm: add inst to set_powergating_by_smu Alex Deucher
2024-10-08 22:06 ` Boyuan Zhang
2024-10-04 18:44 ` [PATCH 05/18] drm/amd/pm: add inst to amdgpu_dpm_set_powergating_by_smu boyuan.zhang
2024-10-04 18:44 ` [PATCH 06/18] add inst to amdgpu_dpm_enable_vcn boyuan.zhang
2024-10-04 18:44 ` [PATCH 07/18] drm/amdgpu: pass ip_block in set_powergating_state boyuan.zhang
2024-10-04 18:44 ` [PATCH 08/18] drm/amdgpu: track instances of the same IP block boyuan.zhang
2024-10-04 18:44 ` [PATCH 09/18] drm/amdgpu: add set_powergating_state_instance boyuan.zhang
2024-10-04 19:40 ` Alex Deucher
2024-10-08 22:07 ` Boyuan Zhang
2024-10-04 18:44 ` [PATCH 10/18] drm/amdgpu/vcn: separate gating state by instance boyuan.zhang
2024-10-04 18:44 ` [PATCH 11/18] drm/amdgpu: power vcn 2_5 " boyuan.zhang
2024-10-04 19:52 ` Alex Deucher
2024-10-08 22:10 ` Boyuan Zhang
2024-10-07 5:22 ` Lazar, Lijo
2024-10-07 13:33 ` Boyuan Zhang
2024-10-07 13:50 ` Lazar, Lijo
2024-10-07 14:17 ` Alex Deucher
2024-10-07 14:29 ` Christian König
2024-10-07 14:32 ` Lazar, Lijo
2024-10-07 15:24 ` Alex Deucher
2024-10-08 7:03 ` Lazar, Lijo
2024-10-08 22:04 ` Boyuan Zhang
2024-10-09 3:43 ` Lazar, Lijo
2024-10-09 13:36 ` Boyuan Zhang
2024-10-09 14:07 ` Lazar, Lijo
2024-10-04 18:44 ` [PATCH 12/18] drm/amdgpu: power vcn 3_0 " boyuan.zhang
2024-10-04 18:44 ` [PATCH 13/18] drm/amdgpu: power vcn 4_0 " boyuan.zhang
2024-10-04 18:44 ` [PATCH 14/18] drm/amdgpu: power vcn 4_0_3 " boyuan.zhang
2024-10-04 18:44 ` [PATCH 15/18] drm/amdgpu: power vcn 4_0_5 " boyuan.zhang
2024-10-04 18:44 ` [PATCH 16/18] drm/amdgpu: power vcn 5_0_0 " boyuan.zhang
2024-10-04 18:44 ` [PATCH 17/18] drm/amdgpu/vcn: separate idle work " boyuan.zhang
2024-10-04 18:44 ` [PATCH 18/18] drm/amdgpu: set powergating state by vcn instance boyuan.zhang
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=20241004184444.435356-5-boyuan.zhang@amd.com \
--to=boyuan.zhang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=leo.liu@amd.com \
--cc=sunil.khatri@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 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.