<div dir="ltr"><div>Does anything use it? Might be useful for debugging, but I guess you'd probably use something like umr in that case.</div><div><br></div><div>Alex<br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 31, 2018 at 9:15 PM, Zhu, Rex <span dir="ltr"><<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_-777202135617971185divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Alex,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Is it necessary to export an interface as "is_gfx_on" in powerplay to amdgpu?</p>
<p style="margin-top:0;margin-bottom:0">It can show the current power state of gfx ip.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex </p>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_-777202135617971185divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org" target="_blank">amd-gfx-bounces@lists.<wbr>freedesktop.org</a>> on behalf of Zhu, Rex <<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>><br>
<b>Sent:</b> Monday, July 30, 2018 11:39 AM<br>
<b>To:</b> Quan, Evan; <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><div><div class="h5"><br>
<b>Subject:</b> Re: [PATCH 3/3] drm/amd/pp: Add gfx power status check support on Rv/Vega12</div></div></font>
<div> </div>
</div><div><div class="h5">
<div dir="ltr">
<div id="m_-777202135617971185x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0;margin-bottom:0"><span>> It means user was told the gfx is on but actually it may switches to gfxoff already.</span></p>
<p style="margin-top:0;margin-bottom:0"><span></span><br>
</p>
<p style="margin-top:0;margin-bottom:0">Correct. <br>
</p>
<p style="margin-top:0;margin-bottom:0">So if the gfx is off, user should disable gfx off feature before they read/write the registers via mmio.</p>
<p style="margin-top:0;margin-bottom:0">if gfx is on, that is not mean the gfx off feature is disabled. it doesn't mean it is safe to visit the registers through mmio.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex<br>
</p>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_-777202135617971185x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Quan, Evan<br>
<b>Sent:</b> Monday, July 30, 2018 9:31 AM<br>
<b>To:</b> Zhu, Rex; <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
<b>Subject:</b> Re: [PATCH 3/3] drm/amd/pp: Add gfx power status check support on Rv/Vega12</font>
<div> </div>
</div>
<div dir="ltr">
<div id="m_-777202135617971185x_x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0;margin-bottom:0">Since the gfxoff is always in dynamic switch, i do not think the status reported to user is reliable. It means user was told the gfx is on but actually it may switches to gfxoff already.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Regards,</p>
<p style="margin-top:0;margin-bottom:0">Evan</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_-777202135617971185x_x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org" target="_blank">amd-gfx-bounces@lists.<wbr>freedesktop.org</a>> on behalf of Rex Zhu <<a href="mailto:rex.zhu@amd.com" target="_blank">rex.zhu@amd.com</a>><br>
<b>Sent:</b> Sunday, July 29, 2018 7:42:27 PM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
<b>Cc:</b> Zhu, Rex<br>
<b>Subject:</b> [PATCH 3/3] drm/amd/pp: Add gfx power status check support on Rv/Vega12</font>
<div> </div>
</div>
<div class="m_-777202135617971185x_x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="m_-777202135617971185x_x_PlainText">As gfx off is supported on Rv/Vega12, so this check is<br>
helpful and necessary when visit gfx regesiter via mmio.<br>
<br>
Signed-off-by: Rex Zhu <<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>><br>
---<br>
drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu10_hwmgr.c | 10 +++++++<br>
drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/vega12_hwmgr.c | 31 +++++++++++++++++++++-<br>
2 files changed, 40 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu10_hwmgr.c<br>
index 26d130a..da1be82 100644<br>
--- a/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu10_hwmgr.c<br>
@@ -296,6 +296,15 @@ static bool smu10_is_gfx_on(struct pp_hwmgr *hwmgr)<br>
return false;<br>
}<br>
<br>
+static bool smu10_is_hw_ip_on(struct pp_hwmgr *hwmgr,<br>
+ <wbr> enum amd_ip_block_type client)<br>
+{<br>
+ if (client == AMD_IP_BLOCK_TYPE_GFX)<br>
+ return smu10_is_gfx_on(hwmgr);<br>
+ else /* for other ip, to do */<br>
+ return true;<br>
+}<br>
+<br>
static int smu10_disable_gfx_off(struct pp_hwmgr *hwmgr)<br>
{<br>
struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);<br>
@@ -1187,6 +1196,7 @@ static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate)<br>
.smus_notify_pwe = smu10_smus_notify_pwe,<br>
.display_clock_voltage_request = smu10_display_clock_voltage_<wbr>request,<br>
.powergate_gfx = smu10_gfx_off_control,<br>
+ .is_hw_ip_on = smu10_is_hw_ip_on,<br>
};<br>
<br>
int smu10_init_function_pointers(<wbr>struct pp_hwmgr *hwmgr)<br>
diff --git a/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/vega12_hwmgr.c<br>
index 0789d64..ee44300 100644<br>
--- a/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/vega12_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/vega12_hwmgr.c<br>
@@ -45,7 +45,7 @@<br>
#include "ppinterrupt.h"<br>
#include "pp_overdriver.h"<br>
#include "pp_thermal.h"<br>
-<br>
+#include "soc15_common.h"<br>
<br>
static int vega12_force_clock_level(<wbr>struct pp_hwmgr *hwmgr,<br>
enum pp_clock_type type, uint32_t mask);<br>
@@ -2320,6 +2320,34 @@ static int vega12_get_thermal_<wbr>temperature_range(struct pp_hwmgr *hwmgr,<br>
return 0;<br>
}<br>
<br>
+/* GFX HW Power Status can be queried from bits [1:0] of MP1_SMN_EXT_SCRATCH0<br>
+ * 2'b00 GFX is OFF<br>
+ * 2'b01 Transitioning out of GFXOFF state<br>
+ * 2'b10 GFX is ON<br>
+ * 2'b11 Transitioning into GFXOFF state<br>
+*/<br>
+<br>
+static bool vega12_is_gfx_on(struct pp_hwmgr *hwmgr)<br>
+{<br>
+ uint32_t tmp;<br>
+ struct amdgpu_device *adev = hwmgr->adev;<br>
+<br>
+ tmp = RREG32_SOC15(MP1, 0, mmMP1_SMN_EXT_SCRATCH0);<br>
+ if (tmp == 1 || tmp == 2)<br>
+ return true;<br>
+ else<br>
+ return false;<br>
+}<br>
+<br>
+static bool vega12_is_hw_ip_on(struct pp_hwmgr *hwmgr,<br>
+ <wbr> enum amd_ip_block_type client)<br>
+{<br>
+ if (client == AMD_IP_BLOCK_TYPE_GFX)<br>
+ return vega12_is_gfx_on(hwmgr);<br>
+ else /* for other ip, to do */<br>
+ return true;<br>
+}<br>
+<br>
static int vega12_enable_gfx_off(struct pp_hwmgr *hwmgr)<br>
{<br>
struct vega12_hwmgr *data =<br>
@@ -2402,6 +2430,7 @@ static int vega12_gfx_off_control(struct pp_hwmgr *hwmgr, bool enable)<br>
.register_irq_handlers = smu9_register_irq_handlers,<br>
.start_thermal_controller = vega12_start_thermal_<wbr>controller,<br>
.powergate_gfx = vega12_gfx_off_control,<br>
+ .is_hw_ip_on = vega12_is_hw_ip_on,<br>
};<br>
<br>
int vega12_hwmgr_init(struct pp_hwmgr *hwmgr)<br>
-- <br>
1.9.1<br>
<br>
______________________________<wbr>_________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="m_-777202135617971185LPlnk332384" class="m_-777202135617971185x_OWAAutoLink" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/amd-gfx</a>
<div id="m_-777202135617971185LPBorder_GT_15329216129360.023283015732668888" style="margin-bottom:20px;overflow:auto;width:100%;text-indent:0px">
<table id="m_-777202135617971185LPContainer_15329216129340.4712885778626795" style="width:90%;background-color:rgb(255,255,255);overflow:auto;padding-top:20px;padding-bottom:20px;margin-top:20px;border-top:1px dotted rgb(200,200,200);border-bottom:1px dotted rgb(200,200,200)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td id="m_-777202135617971185x_TextCell_15329216129340.47980485889895885" colspan="2" style="vertical-align:top;padding:0px;display:table-cell">
<div id="m_-777202135617971185LPRemovePreviewContainer_15329216129340.8736912459594872"></div>
<div id="m_-777202135617971185LPTitle_15329216129340.277757395718243" style="color:rgb(0,120,215);font-weight:400;font-size:21px;font-family:"wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;line-height:21px">
<a id="m_-777202135617971185LPUrlAnchor_15329216129340.04206666600487852" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" style="text-decoration:none" target="_blank">amd-gfx Info Page - freedesktop.org</a></div>
<div id="m_-777202135617971185LPMetadata_15329216129340.9190483966147242" style="margin:10px 0px 16px;color:rgb(102,102,102);font-weight:400;font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:14px">
<a href="http://lists.freedesktop.org" target="_blank">lists.freedesktop.org</a></div>
<div id="m_-777202135617971185LPDescription_15329216129340.6657080067609241" style="display:block;color:rgb(102,102,102);font-weight:400;font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:20px;max-height:100px;overflow:hidden">
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all <a href="http://freedesktop.org" target="_blank">freedesktop.org</a> lists is subject to our Code of Conduct.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</span></font></div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>
<br>______________________________<wbr>_________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/amd-gfx</a><br>
<br></blockquote></div><br></div></div></div>