<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
Talking from generic API perspective - S3 is considered active for dGPU only if it's going to non-S0 state. If called from anywhere else than suspend op, this should return false.<span></span></div>
<div id="ms-outlook-mobile-signature" dir="auto">
<div><br>
</div>
Thanks,<br>
Lijo</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Limonciello, Mario <Mario.Limonciello@amd.com><br>
<b>Sent:</b> Wednesday, January 26, 2022 8:37:28 PM<br>
<b>To:</b> Lazar, Lijo <Lijo.Lazar@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Liang, Prike <Prike.Liang@amd.com><br>
<b>Subject:</b> RE: [PATCH v5 2/4] drm/amd: add support to check whether the system is set to s3</font>
<div> </div>
</div>
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
{color:#0563C1;
text-decoration:underline}
span.x_EmailStyle18
{font-family:"Calibri",sans-serif;
color:windowtext}
p.x_msipheaderc10f11a2, li.x_msipheaderc10f11a2, div.x_msipheaderc10f11a2
{margin-right:0in;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
.x_MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
{}
-->
</style>
<div lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_msipheaderc10f11a2" style="margin:0in"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:green">[Public]</span></p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">That was intentional – shouldn’t dGPU always be going through S3 path currently?</p>
<p class="x_MsoNormal"> </p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> Lazar, Lijo <Lijo.Lazar@amd.com> <br>
<b>Sent:</b> Wednesday, January 26, 2022 09:06<br>
<b>To:</b> Limonciello, Mario <Mario.Limonciello@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Liang, Prike <Prike.Liang@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com><br>
<b>Subject:</b> Re: [PATCH v5 2/4] drm/amd: add support to check whether the system is set to s3</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p style="margin:15.0pt"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:green">[Public]</span></p>
<p class="x_MsoNormal"> </p>
<div>
<div>
<p class="x_MsoNormal" style="background:white"><span style="color:#212121">Returns true for dGPU always. Better to keep the whole check under something like this.</span></p>
</div>
<div>
<p class="x_MsoNormal" style="background:white"><span style="color:#212121"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="background:white"><span style="color:#212121">if (pm_suspend_target_state != PM_SUSPEND_ON)</span></p>
</div>
<div id="x_ms-outlook-mobile-signature">
<div>
<p class="x_MsoNormal"> </p>
</div>
<p class="x_MsoNormal">Thanks,<br>
Lijo</p>
</div>
<div class="x_MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="x_MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> on behalf of Mario Limonciello <<a href="mailto:mario.limonciello@amd.com">mario.limonciello@amd.com</a>><br>
<b>Sent:</b> Wednesday, January 26, 2022 9:39:42 AM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Cc:</b> Liang, Prike <<a href="mailto:Prike.Liang@amd.com">Prike.Liang@amd.com</a>>; Limonciello, Mario <<a href="mailto:Mario.Limonciello@amd.com">Mario.Limonciello@amd.com</a>><br>
<b>Subject:</b> [PATCH v5 2/4] drm/amd: add support to check whether the system is set to s3</span>
</p>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal" style="margin-bottom:12.0pt">This will be used to help make decisions on what to do in<br>
misconfigured systems.<br>
<br>
Signed-off-by: Mario Limonciello <<a href="mailto:mario.limonciello@amd.com">mario.limonciello@amd.com</a>><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 17 +++++++++++++++++<br>
2 files changed, 19 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index 3bc76759c143..f184c88d3d4f 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -1409,11 +1409,13 @@ int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_sta<br>
int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);<br>
<br>
void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);<br>
+bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);<br>
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);<br>
void amdgpu_acpi_detect(void);<br>
#else<br>
static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }<br>
static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }<br>
+static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false };<br>
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }<br>
static inline void amdgpu_acpi_detect(void) { }<br>
static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c<br>
index 2531da6cbec3..df673062bc03 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c<br>
@@ -1031,6 +1031,23 @@ void amdgpu_acpi_detect(void)<br>
}<br>
}<br>
<br>
+/**<br>
+ * amdgpu_acpi_is_s3_active<br>
+ *<br>
+ * @adev: amdgpu_device_pointer<br>
+ *<br>
+ * returns true if supported, false if not.<br>
+ */<br>
+bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)<br>
+{<br>
+#if IS_ENABLED(CONFIG_SUSPEND)<br>
+ return !(adev->flags & AMD_IS_APU) ||<br>
+ pm_suspend_target_state == PM_SUSPEND_MEM;<br>
+#else<br>
+ return false;<br>
+#endif<br>
+}<br>
+<br>
/**<br>
* amdgpu_acpi_is_s0ix_active<br>
*<br>
-- <br>
2.25.1</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>