Skip to contentSkip to conversation

Add mode 2 GPU reset for RV2/Picasso

PATCH Superseded Andrey Grodzovsky 2 participants 7 messages Aug 14, 2019 4 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add mode 2 GPU reset for RV2/Picasso

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

Andrey Grodzovsky (3):
drm/amd/powerplay: Fix meaning of 0x1E PPSMC_MSG drm/amd/powerplay: Add support for mode2 ASIC reset. 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                | 21 +++++++++++++--------
 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, 53 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): 1565812414-26117-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/3 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

A message that is not in the archive (sent off-list or not yet received): 1565812414-26117-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 1/3] drm/amd/powerplay: Fix meaning of 0x1E PPSMC_MSG

Quoted 4 lines · Andrey Grodzovsky

By comparing to windows it means ASIC reset.

Quoted 20 lines
---
 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 -2
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
--

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

#5 lore raw

PATCH 2/3 drm/amd/powerplay: Add support for mode2 ASIC reset.

In reply to a message not in the archive

Mode 2 GPU reset should be done by sending message to SMU.

---
 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 +++++++++
 4 files changed, 38 insertions(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
index bba1291..9c477b4 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_mod_2)(void *handle);
 };
 
 #endif
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +21 -0
index 2e3d9ef6..becca76 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_ASCI_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_mod_2 = pp_asic_reset_mode_2,
 };
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)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +9 -0
index 07fd64a..d583568 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_ASCI_RESET_MODE_0,
+    SMU_ASCI_RESET_MODE_1,
+    SMU_ASCI_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

A message that is not in the archive (sent off-list or not yet received): 1565812414-26117-3-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#7 lore raw

Re: [PATCH 2/3] drm/amd/powerplay: Add support for mode2 ASIC reset.

Quoted 4 lines · Andrey Grodzovsky

Mode 2 GPU reset should be done by sending message to SMU.

I think this should be 3 patches:
1. add the pp_smumgr_func callback
2. add the smu10 implementation
3. add the amd_pm_funcs implementation

Also a couple of typos below.

Quoted 12 lines
---
 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 +++++++++
 4 files changed, 38 insertions(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -0
index bba1291..9c477b4 100644

drivers/gpu/drm/amd/include/kgd_pp_interface.h struct amd_pm_funcs { · line 313

Quoted 4 lines
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -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_mod_2)(void *handle);

typo: mod -> mode

Quoted 70 lines
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -0
 };
 
 #endif
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +21 -0
index 2e3d9ef6..becca76 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_ASCI_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_mod_2 = pp_asic_reset_mode_2,
 };
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)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0 -0
index 07fd64a..d583568 100644

drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct phm_vce_clock_voltage_dependency_table { · line 197

Quoted 9 lines
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +6 -0
@@ -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_ASCI_RESET_MODE_0,
+    SMU_ASCI_RESET_MODE_1,
+    SMU_ASCI_RESET_MODE_2,

typo: ASCI -> ASIC

Quoted 16 lines
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +3 -1
+};
+
 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 {
--

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

#8 lore raw

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

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  1 +
 drivers/gpu/drm/amd/amdgpu/soc15.c         | 21 +++++++++++++--------
 2 files changed, 14 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 +13 -8
index c2d324d..7a9b89d 100644
@@ -508,6 +508,11 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)
 	return 0;
 }
 
+static int soc15_mode2_reset(struct amdgpu_device *adev)
+{
+	return adev->powerplay.pp_funcs->asic_reset_mod_2(adev->powerplay.pp_handle);
+}
+
 static enum amd_reset_method
 soc15_asic_reset_method(struct amdgpu_device *adev)
 {
@@ -546,14 +551,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): 1565812414-26117-4-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org

#10 lore raw

Re: [PATCH 3/3] drm/amdgpu: Use new mode2 reset interface for RV.

Quoted 24 lines · Andrey Grodzovsky
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  1 +
 drivers/gpu/drm/amd/amdgpu/soc15.c         | 21 +++++++++++++--------
 2 files changed, 14 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 +0 -0
index c2d324d..7a9b89d 100644

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

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -0
@@ -508,6 +508,11 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)
        return 0;
 }
 
+static int soc15_mode2_reset(struct amdgpu_device *adev)
+{

Please check the ppfuncs pointers here similar to soc15_asic_baco_reset()

Alex

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +11 -9
+       return adev->powerplay.pp_funcs->asic_reset_mod_2(adev->powerplay.pp_handle);
+}
+
 static enum amd_reset_method
 soc15_asic_reset_method(struct amdgpu_device *adev)
 {
@@ -546,14 +551,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,
--

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