All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Wang, Kevin(Yang)" <Kevin1.Wang@amd.com>
To: "Powell, Darren" <Darren.Powell@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Lazar, Lijo" <Lijo.Lazar@amd.com>
Subject: Re: [PATCH 1/8] amdgpu/pm: Powerplay API for smu , added get_performance_level
Date: Mon, 21 Dec 2020 04:09:49 +0000	[thread overview]
Message-ID: <MN2PR12MB30224CFCB8144D12EE982B76A2C00@MN2PR12MB3022.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20201219004831.13527-2-darren.powell@amd.com>


[-- Attachment #1.1: Type: text/plain, Size: 4782 bytes --]

[AMD Official Use Only - Internal Distribution Only]


________________________________
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Darren Powell <darren.powell@amd.com>
Sent: Saturday, December 19, 2020 8:48 AM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Powell, Darren <Darren.Powell@amd.com>
Subject: [PATCH 1/8] amdgpu/pm: Powerplay API for smu , added get_performance_level

Modified Functions
  smu_get_performance_level() - modifed arg0 to match Powerplay API get_performance_level

Other Changes
  added a new structure swsmu_dpm_funcs to hold smu functions for Powerplay API
  removed special smu handling from amdgpu_get_power_dpm_force_performance_level

Signed-off-by: Darren Powell <darren.powell@amd.com>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c        |  4 +---
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h   |  2 +-
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 +++++++++++-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 7b6ef05a1d35..0008bbe971d6 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -280,9 +280,7 @@ static ssize_t amdgpu_get_power_dpm_force_performance_level(struct device *dev,
                 return ret;
         }

-       if (is_support_sw_smu(adev))
-               level = smu_get_performance_level(&adev->smu);
-       else if (adev->powerplay.pp_funcs->get_performance_level)
+       if (adev->powerplay.pp_funcs->get_performance_level)
                 level = amdgpu_dpm_get_performance_level(adev);
         else
                 level = adev->pm.dpm.forced_level;
diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
index 89be49a43500..10914f3438ac 100644
--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
@@ -743,7 +743,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
                            uint32_t *min, uint32_t *max);
 int smu_set_soft_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
                             uint32_t min, uint32_t max);
-enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
+enum amd_dpm_forced_level smu_get_performance_level(void *handle);
 int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
 int smu_set_display_count(struct smu_context *smu, uint32_t count);
 int smu_set_ac_dc(struct smu_context *smu);
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index cf999b7a2164..36d18668ec99 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -46,6 +46,8 @@
 #undef pr_info
 #undef pr_debug

+static const struct amd_pm_funcs swsmu_dpm_funcs;
+
 size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf)
 {
         size_t size = 0;
@@ -428,6 +430,9 @@ static int smu_early_init(void *handle)
         smu->smu_baco.state = SMU_BACO_STATE_EXIT;
         smu->smu_baco.platform_support = false;

+       adev->powerplay.pp_handle = smu;
+       adev->powerplay.pp_funcs = &swsmu_dpm_funcs;
+
         return smu_set_funcs(adev);
 }

@@ -1569,8 +1574,9 @@ int smu_switch_power_profile(struct smu_context *smu,
         return 0;
 }

-enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu)
+enum amd_dpm_forced_level smu_get_performance_level(void *handle)
 {
+       struct smu_context *smu = handle;
         struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
         enum amd_dpm_forced_level level;

@@ -2549,3 +2555,7 @@ int smu_gfx_state_change_set(struct smu_context *smu, uint32_t state)

         return ret;
 }
+
+static const struct amd_pm_funcs swsmu_dpm_funcs = {
+       .get_performance_level = smu_get_performance_level,
+};

[kevin]:
could you change this name to "smu_pm_funcs" or others,
not of all fields is DPM related functions in data structure of 'amd_pm_funcs'
it will make some confused for developers.

--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CKevin1.Wang%40amd.com%7Ce82fe9048c4d43857c9908d8a3b7e561%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637439357533667974%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=vGF8e0xTEWyAqKusXbH23Ez4k5Lzz6RmORQXN6unJz8%3D&amp;reserved=0

[-- Attachment #1.2: Type: text/html, Size: 8321 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2020-12-21  4:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-19  0:48 [PATCH 0/8] amdgpu/pm: Powerplay API for smu Darren Powell
2020-12-19  0:48 ` [PATCH 1/8] amdgpu/pm: Powerplay API for smu , added get_performance_level Darren Powell
2020-12-21  4:09   ` Wang, Kevin(Yang) [this message]
2020-12-19  0:48 ` [PATCH 2/8] amdgpu/pm: Powerplay API for smu , changed 6 dpm reset functions to use API Darren Powell
2020-12-19  0:48 ` [PATCH 3/8] amdgpu/pm: Powerplay API for smu , changed 6 pm hwmon fan " Darren Powell
2020-12-21  4:16   ` Wang, Kevin(Yang)
2020-12-19  0:48 ` [PATCH 4/8] amdgpu/pm: Powerplay API for smu , changed 9 pm power " Darren Powell
2020-12-21  4:31   ` Wang, Kevin(Yang)
2020-12-19  0:48 ` [PATCH 5/8] amdgpu/pm: Powerplay API for smu , changed 5 dpm powergating & sensor " Darren Powell
2020-12-19  0:48 ` [PATCH 6/8] amdgpu/pm: Powerplay API for smu , changes to clock and profile mode functions Darren Powell
2020-12-19  0:48 ` [PATCH 7/8] amdgpu/pm: Powerplay API for smu , changed 4 dpm functions to use API Darren Powell
2020-12-19  0:48 ` [PATCH 8/8] amdgpu/pm: Powerplay API for smu , updates to some pm functions Darren Powell
2020-12-21  3:04 ` [PATCH 0/8] amdgpu/pm: Powerplay API for smu Quan, Evan
2021-01-13  3:27 Darren Powell
2021-01-13  3:27 ` [PATCH 1/8] amdgpu/pm: Powerplay API for smu , added get_performance_level Darren Powell
2021-02-23  4:20 [PATCH 0/8] amdgpu/pm: Powerplay API for smu Darren Powell
2021-02-23  4:20 ` [PATCH 1/8] amdgpu/pm: Powerplay API for smu , added get_performance_level Darren Powell

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=MN2PR12MB30224CFCB8144D12EE982B76A2C00@MN2PR12MB3022.namprd12.prod.outlook.com \
    --to=kevin1.wang@amd.com \
    --cc=Darren.Powell@amd.com \
    --cc=Lijo.Lazar@amd.com \
    --cc=amd-gfx@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 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.