<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">
<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 Huang Rui <ray.huang@amd.com><br>
<b>Sent:</b> Wednesday, March 13, 2019 8:27 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Huang, Ray<br>
<b>Subject:</b> [PATCH] drm/amdgpu: enable gfxoff again on raven series</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This patch enables gfxoff and stutter mode again, since we take more testing on<br>
raven series. For raven2 and picasso, we can enable it directly. And for raven,<br>
we need check the RLC ucode version cannot be less than #531.<br>
<br>
Signed-off-by: Huang Rui <ray.huang@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++--<br>
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 21 +++++++++++++++++++++<br>
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 13 ++++---------<br>
4 files changed, 29 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index 95cd3b7..02c1125 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -1508,6 +1508,8 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)<br>
}<br>
<br>
adev->pm.pp_feature = amdgpu_pp_feature_mask;<br>
+ if (amdgpu_sriov_vf(adev))<br>
+ adev->pm.pp_feature &= ~PP_GFXOFF_MASK;<br>
<br>
for (i = 0; i < adev->num_ip_blocks; i++) {<br>
if ((amdgpu_ip_block_mask & (1 << i)) == 0) {<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
index 4a8c422..5681a41 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
@@ -118,8 +118,8 @@ uint amdgpu_pg_mask = 0xffffffff;<br>
uint amdgpu_sdma_phase_quantum = 32;<br>
char *amdgpu_disable_cu = NULL;<br>
char *amdgpu_virtual_display = NULL;<br>
-/* OverDrive(bit 14),gfxoff(bit 15),stutter mode(bit 17) disabled by default*/<br>
-uint amdgpu_pp_feature_mask = 0xfffd3fff;<br>
+/* OverDrive(bit 14) disabled by default*/<br>
+uint amdgpu_pp_feature_mask = 0xffffbfff;<br>
int amdgpu_ngg = 0;<br>
int amdgpu_prim_buf_per_se = 0;<br>
int amdgpu_pos_buf_per_se = 0;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
index 60c582c..6b48d4c 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
@@ -578,6 +578,26 @@ static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)<br>
}<br>
}<br>
<br>
+static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)<br>
+{<br>
+ switch (adev->asic_type) {<br>
+ case CHIP_VEGA10:<br>
+ case CHIP_VEGA12:<br>
+ case CHIP_VEGA20:<br>
+ break;<br>
+ case CHIP_RAVEN:<br>
+ if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)<br>
+ break;<br>
+ if ((adev->gfx.rlc_fw_version < 531) ||<br>
+ (adev->gfx.rlc_feature_version < 1) ||<br>
+ !adev->gfx.rlc.is_rlc_v2_1)<br>
+ adev->pm.pp_feature &= ~PP_GFXOFF_MASK;<br>
+ break;<br>
+ default:<br>
+ break;<br>
+ }<br>
+}<br>
+<br>
static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)<br>
{<br>
const char *chip_name;<br>
@@ -830,6 +850,7 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)<br>
}<br>
<br>
out:<br>
+ gfx_v9_0_check_if_need_gfxoff(adev);<br>
gfx_v9_0_check_fw_write_wait(adev);<br>
if (err) {<br>
dev_err(adev->dev,<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
index 0ad8fe4..f32e3d0 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
@@ -114,11 +114,6 @@ static int smu10_initialize_dpm_defaults(struct pp_hwmgr *hwmgr)<br>
smu10_data->num_active_display = 0;<br>
smu10_data->deep_sleep_dcefclk = 0;<br>
<br>
- if (hwmgr->feature_mask & PP_GFXOFF_MASK)<br>
- smu10_data->gfx_off_controled_by_driver = true;<br>
- else<br>
- smu10_data->gfx_off_controled_by_driver = false;<br>
-<br>
phm_cap_unset(hwmgr->platform_descriptor.platformCaps,<br>
PHM_PlatformCaps_SclkDeepSleep);<br>
<br>
@@ -330,9 +325,9 @@ static bool smu10_is_gfx_on(struct pp_hwmgr *hwmgr)<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>
+ struct amdgpu_device *adev = hwmgr->adev;<br>
<br>
- if (smu10_data->gfx_off_controled_by_driver) {<br>
+ if (adev->pm.pp_feature & PP_GFXOFF_MASK) {<br>
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_DisableGfxOff);<br>
<br>
/* confirm gfx is back to "on" state */<br>
@@ -350,9 +345,9 @@ static int smu10_disable_dpm_tasks(struct pp_hwmgr *hwmgr)<br>
<br>
static int smu10_enable_gfx_off(struct pp_hwmgr *hwmgr)<br>
{<br>
- struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);<br>
+ struct amdgpu_device *adev = hwmgr->adev;<br>
<br>
- if (smu10_data->gfx_off_controled_by_driver)<br>
+ if (adev->pm.pp_feature & PP_GFXOFF_MASK)<br>
smum_send_msg_to_smc(hwmgr, PPSMC_MSG_EnableGfxOff);<br>
<br>
return 0;<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>