<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:11pt;color:#0078D7;margin:5pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Likun Gao <likun.gao@amd.com><br>
<b>Sent:</b> Friday, December 11, 2020 4:01 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Gao, Likun <Likun.Gao@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Subject:</b> [V2] drm/amdgpu: add judgement for suspend/resume sequence</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Likun Gao <Likun.Gao@amd.com><br>
<br>
S0ix only makes sense on APUs since they are part of the platform, so<br>
only when the ASIC is APU should set amdgpu_acpi_is_s0ix_supported flag<br>
to deal with the related situation.<br>
<br>
Signed-off-by: Likun Gao <Likun.Gao@amd.com><br>
Change-Id: Ic89df206734fa7e6ce3e5a784171f149a07edc80<br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 ++--<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 8 +++++---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++---<br>
3 files changed, 10 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index 83ac06a3ec05..eed5410947e9 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -1314,11 +1314,11 @@ int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);<br>
<br>
void amdgpu_acpi_get_backlight_caps(struct amdgpu_device *adev,<br>
struct amdgpu_dm_backlight_caps *caps);<br>
-bool amdgpu_acpi_is_s0ix_supported(void);<br>
+bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev);<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_s0ix_supported(void) { return false; }<br>
+static inline bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev) { return false; }<br>
#endif<br>
<br>
int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c<br>
index fd66ac00c7f5..8155c54392c8 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c<br>
@@ -901,10 +901,12 @@ void amdgpu_acpi_fini(struct amdgpu_device *adev)<br>
*<br>
* returns true if supported, false if not.<br>
*/<br>
-bool amdgpu_acpi_is_s0ix_supported()<br>
+bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)<br>
{<br>
- if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)<br>
- return true;<br>
+ if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {<br>
+ if (adev->flags & AMD_IS_APU)<br>
+ return true;<br>
+ }<br>
<br>
return false;<br>
}<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index 52d6f1fbe890..66b790dfb151 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -2651,7 +2651,7 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)<br>
{<br>
int i, r;<br>
<br>
- if (!amdgpu_acpi_is_s0ix_supported() || amdgpu_in_reset(adev)) {<br>
+ if (!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) {<br>
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);<br>
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);<br>
}<br>
@@ -3712,7 +3712,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)<br>
<br>
amdgpu_fence_driver_suspend(adev);<br>
<br>
- if (!amdgpu_acpi_is_s0ix_supported() || amdgpu_in_reset(adev))<br>
+ if (!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev))<br>
r = amdgpu_device_ip_suspend_phase2(adev);<br>
else<br>
amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry);<br>
@@ -3747,7 +3747,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)<br>
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)<br>
return 0;<br>
<br>
- if (amdgpu_acpi_is_s0ix_supported())<br>
+ if (amdgpu_acpi_is_s0ix_supported(adev))<br>
amdgpu_gfx_state_change_set(adev, sGpuChangeState_D0Entry);<br>
<br>
/* post card */<br>
-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7Cf91d4568bfcc442e773808d89db36073%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637432741044140311%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=sxM%2BF4tq7x73lRdc%2FftMGE8yrN%2BoBgs3syxFoK0q8Cc%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7Cf91d4568bfcc442e773808d89db36073%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637432741044140311%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=sxM%2BF4tq7x73lRdc%2FftMGE8yrN%2BoBgs3syxFoK0q8Cc%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>