Skip to contentSkip to conversation

drm/amd/powerplay: Add mode2 mode for GPU RESET

PATCH In review chen gong 3 participants 7 messages Sep 23, 2019 – Sep 24, 2019 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

chen gong

author
#0 lore raw

PATCH 1/2 drm/amd/powerplay: Add mode2 mode for GPU RESET

Changes to function "smu_suspend" in amdgpu_smu.c is a workaround.

We should get real information about if baco is enabled or not, while we always consider APU SMU feature as enabled in current code.

I know APU do not support baco mode for GPU reset, so I use "adev->flags" to skip function "smu_feature_is_enabled".

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     | 5 ++++-
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c      | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -1
index 90fa444..e51d727 100644
@@ -1363,7 +1363,10 @@ static int smu_suspend(void *handle)
 	int ret;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct smu_context *smu = &adev->smu;
-	bool baco_feature_is_enabled = smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT);
+	bool baco_feature_is_enabled = false;
+
+	if (!(adev->flags & AMD_IS_APU))
+		baco_feature_is_enabled = smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT);
 
 	ret = smu_system_features_control(smu, false);
 	if (ret)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -0
index 45da21d..35e8b0c 100644
@@ -537,6 +537,7 @@ struct smu_funcs
 	enum smu_baco_state (*baco_get_state)(struct smu_context *smu);
 	int (*baco_set_state)(struct smu_context *smu, enum smu_baco_state state);
 	int (*baco_reset)(struct smu_context *smu);
+    int (*mode2_reset)(struct smu_context *smu);
 	int (*get_dpm_ultimate_freq)(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t *min, uint32_t *max);
 };
 
@@ -760,6 +761,8 @@ struct smu_funcs
 	((smu)->funcs->baco_get_state? (smu)->funcs->baco_get_state((smu), (state)) : 0)
 #define smu_baco_reset(smu) \
 	((smu)->funcs->baco_reset? (smu)->funcs->baco_reset((smu)) : 0)
+#define smu_mode2_reset(smu) \
+    ((smu)->funcs->mode2_reset? (smu)->funcs->mode2_reset((smu)) : 0)
 #define smu_asic_set_performance_level(smu, level) \
 	((smu)->ppt_funcs->set_performance_level? (smu)->ppt_funcs->set_performance_level((smu), (level)) : -EINVAL);
 #define smu_dump_pptable(smu) \
drivers/gpu/drm/amd/powerplay/smu_v12_0.c +6 -0
index 24274c9..f762a98 100644
@@ -30,6 +30,7 @@
 #include "soc15_common.h"
 #include "atom.h"
 #include "renoir_ppt.h"
+#include "hwmgr.h"
 
 #include "asic_reg/mp/mp_12_0_0_offset.h"
 #include "asic_reg/mp/mp_12_0_0_sh_mask.h"
@@ -380,6 +381,10 @@ static int smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk
 	return ret;
 }
 
+static int smu_v12_0_mode2_reset(struct smu_context *smu){
+	return smu_v12_0_send_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset, SMU_ASIC_RESET_MODE_2);
+}
+
 static const struct smu_funcs smu_v12_0_funcs = {
 	.check_fw_status = smu_v12_0_check_fw_status,
 	.check_fw_version = smu_v12_0_check_fw_version,
@@ -394,6 +399,7 @@ static const struct smu_funcs smu_v12_0_funcs = {
 	.fini_smc_tables = smu_v12_0_fini_smc_tables,
 	.populate_smc_tables = smu_v12_0_populate_smc_tables,
 	.get_dpm_ultimate_freq = smu_v12_0_get_dpm_ultimate_freq,
+	.mode2_reset = smu_v12_0_mode2_reset,
 };
 
 void smu_v12_0_set_smu_funcs(struct smu_context *smu)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1569219248-29457-1-git-send-email-curry.gong-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/2 drm/amdgpu: Use mode2 mode to perform GPU RESET for Renoir

---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -0
index 58818761..0f639df9 100644
@@ -514,6 +514,8 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)
 
 static int soc15_mode2_reset(struct amdgpu_device *adev)
 {
+	if (is_support_sw_smu(adev))
+		return smu_mode2_reset(&adev->smu);
 	if (!adev->powerplay.pp_funcs ||
 	    !adev->powerplay.pp_funcs->asic_reset_mode_2)
 		return -ENOENT;
@@ -528,6 +530,7 @@ soc15_asic_reset_method(struct amdgpu_device *adev)
 
 	switch (adev->asic_type) {
 	case CHIP_RAVEN:
+	case CHIP_RENOIR:
 		return AMD_RESET_METHOD_MODE2;
 	case CHIP_VEGA10:
 	case CHIP_VEGA12:
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1569219248-29457-2-git-send-email-curry.gong-5C7GfCeVMHo@public.gmane.org

Reviewed-by Aaron Liu
#4 lore raw

RE: [PATCH 2/2] drm/amdgpu: Use mode2 mode to perform GPU RESET for Renoir

BR,
Aaron Liu

Quoted 40 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of chen gong
Sent: Monday, September 23, 2019 2:14 PM
To: [email protected]
Cc: Gong, Curry <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Use mode2 mode to perform GPU RESET for Renoir

---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +3 -0
index 58818761..0f639df9 100644
@@ -514,6 +514,8 @@ static int soc15_asic_baco_reset(struct
 amdgpu_device *adev)
 
 static int soc15_mode2_reset(struct amdgpu_device *adev)  {
+	if (is_support_sw_smu(adev))
+		return smu_mode2_reset(&adev->smu);
 	if (!adev->powerplay.pp_funcs ||
 	    !adev->powerplay.pp_funcs->asic_reset_mode_2)
 		return -ENOENT;
@@ -528,6 +530,7 @@ soc15_asic_reset_method(struct amdgpu_device
 *adev)
 
 	switch (adev->asic_type) {
 	case CHIP_RAVEN:
+	case CHIP_RENOIR:
 		return AMD_RESET_METHOD_MODE2;
 	case CHIP_VEGA10:

case CHIP_VEGA12:
--
2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Andrey Grodzovsky
#5 lore raw

Re: [PATCH 2/2] drm/amdgpu: Use mode2 mode to perform GPU RESET for Renoir

In reply to a message not in the archive
Quoted 10 lines · chen gong
---
  drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 58818761..0f639df9 100644

drivers/gpu/drm/amd/amdgpu/soc15.c static int soc15_asic_baco_reset(struct amdgpu_device *adev) · line 518

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -0
@@ -514,6 +514,8 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)
 
  static int soc15_mode2_reset(struct amdgpu_device *adev)
  {
+	if (is_support_sw_smu(adev))
+		return smu_mode2_reset(&adev->smu);

Picasso reset is also SMU based so I would unify the code for both resets under smu_mode2_reset and already inside would make the distinction between Picasso(RAVEN) and Renoir. Apart from that the series looks good the me.

Andrey

drivers/gpu/drm/amd/amdgpu/soc15.c soc15_asic_reset_method(struct amdgpu_device *adev) · line 536

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -0
  	if (!adev->powerplay.pp_funcs ||
  	    !adev->powerplay.pp_funcs->asic_reset_mode_2)
  		return -ENOENT;
@@ -528,6 +530,7 @@ soc15_asic_reset_method(struct amdgpu_device *adev)
 
  	switch (adev->asic_type) {
  	case CHIP_RAVEN:
+	case CHIP_RENOIR:
  		return AMD_RESET_METHOD_MODE2;
  	case CHIP_VEGA10:
  	case CHIP_VEGA12:

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw
In reply to a message not in the archive

Hi curry,

1. You can separate the patch into 2 patches, one is workaround in smu_suspend and another is the implementation of mode2_reset.
2. hwmgr.h is used for amdgpu_powerplay instead of amdgpu_smu. You can define it directly in amdgpu_smu.h

BR,
Aaron Liu

Quoted 103 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of chen gong
Sent: Monday, September 23, 2019 2:14 PM
To: [email protected]
Cc: Gong, Curry <[email protected]>
Subject: [PATCH 1/2] drm/amd/powerplay: Add mode2 mode for GPU RESET

Changes to function "smu_suspend" in amdgpu_smu.c is a workaround.

We should get real information about if baco is enabled or not, while we always consider APU SMU feature as enabled in current code.

I know APU do not support baco mode for GPU reset, so I use "adev->flags" to skip function "smu_feature_is_enabled".

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     | 5 ++++-
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c      | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -1
index 90fa444..e51d727 100644
@@ -1363,7 +1363,10 @@ static int smu_suspend(void *handle)
 	int ret;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct smu_context *smu = &adev->smu;
-	bool baco_feature_is_enabled = smu_feature_is_enabled(smu,
 SMU_FEATURE_BACO_BIT);
+	bool baco_feature_is_enabled = false;
+
+	if (!(adev->flags & AMD_IS_APU))
+		baco_feature_is_enabled = smu_feature_is_enabled(smu,
+SMU_FEATURE_BACO_BIT);
 
 	ret = smu_system_features_control(smu, false);
 	if (ret)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -0
index 45da21d..35e8b0c 100644
@@ -537,6 +537,7 @@ struct smu_funcs
 	enum smu_baco_state (*baco_get_state)(struct smu_context *smu);
 	int (*baco_set_state)(struct smu_context *smu, enum
 smu_baco_state state);
 	int (*baco_reset)(struct smu_context *smu);
+    int (*mode2_reset)(struct smu_context *smu);
 	int (*get_dpm_ultimate_freq)(struct smu_context *smu, enum
 smu_clk_type clk_type, uint32_t *min, uint32_t *max);  };
@@ -760,6 +761,8 @@ struct smu_funcs
 	((smu)->funcs->baco_get_state? (smu)->funcs-
 >baco_get_state((smu), (state)) : 0)  #define smu_baco_reset(smu) \
 	((smu)->funcs->baco_reset? (smu)->funcs->baco_reset((smu)) : 0)
+#define smu_mode2_reset(smu) \
+    ((smu)->funcs->mode2_reset? (smu)->funcs->mode2_reset((smu)) : 0)
 #define smu_asic_set_performance_level(smu, level) \
 	((smu)->ppt_funcs->set_performance_level? (smu)->ppt_funcs-
Quoted 1 line

set_performance_level((smu), (level)) : -EINVAL); #define

smu_dump_pptable(smu) \ diff --git
a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
index 24274c9..f762a98 100644

drivers/gpu/drm/amd/powerplay/smu_v12_0.c +1 -0
@@ -30,6 +30,7 @@
 #include "soc15_common.h"
 #include "atom.h"
 #include "renoir_ppt.h"
+#include "hwmgr.h"
 
 #include "asic_reg/mp/mp_12_0_0_offset.h"
 #include "asic_reg/mp/mp_12_0_0_sh_mask.h"
@@ -380,6 +381,10 @@ static int

smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk

drivers/gpu/drm/amd/powerplay/smu_v12_0.c +6 -1
 	return ret;
 }
 
+static int smu_v12_0_mode2_reset(struct smu_context *smu){
+	return smu_v12_0_send_msg_with_param(smu,
+SMU_MSG_GfxDeviceDriverReset, SMU_ASIC_RESET_MODE_2); }
+
 static const struct smu_funcs smu_v12_0_funcs = {
 	.check_fw_status = smu_v12_0_check_fw_status,
 	.check_fw_version = smu_v12_0_check_fw_version, @@ -394,6
+399,7 @@ static const struct smu_funcs smu_v12_0_funcs = {
 	.fini_smc_tables = smu_v12_0_fini_smc_tables,
 	.populate_smc_tables = smu_v12_0_populate_smc_tables,
 	.get_dpm_ultimate_freq = smu_v12_0_get_dpm_ultimate_freq,
+	.mode2_reset = smu_v12_0_mode2_reset,
 };
 
 void smu_v12_0_set_smu_funcs(struct smu_context *smu)
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB38382005F9B205E969D0A981F0850-rweVpJHSKTrcE+Ck/[email protected]

#8 lore raw

Hi Aaron:

Help to review again.

-----Original Message-----
From: Liu, Aaron <[email protected]>
Sent: Monday, September 23, 2019 2:41 PM
To: Gong, Curry <[email protected]>; [email protected]
Cc: Gong, Curry <[email protected]>
Subject: RE: [PATCH 1/2] drm/amd/powerplay: Add mode2 mode for GPU RESET

Hi curry,

1. You can separate the patch into 2 patches, one is workaround in smu_suspend and another is the implementation of mode2_reset.
2. hwmgr.h is used for amdgpu_powerplay instead of amdgpu_smu. You can define it directly in amdgpu_smu.h

BR,
Aaron Liu

Quoted 102 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of chen gong
Sent: Monday, September 23, 2019 2:14 PM
To: [email protected]
Cc: Gong, Curry <[email protected]>
Subject: [PATCH 1/2] drm/amd/powerplay: Add mode2 mode for GPU RESET

Changes to function "smu_suspend" in amdgpu_smu.c is a workaround.

We should get real information about if baco is enabled or not, while we always consider APU SMU feature as enabled in current code.

I know APU do not support baco mode for GPU reset, so I use "adev->flags" to skip function "smu_feature_is_enabled".

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     | 5 ++++-
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c      | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -1
index 90fa444..e51d727 100644
@@ -1363,7 +1363,10 @@ static int smu_suspend(void *handle)
 	int ret;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct smu_context *smu = &adev->smu;
-	bool baco_feature_is_enabled = smu_feature_is_enabled(smu,
 SMU_FEATURE_BACO_BIT);
+	bool baco_feature_is_enabled = false;
+
+	if (!(adev->flags & AMD_IS_APU))
+		baco_feature_is_enabled = smu_feature_is_enabled(smu, 
+SMU_FEATURE_BACO_BIT);
 
 	ret = smu_system_features_control(smu, false);
 	if (ret)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -0
index 45da21d..35e8b0c 100644
@@ -537,6 +537,7 @@ struct smu_funcs
 	enum smu_baco_state (*baco_get_state)(struct smu_context *smu);
 	int (*baco_set_state)(struct smu_context *smu, enum smu_baco_state 
 state);
 	int (*baco_reset)(struct smu_context *smu);
+    int (*mode2_reset)(struct smu_context *smu);
 	int (*get_dpm_ultimate_freq)(struct smu_context *smu, enum 
 smu_clk_type clk_type, uint32_t *min, uint32_t *max);  };
@@ -760,6 +761,8 @@ struct smu_funcs
 	((smu)->funcs->baco_get_state? (smu)->funcs-
 >baco_get_state((smu), (state)) : 0)  #define smu_baco_reset(smu) \
 	((smu)->funcs->baco_reset? (smu)->funcs->baco_reset((smu)) : 0)
+#define smu_mode2_reset(smu) \
+    ((smu)->funcs->mode2_reset? (smu)->funcs->mode2_reset((smu)) : 0)
 #define smu_asic_set_performance_level(smu, level) \
 	((smu)->ppt_funcs->set_performance_level? (smu)->ppt_funcs-
Quoted 1 line

set_performance_level((smu), (level)) : -EINVAL); #define

smu_dump_pptable(smu) \ diff --git
a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
index 24274c9..f762a98 100644

drivers/gpu/drm/amd/powerplay/smu_v12_0.c +1 -0
@@ -30,6 +30,7 @@
 #include "soc15_common.h"
 #include "atom.h"
 #include "renoir_ppt.h"
+#include "hwmgr.h"
 
 #include "asic_reg/mp/mp_12_0_0_offset.h"
 #include "asic_reg/mp/mp_12_0_0_sh_mask.h"
@@ -380,6 +381,10 @@ static int

smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk

drivers/gpu/drm/amd/powerplay/smu_v12_0.c +6 -1
 	return ret;
 }
 
+static int smu_v12_0_mode2_reset(struct smu_context *smu){
+	return smu_v12_0_send_msg_with_param(smu,
+SMU_MSG_GfxDeviceDriverReset, SMU_ASIC_RESET_MODE_2); }
+
 static const struct smu_funcs smu_v12_0_funcs = {
 	.check_fw_status = smu_v12_0_check_fw_status,
 	.check_fw_version = smu_v12_0_check_fw_version, @@ -394,6
+399,7 @@ static const struct smu_funcs smu_v12_0_funcs = {
 	.fini_smc_tables = smu_v12_0_fini_smc_tables,
 	.populate_smc_tables = smu_v12_0_populate_smc_tables,
 	.get_dpm_ultimate_freq = smu_v12_0_get_dpm_ultimate_freq,
+	.mode2_reset = smu_v12_0_mode2_reset,
 };
 
 void smu_v12_0_set_smu_funcs(struct smu_context *smu)
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

From 48748087792b500f43756f4325e87c3dc5891ef4 Mon Sep 17 00:00:00 2001
From: chen gong <[email protected]>
Date: Mon, 23 Sep 2019 14:56:43 +0800
Subject: [PATCH 1/3] drm/amd/powerplay: Add mode2 mode for GPU RESET in SMU

Renoir need to use mode2 mode to implement GPU RESET

---
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 10 ++++++++++
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c      |  4 ++++
 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +10 -0
index 45da21d..149de92 100644
@@ -321,6 +321,13 @@ struct mclock_latency_table {
 	struct mclk_latency_entries  entries[MAX_REGULAR_DPM_NUM];
 };
 
+enum smu_reset_mode
+{
+    SMU_RESET_MODE_0,
+    SMU_RESET_MODE_1,
+    SMU_RESET_MODE_2,
+};
+
 enum smu_baco_state
 {
 	SMU_BACO_STATE_ENTER = 0,
@@ -537,6 +544,7 @@ struct smu_funcs
 	enum smu_baco_state (*baco_get_state)(struct smu_context *smu);
 	int (*baco_set_state)(struct smu_context *smu, enum smu_baco_state state);
 	int (*baco_reset)(struct smu_context *smu);
+	int (*mode2_reset)(struct smu_context *smu);
 	int (*get_dpm_ultimate_freq)(struct smu_context *smu, enum smu_clk_type clk_type, uint32_t *min, uint32_t *max);
 };
 
@@ -760,6 +768,8 @@ struct smu_funcs
 	((smu)->funcs->baco_get_state? (smu)->funcs->baco_get_state((smu), (state)) : 0)
 #define smu_baco_reset(smu) \
 	((smu)->funcs->baco_reset? (smu)->funcs->baco_reset((smu)) : 0)
+#define smu_mode2_reset(smu) \
+	((smu)->funcs->mode2_reset? (smu)->funcs->mode2_reset((smu)) : 0)
 #define smu_asic_set_performance_level(smu, level) \
 	((smu)->ppt_funcs->set_performance_level? (smu)->ppt_funcs->set_performance_level((smu), (level)) : -EINVAL);
 #define smu_dump_pptable(smu) \
drivers/gpu/drm/amd/powerplay/smu_v12_0.c +4 -0
index 24274c9..d9d9473 100644
@@ -380,6 +380,9 @@ static int smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk
 	return ret;
 }
 
+static int smu_v12_0_mode2_reset(struct smu_context *smu){
+	return smu_v12_0_send_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset, SMU_RESET_MODE_2);
+}
 static const struct smu_funcs smu_v12_0_funcs = {
 	.check_fw_status = smu_v12_0_check_fw_status,
 	.check_fw_version = smu_v12_0_check_fw_version,
@@ -394,6 +397,7 @@ static const struct smu_funcs smu_v12_0_funcs = {
 	.fini_smc_tables = smu_v12_0_fini_smc_tables,
 	.populate_smc_tables = smu_v12_0_populate_smc_tables,
 	.get_dpm_ultimate_freq = smu_v12_0_get_dpm_ultimate_freq,
+	.mode2_reset = smu_v12_0_mode2_reset,
 };
 
 void smu_v12_0_set_smu_funcs(struct smu_context *smu)
Signature · 1 line
2.7.4

From f6ea2e5e407320d9432c604bd36e22417c537f2a Mon Sep 17 00:00:00 2001
From: chen gong <[email protected]>
Date: Mon, 23 Sep 2019 15:02:56 +0800
Subject: [PATCH 2/3] drm/amd/powerplay: A workaround to GPU RESET on APU

Changes to function "smu_suspend" in amdgpu_smu.c is a workaround.

We should get real information about if baco is enabled or not, while we always consider APU SMU feature as enabled in current code.

I know APU do not support baco mode for GPU reset, so I use "adev->flags" to skip function "smu_feature_is_enabled".

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -1
index bc11dff..7f41788 100644
@@ -1360,7 +1360,10 @@ static int smu_suspend(void *handle)
 	int ret;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct smu_context *smu = &adev->smu;
-	bool baco_feature_is_enabled = smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT);
+	bool baco_feature_is_enabled = false;
+
+	if(!(adev->flags & AMD_IS_APU))
+		baco_feature_is_enabled = smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT);
 
 	ret = smu_system_features_control(smu, false);
 	if (ret)
Signature · 1 line
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3069A6A31316BDC367E752429D840-rweVpJHSKTpIs82n4wpHmwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by Aaron Liu
#10 lore raw

BR,
Aaron Liu

Quoted 131 lines

-----Original Message-----
From: Gong, Curry <[email protected]>
Sent: Tuesday, September 24, 2019 10:27 AM
To: Liu, Aaron <[email protected]>; [email protected]
Subject: RE: [PATCH 1/2] drm/amd/powerplay: Add mode2 mode for GPU RESET

Hi Aaron:

Help to review again.

-----Original Message-----
From: Liu, Aaron <[email protected]>
Sent: Monday, September 23, 2019 2:41 PM
To: Gong, Curry <[email protected]>; [email protected]
Cc: Gong, Curry <[email protected]>
Subject: RE: [PATCH 1/2] drm/amd/powerplay: Add mode2 mode for GPU RESET

Hi curry,

1. You can separate the patch into 2 patches, one is workaround in smu_suspend and another is the implementation of mode2_reset.
2. hwmgr.h is used for amdgpu_powerplay instead of amdgpu_smu. You can define it directly in amdgpu_smu.h

BR,
Aaron Liu

Quoted 7 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of chen gong
Sent: Monday, September 23, 2019 2:14 PM
To: [email protected]
Cc: Gong, Curry <[email protected]>
Subject: [PATCH 1/2] drm/amd/powerplay: Add mode2 mode for GPU

RESET

Quoted 42 lines

Changes to function "smu_suspend" in amdgpu_smu.c is a workaround.

We should get real information about if baco is enabled or not, while we always consider APU SMU feature as enabled in current code.

I know APU do not support baco mode for GPU reset, so I use "adev- flags"
to skip function "smu_feature_is_enabled".

---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     | 5 ++++-
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c      | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 -1
index 90fa444..e51d727 100644
@@ -1363,7 +1363,10 @@ static int smu_suspend(void *handle)
 	int ret;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct smu_context *smu = &adev->smu;
-	bool baco_feature_is_enabled = smu_feature_is_enabled(smu,
 SMU_FEATURE_BACO_BIT);
+	bool baco_feature_is_enabled = false;
+
+	if (!(adev->flags & AMD_IS_APU))
+		baco_feature_is_enabled = smu_feature_is_enabled(smu,
+SMU_FEATURE_BACO_BIT);
 
 	ret = smu_system_features_control(smu, false);
 	if (ret)
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
index 45da21d..35e8b0c 100644

drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h struct smu_funcs · line 538

Quoted 2 lines
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -0
@@ -537,6 +537,7 @@ struct smu_funcs
 	enum smu_baco_state (*baco_get_state)(struct smu_context *smu);
 	int (*baco_set_state)(struct smu_context *smu, enum

smu_baco_state

Quoted 30 lines
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +3 -0
 state);
 	int (*baco_reset)(struct smu_context *smu);
+    int (*mode2_reset)(struct smu_context *smu);
 	int (*get_dpm_ultimate_freq)(struct smu_context *smu, enum
 smu_clk_type clk_type, uint32_t *min, uint32_t *max);  };
@@ -760,6 +761,8 @@ struct smu_funcs
 	((smu)->funcs->baco_get_state? (smu)->funcs-
 >baco_get_state((smu), (state)) : 0)  #define smu_baco_reset(smu) \
 	((smu)->funcs->baco_reset? (smu)->funcs->baco_reset((smu)) : 0)
+#define smu_mode2_reset(smu) \
+    ((smu)->funcs->mode2_reset? (smu)->funcs->mode2_reset((smu)) : 0)
 #define smu_asic_set_performance_level(smu, level) \
 	((smu)->ppt_funcs->set_performance_level? (smu)->ppt_funcs-
Quoted 1 line

set_performance_level((smu), (level)) : -EINVAL); #define

smu_dump_pptable(smu) \ diff --git
a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
index 24274c9..f762a98 100644

drivers/gpu/drm/amd/powerplay/smu_v12_0.c +1 -0
@@ -30,6 +30,7 @@
 #include "soc15_common.h"
 #include "atom.h"
 #include "renoir_ppt.h"
+#include "hwmgr.h"
 
 #include "asic_reg/mp/mp_12_0_0_offset.h"
 #include "asic_reg/mp/mp_12_0_0_sh_mask.h"
@@ -380,6 +381,10 @@ static int
Quoted 1 line

smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum

smu_clk

Quoted 17 lines
drivers/gpu/drm/amd/powerplay/smu_v12_0.c +6 -0
 	return ret;
 }
 
+static int smu_v12_0_mode2_reset(struct smu_context *smu){
+	return smu_v12_0_send_msg_with_param(smu,
+SMU_MSG_GfxDeviceDriverReset, SMU_ASIC_RESET_MODE_2); }
+
 static const struct smu_funcs smu_v12_0_funcs = {
 	.check_fw_status = smu_v12_0_check_fw_status,
 	.check_fw_version = smu_v12_0_check_fw_version, @@ -394,6
+399,7 @@ static const struct smu_funcs smu_v12_0_funcs = {
 	.fini_smc_tables = smu_v12_0_fini_smc_tables,
 	.populate_smc_tables = smu_v12_0_populate_smc_tables,
 	.get_dpm_ultimate_freq = smu_v12_0_get_dpm_ultimate_freq,
+	.mode2_reset = smu_v12_0_mode2_reset,
 };
Quoted 8 lines
Quoted 8 lines

void smu_v12_0_set_smu_funcs(struct smu_context *smu)
--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx