All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rex Zhu <rex.zhu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 3/3] drm/amd/pp: Add gfx power status check support on Rv/Vega12
Date: Sun, 29 Jul 2018 19:42:27 +0800	[thread overview]
Message-ID: <1532864547-1072-3-git-send-email-rex.zhu@amd.com> (raw)
In-Reply-To: <1532864547-1072-1-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>

As gfx off is supported on Rv/Vega12, so this check is
helpful and necessary when visit gfx regesiter via mmio.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c  | 10 +++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 31 +++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
index 26d130a..da1be82 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
@@ -296,6 +296,15 @@ static bool smu10_is_gfx_on(struct pp_hwmgr *hwmgr)
 	return false;
 }
 
+static bool smu10_is_hw_ip_on(struct pp_hwmgr *hwmgr,
+				enum amd_ip_block_type client)
+{
+	if (client == AMD_IP_BLOCK_TYPE_GFX)
+		return smu10_is_gfx_on(hwmgr);
+	else /* for other ip, to do */
+		return true;
+}
+
 static int smu10_disable_gfx_off(struct pp_hwmgr *hwmgr)
 {
 	struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
@@ -1187,6 +1196,7 @@ static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate)
 	.smus_notify_pwe = smu10_smus_notify_pwe,
 	.display_clock_voltage_request = smu10_display_clock_voltage_request,
 	.powergate_gfx = smu10_gfx_off_control,
+	.is_hw_ip_on = smu10_is_hw_ip_on,
 };
 
 int smu10_init_function_pointers(struct pp_hwmgr *hwmgr)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
index 0789d64..ee44300 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
@@ -45,7 +45,7 @@
 #include "ppinterrupt.h"
 #include "pp_overdriver.h"
 #include "pp_thermal.h"
-
+#include "soc15_common.h"
 
 static int vega12_force_clock_level(struct pp_hwmgr *hwmgr,
 		enum pp_clock_type type, uint32_t mask);
@@ -2320,6 +2320,34 @@ static int vega12_get_thermal_temperature_range(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+/* GFX HW Power Status can be queried from bits [1:0] of MP1_SMN_EXT_SCRATCH0
+ * 2'b00   GFX is OFF
+ * 2'b01   Transitioning out of GFXOFF state
+ * 2'b10   GFX is ON
+ * 2'b11   Transitioning into GFXOFF state
+*/
+
+static bool vega12_is_gfx_on(struct pp_hwmgr *hwmgr)
+{
+	uint32_t tmp;
+	struct amdgpu_device *adev = hwmgr->adev;
+
+	tmp = RREG32_SOC15(MP1, 0, mmMP1_SMN_EXT_SCRATCH0);
+	if (tmp == 1 || tmp == 2)
+		return true;
+	else
+		return false;
+}
+
+static bool vega12_is_hw_ip_on(struct pp_hwmgr *hwmgr,
+				enum amd_ip_block_type client)
+{
+	if (client == AMD_IP_BLOCK_TYPE_GFX)
+		return vega12_is_gfx_on(hwmgr);
+	else /* for other ip, to do */
+		return true;
+}
+
 static int vega12_enable_gfx_off(struct pp_hwmgr *hwmgr)
 {
 	struct vega12_hwmgr *data =
@@ -2402,6 +2430,7 @@ static int vega12_gfx_off_control(struct pp_hwmgr *hwmgr, bool enable)
 	.register_irq_handlers = smu9_register_irq_handlers,
 	.start_thermal_controller = vega12_start_thermal_controller,
 	.powergate_gfx = vega12_gfx_off_control,
+	.is_hw_ip_on = vega12_is_hw_ip_on,
 };
 
 int vega12_hwmgr_init(struct pp_hwmgr *hwmgr)
-- 
1.9.1

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

  parent reply	other threads:[~2018-07-29 11:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-29 11:42 [PATCH 1/3] drm/amd/pp: Delete duplicated interface in hwmgr_func Rex Zhu
     [not found] ` <1532864547-1072-1-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
2018-07-29 11:42   ` [PATCH 2/3] drm/amd/pp: Export interface to help check hw power state Rex Zhu
2018-07-29 11:42   ` Rex Zhu [this message]
     [not found]     ` <1532864547-1072-3-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
2018-07-30  1:31       ` [PATCH 3/3] drm/amd/pp: Add gfx power status check support on Rv/Vega12 Quan, Evan
     [not found]         ` <SN6PR12MB2656D918D6DBD7C1932747BFE42F0-kxOKjb6HO/FeL/N0e1LXkAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-07-30  3:39           ` Zhu, Rex
     [not found]             ` <CY4PR12MB1687B6284781F05DDD30ACA6FB2F0-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-08-01  1:15               ` Zhu, Rex
     [not found]                 ` <CY4PR12MB168799400EFB54D63F9EAE6CFB2D0-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-08-01 15:13                   ` Alex Deucher
     [not found]                     ` <CADnq5_N_BsHR9WCMcZ04wt+jL=6bCB_R=m2w=w+nb_O7Ugnj_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-02 10:22                       ` Zhu, Rex
     [not found]                         ` <CY4PR12MB1687D8D4388E80BE18A677F8FB2C0-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-08-02 13:38                           ` Alex Deucher
2018-07-30  1:27   ` [PATCH 1/3] drm/amd/pp: Delete duplicated interface in hwmgr_func Quan, Evan

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=1532864547-1072-3-git-send-email-rex.zhu@amd.com \
    --to=rex.zhu-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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.