Skip to contentSkip to conversation

Add mode 2 GPU reset for RV2/Picasso

PATCH In review Andrey Grodzovsky 3 participants 8 messages Aug 14, 2019 – Aug 15, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Add mode 2 GPU reset for RV2/Picasso

This patchset adds mode 2 reset through SMU for RV2 and Picasso.

v2:
Split into more patches per functional unit.
Add some NULL checks and fix typos.

Andrey Grodzovsky (5):
drm/amd/powerplay: Fix meaning of 0x1E PPSMC_MSG drm/amd/powerplay: add mode2 reset callback for pp_smu_mgr drm/amd/powerpay: Implement mode2 reset callback for SMU10 drm/amd/poweplay: Add amd_pm_funcs callback for mode 2 drm/amdgpu: Use new mode2 reset interface for RV.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        |  1 +
 drivers/gpu/drm/amd/amdgpu/soc15.c                | 25 +++++++++++++++--------
 drivers/gpu/drm/amd/include/kgd_pp_interface.h    |  1 +
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     | 21 +++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  7 +++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  9 ++++++++
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      |  2 +-
 7 files changed, 57 insertions(+), 9 deletions(-)
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): 1565815217-9533-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH v2 1/5 drm/amd/powerplay: Fix meaning of 0x1E PPSMC_MSG

By comparing to windows it means ASIC reset.

---
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h +1 -1
index 90879e4..df4677d 100644
@@ -59,7 +59,7 @@
 #define PPSMC_MSG_SetDriverDramAddrLow          0x1B
 #define PPSMC_MSG_TransferTableSmu2Dram         0x1C
 #define PPSMC_MSG_TransferTableDram2Smu         0x1D
-#define PPSMC_MSG_ControlGfxRM                  0x1E
+#define PPSMC_MSG_DeviceDriverReset             0x1E
 #define PPSMC_MSG_SetGfxclkOverdriveByFreqVid   0x1F
 #define PPSMC_MSG_SetHardMinDcefclkByFreq       0x20
 #define PPSMC_MSG_SetHardMinSocclkByFreq        0x21
Signature · 6 lines
2.7.4

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

PATCH v2 2/5 drm/amd/powerplay: add mode2 reset callback for pp_smu_mgr

In reply to a message not in the archive

Also define reset modes (0, 1 and 2)

---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +9 -0
index 07fd64a..abeff15 100644
@@ -189,6 +189,14 @@ struct phm_vce_clock_voltage_dependency_table {
 	struct phm_vce_clock_voltage_dependency_record entries[1];
 };
 
+
+enum SMU_ASIC_RESET_MODE
+{
+    SMU_ASIC_RESET_MODE_0,
+    SMU_ASIC_RESET_MODE_1,
+    SMU_ASIC_RESET_MODE_2,
+};
+
 struct pp_smumgr_func {
 	char *name;
 	int (*smu_init)(struct pp_hwmgr  *hwmgr);
@@ -345,6 +353,7 @@ struct pp_hwmgr_func {
 	int (*get_ppfeature_status)(struct pp_hwmgr *hwmgr, char *buf);
 	int (*set_ppfeature_status)(struct pp_hwmgr *hwmgr, uint64_t ppfeature_masks);
 	int (*set_mp1_state)(struct pp_hwmgr *hwmgr, enum pp_mp1_state mp1_state);
+	int (*asic_reset)(struct pp_hwmgr *hwmgr, enum SMU_ASIC_RESET_MODE mode);
 };
 
 struct pp_table_func {
Signature · 6 lines
2.7.4

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

PATCH v2 3/5 drm/amd/powerpay: Implement mode2 reset callback for SMU10

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +7 -0
index 18e780f..1115761 100644
@@ -1311,6 +1311,12 @@ static int smu10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uin
 	return 0;
 }
 
+static int smu10_asic_reset(struct pp_hwmgr *hwmgr, enum SMU_ASIC_RESET_MODE mode)
+{
+	return smum_send_msg_to_smc_with_parameter(hwmgr,
+						   PPSMC_MSG_DeviceDriverReset,
+						   mode);
+}
 
 static const struct pp_hwmgr_func smu10_hwmgr_funcs = {
 	.backend_init = smu10_hwmgr_backend_init,
@@ -1355,6 +1361,7 @@ static const struct pp_hwmgr_func smu10_hwmgr_funcs = {
 	.set_hard_min_fclk_by_freq = smu10_set_hard_min_fclk_by_freq,
 	.get_power_profile_mode = smu10_get_power_profile_mode,
 	.set_power_profile_mode = smu10_set_power_profile_mode,
+	.asic_reset = smu10_asic_reset,
 };
 
 int smu10_init_function_pointers(struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.7.4

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

PATCH v2 4/5 drm/amd/poweplay: Add amd_pm_funcs callback for mode 2

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h |  1 +
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c  | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
index bba1291..0de4e37 100644
@@ -310,6 +310,7 @@ struct amd_pm_funcs {
 	int (*set_asic_baco_state)(void *handle, int state);
 	int (*get_ppfeature_status)(void *handle, char *buf);
 	int (*set_ppfeature_status)(void *handle, uint64_t ppfeature_masks);
+	int (*asic_reset_mode_2)(void *handle);
 };
 
 #endif
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +21 -0
index 2e3d9ef6..7ef2027 100644
@@ -1508,6 +1508,26 @@ static int pp_set_ppfeature_status(void *handle, uint64_t ppfeature_masks)
 	return ret;
 }
 
+static int pp_asic_reset_mode_2(void *handle)
+{
+	struct pp_hwmgr *hwmgr = handle;
+		int ret = 0;
+
+	if (!hwmgr || !hwmgr->pm_en)
+		return -EINVAL;
+
+	if (hwmgr->hwmgr_func->asic_reset == NULL) {
+		pr_info_ratelimited("%s was not implemented.\n", __func__);
+		return -EINVAL;
+	}
+
+	mutex_lock(&hwmgr->smu_lock);
+	ret = hwmgr->hwmgr_func->asic_reset(hwmgr, SMU_ASIC_RESET_MODE_2);
+	mutex_unlock(&hwmgr->smu_lock);
+
+	return ret;
+}
+
 static const struct amd_pm_funcs pp_dpm_funcs = {
 	.load_firmware = pp_dpm_load_fw,
 	.wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
@@ -1564,4 +1584,5 @@ static const struct amd_pm_funcs pp_dpm_funcs = {
 	.set_asic_baco_state = pp_set_asic_baco_state,
 	.get_ppfeature_status = pp_get_ppfeature_status,
 	.set_ppfeature_status = pp_set_ppfeature_status,
+	.asic_reset_mode_2 = pp_asic_reset_mode_2,
 };
Signature · 6 lines
2.7.4

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

PATCH v2 5/5 drm/amdgpu: Use new mode2 reset interface for RV.

In reply to a message not in the archive

v2:
Check ppfuncs pointer for NULL

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  1 +
 drivers/gpu/drm/amd/amdgpu/soc15.c         | 25 +++++++++++++++++--------
 2 files changed, 18 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 2752773..02b3e7d 100644
@@ -3524,6 +3524,7 @@ bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev)
 		case CHIP_VEGA20:
 		case CHIP_VEGA10:
 		case CHIP_VEGA12:
+		case CHIP_RAVEN:
 			break;
 		default:
 			goto disabled;
drivers/gpu/drm/amd/amdgpu/soc15.c +17 -8
index c2d324d..77e6799 100644
@@ -508,6 +508,15 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)
 	return 0;
 }
 
+static int soc15_mode2_reset(struct amdgpu_device *adev)
+{
+	if (!adev->powerplay.pp_funcs ||
+	    !adev->powerplay.pp_funcs->asic_reset_mode_2)
+		return -ENOENT;
+
+	return adev->powerplay.pp_funcs->asic_reset_mode_2(adev->powerplay.pp_handle);
+}
+
 static enum amd_reset_method
 soc15_asic_reset_method(struct amdgpu_device *adev)
 {
@@ -546,14 +555,14 @@ soc15_asic_reset_method(struct amdgpu_device *adev)
 
 static int soc15_asic_reset(struct amdgpu_device *adev)
 {
-	int ret;
-
-	if (soc15_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)
-		ret = soc15_asic_baco_reset(adev);
-	else
-		ret = soc15_asic_mode1_reset(adev);
-
-	return ret;
+	switch (soc15_asic_reset_method(adev)) {
+		case AMD_RESET_METHOD_BACO:
+			return soc15_asic_baco_reset(adev);
+		case AMD_RESET_METHOD_MODE2:
+			return soc15_mode2_reset(adev);
+		default:
+			return soc15_asic_mode1_reset(adev);
+	}
 }
 
 /*static int soc15_set_uvd_clock(struct amdgpu_device *adev, u32 clock,
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): 1565815217-9533-6-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#8 lore raw

RE: [PATCH v2 5/5] drm/amdgpu: Use new mode2 reset interface for RV.

Series is Reviewed-by: Evan Quan <[email protected]>

Quoted 81 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Andrey Grodzovsky
Sent: Thursday, August 15, 2019 4:40 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>; Quan, Evan <[email protected]>; S, Shirish <[email protected]>
Subject: [PATCH v2 5/5] drm/amdgpu: Use new mode2 reset interface for RV.

v2:
Check ppfuncs pointer for NULL

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  1 +
 drivers/gpu/drm/amd/amdgpu/soc15.c         | 25 +++++++++++++++++-------
(quoted diff) +0 -1
-
 2 files changed, 18 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 2752773..02b3e7d 100644
@@ -3524,6 +3524,7 @@ bool amdgpu_device_should_recover_gpu(struct
 amdgpu_device *adev)
 		case CHIP_VEGA20:
 		case CHIP_VEGA10:
 		case CHIP_VEGA12:
+		case CHIP_RAVEN:
 			break;
 		default:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 			goto disabled;
drivers/gpu/drm/amd/amdgpu/soc15.c +9 -0
index c2d324d..77e6799 100644
@@ -508,6 +508,15 @@ static int soc15_asic_baco_reset(struct
 amdgpu_device *adev)
 	return 0;
 }
 
+static int soc15_mode2_reset(struct amdgpu_device *adev) {
+	if (!adev->powerplay.pp_funcs ||
+	    !adev->powerplay.pp_funcs->asic_reset_mode_2)
+		return -ENOENT;
+
+	return
+adev->powerplay.pp_funcs->asic_reset_mode_2(adev-
 >powerplay.pp_handle);
+}
+
 static enum amd_reset_method

soc15_asic_reset_method(struct amdgpu_device *adev) { @@ -546,14
+555,14 @@ soc15_asic_reset_method(struct amdgpu_device *adev)

static int soc15_asic_reset(struct amdgpu_device *adev) {

drivers/gpu/drm/amd/amdgpu/soc15.c +8 -9
-	int ret;
-
-	if (soc15_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)
-		ret = soc15_asic_baco_reset(adev);
-	else
-		ret = soc15_asic_mode1_reset(adev);
-
-	return ret;
+	switch (soc15_asic_reset_method(adev)) {
+		case AMD_RESET_METHOD_BACO:
+			return soc15_asic_baco_reset(adev);
+		case AMD_RESET_METHOD_MODE2:
+			return soc15_mode2_reset(adev);
+		default:
+			return soc15_asic_mode1_reset(adev);
+	}
 }
 
 /*static int soc15_set_uvd_clock(struct amdgpu_device *adev, u32 clock,
--

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
#9 lore raw
In reply to a message not in the archive

Please add patch descriptions for patches 3, 4, 5. With that fixed, series is:

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Andrey Grodzovsky <[email protected]>
Sent: Wednesday, August 14, 2019 4:40 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Grodzovsky, Andrey <[email protected]>; Quan, Evan <[email protected]>; S, Shirish <[email protected]>
Subject: [PATCH v2 0/5] Add mode 2 GPU reset for RV2/Picasso

This patchset adds mode 2 reset through SMU for RV2 and Picasso.

v2:
Split into more patches per functional unit.
Add some NULL checks and fix typos.

Andrey Grodzovsky (5):
drm/amd/powerplay: Fix meaning of 0x1E PPSMC_MSG drm/amd/powerplay: add mode2 reset callback for pp_smu_mgr drm/amd/powerpay: Implement mode2 reset callback for SMU10 drm/amd/poweplay: Add amd_pm_funcs callback for mode 2 drm/amdgpu: Use new mode2 reset interface for RV.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        |  1 +
 drivers/gpu/drm/amd/amdgpu/soc15.c                | 25 +++++++++++++++--------
 drivers/gpu/drm/amd/include/kgd_pp_interface.h    |  1 +
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     | 21 +++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  7 +++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  9 ++++++++
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      |  2 +-
 7 files changed, 57 insertions(+), 9 deletions(-)

--
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