All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/12] drm/amdgpu: add an asic callback to determine the reset method
@ 2019-07-25 16:57 Alex Deucher
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher, Evan Quan

Sometimes the driver may have to behave differently depending
on the method we are using to reset the GPU.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index b306025cdbc7..e661417ba9dd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -532,6 +532,14 @@ struct amdgpu_allowed_register_entry {
 	bool grbm_indexed;
 };
 
+enum amd_reset_method {
+	AMD_RESET_METHOD_LEGACY = 0,
+	AMD_RESET_METHOD_MODE0,
+	AMD_RESET_METHOD_MODE1,
+	AMD_RESET_METHOD_MODE2,
+	AMD_RESET_METHOD_BACO
+};
+
 /*
  * ASIC specific functions.
  */
@@ -543,6 +551,7 @@ struct amdgpu_asic_funcs {
 			     u32 sh_num, u32 reg_offset, u32 *value);
 	void (*set_vga_state)(struct amdgpu_device *adev, bool state);
 	int (*reset)(struct amdgpu_device *adev);
+	enum amd_reset_method (*reset_method)(struct amdgpu_device *adev);
 	/* get the reference clock */
 	u32 (*get_xclk)(struct amdgpu_device *adev);
 	/* MM block clocks */
@@ -1112,6 +1121,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);
  */
 #define amdgpu_asic_set_vga_state(adev, state) (adev)->asic_funcs->set_vga_state((adev), (state))
 #define amdgpu_asic_reset(adev) (adev)->asic_funcs->reset((adev))
+#define amdgpu_asic_reset_method(adev) (adev)->asic_funcs->reset_method((adev))
 #define amdgpu_asic_get_xclk(adev) (adev)->asic_funcs->get_xclk((adev))
 #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d))
 #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec))
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/12] drm/amdgpu: add reset_method asic callback for si
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 03/12] drm/amdgpu: add reset_method asic callback for cik Alex Deucher
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher, Evan Quan

SI always uses the legacy pci based reset.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/si.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c
index 4b1e0c16ac41..904361451650 100644
--- a/drivers/gpu/drm/amd/amdgpu/si.c
+++ b/drivers/gpu/drm/amd/amdgpu/si.c
@@ -1185,6 +1185,12 @@ static int si_asic_reset(struct amdgpu_device *adev)
 	return 0;
 }
 
+static enum amd_reset_method
+si_asic_reset_method(struct amdgpu_device *adev)
+{
+	return AMD_RESET_METHOD_LEGACY;
+}
+
 static u32 si_get_config_memsize(struct amdgpu_device *adev)
 {
 	return RREG32(mmCONFIG_MEMSIZE);
@@ -1393,6 +1399,7 @@ static const struct amdgpu_asic_funcs si_asic_funcs =
 	.read_bios_from_rom = &si_read_bios_from_rom,
 	.read_register = &si_read_register,
 	.reset = &si_asic_reset,
+	.reset_method = &si_asic_reset_method,
 	.set_vga_state = &si_vga_set_state,
 	.get_xclk = &si_get_xclk,
 	.set_uvd_clocks = &si_set_uvd_clocks,
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/12] drm/amdgpu: add reset_method asic callback for cik
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  2019-07-25 16:57   ` [PATCH 02/12] drm/amdgpu: add reset_method asic callback for si Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 04/12] drm/amdgpu: add reset_method asic callback for vi Alex Deucher
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher, Evan Quan

CIK always uses the legacy pci based reset.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/cik.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index 3a4f20766a39..7b63d7a8298a 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -1290,6 +1290,12 @@ static int cik_asic_reset(struct amdgpu_device *adev)
 	return r;
 }
 
+static enum amd_reset_method
+cik_asic_reset_method(struct amdgpu_device *adev)
+{
+	return AMD_RESET_METHOD_LEGACY;
+}
+
 static u32 cik_get_config_memsize(struct amdgpu_device *adev)
 {
 	return RREG32(mmCONFIG_MEMSIZE);
@@ -1822,6 +1828,7 @@ static const struct amdgpu_asic_funcs cik_asic_funcs =
 	.read_bios_from_rom = &cik_read_bios_from_rom,
 	.read_register = &cik_read_register,
 	.reset = &cik_asic_reset,
+	.reset_method = &cik_asic_reset_method,
 	.set_vga_state = &cik_vga_set_state,
 	.get_xclk = &cik_get_xclk,
 	.set_uvd_clocks = &cik_set_uvd_clocks,
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/12] drm/amdgpu: add reset_method asic callback for vi
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  2019-07-25 16:57   ` [PATCH 02/12] drm/amdgpu: add reset_method asic callback for si Alex Deucher
  2019-07-25 16:57   ` [PATCH 03/12] drm/amdgpu: add reset_method asic callback for cik Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 05/12] drm/amdgpu: add reset_method asic callback for soc15 Alex Deucher
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher, Evan Quan

VI always uses the legacy pci based reset.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index fffae4c2973b..56c882b3ea3c 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -709,6 +709,12 @@ static int vi_asic_reset(struct amdgpu_device *adev)
 	return r;
 }
 
+static enum amd_reset_method
+vi_asic_reset_method(struct amdgpu_device *adev)
+{
+	return AMD_RESET_METHOD_LEGACY;
+}
+
 static u32 vi_get_config_memsize(struct amdgpu_device *adev)
 {
 	return RREG32(mmCONFIG_MEMSIZE);
@@ -1021,6 +1027,7 @@ static const struct amdgpu_asic_funcs vi_asic_funcs =
 	.read_bios_from_rom = &vi_read_bios_from_rom,
 	.read_register = &vi_read_register,
 	.reset = &vi_asic_reset,
+	.reset_method = &vi_asic_reset_method,
 	.set_vga_state = &vi_vga_set_state,
 	.get_xclk = &vi_get_xclk,
 	.set_uvd_clocks = &vi_set_uvd_clocks,
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/12] drm/amdgpu: add reset_method asic callback for soc15
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (2 preceding siblings ...)
  2019-07-25 16:57   ` [PATCH 04/12] drm/amdgpu: add reset_method asic callback for vi Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 06/12] drm/amdgpu: add reset_method asic callback for navi Alex Deucher
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher, Evan Quan

APUs only support mode2 reset.  dGPUs use either mode1 or
baco depending on various conditions.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
index f67ecf814c8c..4405b983dd09 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -464,12 +464,14 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)
 	return 0;
 }
 
-static int soc15_asic_reset(struct amdgpu_device *adev)
+static enum amd_reset_method
+soc15_asic_reset_method(struct amdgpu_device *adev)
 {
-	int ret;
 	bool baco_reset;
 
 	switch (adev->asic_type) {
+	case CHIP_RAVEN:
+		return AMD_RESET_METHOD_MODE2;
 	case CHIP_VEGA10:
 	case CHIP_VEGA12:
 		soc15_asic_get_baco_capability(adev, &baco_reset);
@@ -493,6 +495,16 @@ static int soc15_asic_reset(struct amdgpu_device *adev)
 	}
 
 	if (baco_reset)
+		return AMD_RESET_METHOD_BACO;
+	else
+		return AMD_RESET_METHOD_MODE1;
+}
+
+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);
@@ -806,6 +818,7 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs =
 	.read_bios_from_rom = &soc15_read_bios_from_rom,
 	.read_register = &soc15_read_register,
 	.reset = &soc15_asic_reset,
+	.reset_method = &soc15_asic_reset_method,
 	.set_vga_state = &soc15_vga_set_state,
 	.get_xclk = &soc15_get_xclk,
 	.set_uvd_clocks = &soc15_set_uvd_clocks,
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/12] drm/amdgpu: add reset_method asic callback for navi
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (3 preceding siblings ...)
  2019-07-25 16:57   ` [PATCH 05/12] drm/amdgpu: add reset_method asic callback for soc15 Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 07/12] drm/amdgpu/powerplay: add a new interface to set the mp1 state Alex Deucher
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher, Evan Quan

Navi uses either mode1 or baco depending on various
conditions.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/nv.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
index 6c59b64b9bb1..bf4cbcdeef78 100644
--- a/drivers/gpu/drm/amd/amdgpu/nv.c
+++ b/drivers/gpu/drm/amd/amdgpu/nv.c
@@ -289,6 +289,18 @@ static int nv_asic_mode1_reset(struct amdgpu_device *adev)
 
 	return ret;
 }
+
+static enum amd_reset_method
+nv_asic_reset_method(struct amdgpu_device *adev)
+{
+	struct smu_context *smu = &adev->smu;
+
+	if (smu_baco_is_support(smu))
+		return AMD_RESET_METHOD_BACO;
+	else
+		return AMD_RESET_METHOD_MODE1;
+}
+
 static int nv_asic_reset(struct amdgpu_device *adev)
 {
 
@@ -303,7 +315,7 @@ static int nv_asic_reset(struct amdgpu_device *adev)
 	int ret = 0;
 	struct smu_context *smu = &adev->smu;
 
-	if (smu_baco_is_support(smu))
+	if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO)
 		ret = smu_baco_reset(smu);
 	else
 		ret = nv_asic_mode1_reset(adev);
@@ -500,6 +512,7 @@ static const struct amdgpu_asic_funcs nv_asic_funcs =
 	.read_bios_from_rom = &nv_read_bios_from_rom,
 	.read_register = &nv_read_register,
 	.reset = &nv_asic_reset,
+	.reset_method = &nv_asic_reset_method,
 	.set_vga_state = &nv_vga_set_state,
 	.get_xclk = &nv_get_xclk,
 	.set_uvd_clocks = &nv_set_uvd_clocks,
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/12] drm/amdgpu/powerplay: add a new interface to set the mp1 state
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (4 preceding siblings ...)
  2019-07-25 16:57   ` [PATCH 06/12] drm/amdgpu: add reset_method asic callback for navi Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 08/12] drm/amdgpu/powerplay: add set_mp1_state for vega20 Alex Deucher
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

This is required for certain cases such as various GPU resets
(mode1, mode2), BACO, shutdown, unload, etc. to put the SMU into
the appropriate state for when the hw is re-initialized.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h |  8 ++++++++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c  | 16 ++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h      |  1 +
 3 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
index 9733bbf9bc72..95edc3d3a9c4 100644
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
@@ -171,6 +171,13 @@ enum PP_HWMON_TEMP {
 	PP_TEMP_MAX
 };
 
+enum pp_mp1_state {
+	PP_MP1_STATE_NONE,
+	PP_MP1_STATE_SHUTDOWN,
+	PP_MP1_STATE_UNLOAD,
+	PP_MP1_STATE_RESET,
+};
+
 #define PP_GROUP_MASK        0xF0000000
 #define PP_GROUP_SHIFT       28
 
@@ -266,6 +273,7 @@ struct amd_pm_funcs {
 	int (*get_power_profile_mode)(void *handle, char *buf);
 	int (*set_power_profile_mode)(void *handle, long *input, uint32_t size);
 	int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, uint32_t size);
+	int (*set_mp1_state)(void *handle, enum pp_mp1_state mp1_state);
 /* export to DC */
 	u32 (*get_sclk)(void *handle, bool low);
 	u32 (*get_mclk)(void *handle, bool low);
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index bea1587d352d..88a2ef75b7e1 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -924,6 +924,21 @@ static int pp_odn_edit_dpm_table(void *handle, uint32_t type, long *input, uint3
 	return hwmgr->hwmgr_func->odn_edit_dpm_table(hwmgr, type, input, size);
 }
 
+static int pp_dpm_set_mp1_state(void *handle, enum pp_mp1_state mp1_state)
+{
+	struct pp_hwmgr *hwmgr = handle;
+
+	if (!hwmgr || !hwmgr->pm_en)
+		return -EINVAL;
+
+	if (hwmgr->hwmgr_func->set_mp1_state == NULL) {
+		pr_info_ratelimited("%s was not implemented.\n", __func__);
+		return -EINVAL;
+	}
+
+	return hwmgr->hwmgr_func->set_mp1_state(hwmgr, mp1_state);
+}
+
 static int pp_dpm_switch_power_profile(void *handle,
 		enum PP_SMC_POWER_PROFILE type, bool en)
 {
@@ -1525,6 +1540,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = {
 	.get_power_profile_mode = pp_get_power_profile_mode,
 	.set_power_profile_mode = pp_set_power_profile_mode,
 	.odn_edit_dpm_table = pp_odn_edit_dpm_table,
+	.set_mp1_state = pp_dpm_set_mp1_state,
 	.set_power_limit = pp_set_power_limit,
 	.get_power_limit = pp_get_power_limit,
 /* export to DC */
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index c5989cb38b1b..07fd64aad2ae 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -344,6 +344,7 @@ struct pp_hwmgr_func {
 	int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr, enum BACO_STATE state);
 	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);
 };
 
 struct pp_table_func {
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/12] drm/amdgpu/powerplay: add set_mp1_state for vega20
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (5 preceding siblings ...)
  2019-07-25 16:57   ` [PATCH 07/12] drm/amdgpu/powerplay: add a new interface to set the mp1 state Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 09/12] drm/amdgpu/powerplay: add set_mp1_state for vega10 Alex Deucher
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

This sets the SMU into the proper state for various
operations (shutdown, unload, GPU reset, etc.).

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c    | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index f27c6fbb192e..0516c294b377 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -3063,6 +3063,34 @@ static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+static int vega20_set_mp1_state(struct pp_hwmgr *hwmgr,
+				enum pp_mp1_state mp1_state)
+{
+	uint16_t msg;
+	int ret;
+
+	switch (mp1_state) {
+	case PP_MP1_STATE_SHUTDOWN:
+		msg = PPSMC_MSG_PrepareMp1ForShutdown;
+		break;
+	case PP_MP1_STATE_UNLOAD:
+		msg = PPSMC_MSG_PrepareMp1ForUnload;
+		break;
+	case PP_MP1_STATE_RESET:
+		msg = PPSMC_MSG_PrepareMp1ForReset;
+		break;
+	case PP_MP1_STATE_NONE:
+	default:
+		return 0;
+	}
+
+	PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr, msg)) == 0,
+			    "[PrepareMp1] Failed!",
+			    return ret);
+
+	return 0;
+}
+
 static int vega20_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf)
 {
 	static const char *ppfeature_name[] = {
@@ -4123,6 +4151,7 @@ static const struct pp_hwmgr_func vega20_hwmgr_funcs = {
 	.get_asic_baco_capability = vega20_baco_get_capability,
 	.get_asic_baco_state = vega20_baco_get_state,
 	.set_asic_baco_state = vega20_baco_set_state,
+	.set_mp1_state = vega20_set_mp1_state,
 };
 
 int vega20_hwmgr_init(struct pp_hwmgr *hwmgr)
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/12] drm/amdgpu/powerplay: add set_mp1_state for vega10
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (6 preceding siblings ...)
  2019-07-25 16:57   ` [PATCH 08/12] drm/amdgpu/powerplay: add set_mp1_state for vega20 Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 10/12] drm/amdgpu/powerplay: add set_mp1_state for vega12 Alex Deucher
                     ` (2 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

This sets the SMU into the proper state for various
operations (shutdown, unload, GPU reset, etc.).

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/powerplay/hwmgr/vega10_hwmgr.c    | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 1d9bb29adaef..03bd62e3d947 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -5218,6 +5218,30 @@ static int vega10_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+static int vega10_set_mp1_state(struct pp_hwmgr *hwmgr,
+				enum pp_mp1_state mp1_state)
+{
+	uint16_t msg;
+	int ret;
+
+	switch (mp1_state) {
+	case PP_MP1_STATE_UNLOAD:
+		msg = PPSMC_MSG_PrepareMp1ForUnload;
+		break;
+	case PP_MP1_STATE_SHUTDOWN:
+	case PP_MP1_STATE_RESET:
+	case PP_MP1_STATE_NONE:
+	default:
+		return 0;
+	}
+
+	PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr, msg)) == 0,
+			    "[PrepareMp1] Failed!",
+			    return ret);
+
+	return 0;
+}
+
 static int vega10_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *state,
 				PHM_PerformanceLevelDesignation designation, uint32_t index,
 				PHM_PerformanceLevel *level)
@@ -5307,6 +5331,7 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = {
 	.enable_mgpu_fan_boost = vega10_enable_mgpu_fan_boost,
 	.get_ppfeature_status = vega10_get_ppfeature_status,
 	.set_ppfeature_status = vega10_set_ppfeature_status,
+	.set_mp1_state = vega10_set_mp1_state,
 };
 
 int vega10_hwmgr_init(struct pp_hwmgr *hwmgr)
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/12] drm/amdgpu/powerplay: add set_mp1_state for vega12
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (7 preceding siblings ...)
  2019-07-25 16:57   ` [PATCH 09/12] drm/amdgpu/powerplay: add set_mp1_state for vega10 Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 11/12] drm/amdgpu: add a flag to note when the driver is in shutdown Alex Deucher
  2019-07-25 16:57   ` [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspend Alex Deucher
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

This sets the SMU into the proper state for various
operations (shutdown, unload, GPU reset, etc.).

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/powerplay/hwmgr/vega12_hwmgr.c    | 26 ++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
index efb6d3762feb..7af9ad450ac4 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
@@ -2639,6 +2639,30 @@ static int vega12_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_
 	return 0;
 }
 
+static int vega12_set_mp1_state(struct pp_hwmgr *hwmgr,
+				enum pp_mp1_state mp1_state)
+{
+	uint16_t msg;
+	int ret;
+
+	switch (mp1_state) {
+	case PP_MP1_STATE_UNLOAD:
+		msg = PPSMC_MSG_PrepareMp1ForUnload;
+		break;
+	case PP_MP1_STATE_SHUTDOWN:
+	case PP_MP1_STATE_RESET:
+	case PP_MP1_STATE_NONE:
+	default:
+		return 0;
+	}
+
+	PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr, msg)) == 0,
+			    "[PrepareMp1] Failed!",
+			    return ret);
+
+	return 0;
+}
+
 static const struct pp_hwmgr_func vega12_hwmgr_funcs = {
 	.backend_init = vega12_hwmgr_backend_init,
 	.backend_fini = vega12_hwmgr_backend_fini,
@@ -2695,7 +2719,7 @@ static const struct pp_hwmgr_func vega12_hwmgr_funcs = {
 	.set_asic_baco_state = vega12_baco_set_state,
 	.get_ppfeature_status = vega12_get_ppfeature_status,
 	.set_ppfeature_status = vega12_set_ppfeature_status,
-
+	.set_mp1_state = vega12_set_mp1_state,
 };
 
 int vega12_hwmgr_init(struct pp_hwmgr *hwmgr)
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 11/12] drm/amdgpu: add a flag to note when the driver is in shutdown
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (8 preceding siblings ...)
  2019-07-25 16:57   ` [PATCH 10/12] drm/amdgpu/powerplay: add set_mp1_state for vega12 Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
  2019-07-25 16:57   ` [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspend Alex Deucher
  10 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

When we are tearing down the device for PCI shutdown, set the
flag.  The driver needs to know this case so it can set the
SMC into the proper state.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index e661417ba9dd..64e68c0dc737 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -993,6 +993,7 @@ struct amdgpu_device {
 	/* record last mm index being written through WREG32*/
 	unsigned long last_mm_index;
 	bool                            in_gpu_reset;
+	bool                            in_gpu_shutdown;
 	struct mutex  lock_reset;
 	struct amdgpu_doorbell_index doorbell_index;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 4743801357c5..28f85d9135a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1089,12 +1089,14 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
 	struct drm_device *dev = pci_get_drvdata(pdev);
 	struct amdgpu_device *adev = dev->dev_private;
 
+	adev->in_gpu_shutdown = true;
 	/* if we are running in a VM, make sure the device
 	 * torn down properly on reboot/shutdown.
 	 * unfortunately we can't detect certain
 	 * hypervisors so just do this all the time.
 	 */
 	amdgpu_device_ip_suspend(adev);
+	adev->in_gpu_shutdown = false;
 }
 
 static int amdgpu_pmops_suspend(struct device *dev)
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspend
       [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
                     ` (9 preceding siblings ...)
  2019-07-25 16:57   ` [PATCH 11/12] drm/amdgpu: add a flag to note when the driver is in shutdown Alex Deucher
@ 2019-07-25 16:57   ` Alex Deucher
       [not found]     ` <20190725165758.16928-12-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  10 siblings, 1 reply; 14+ messages in thread
From: Alex Deucher @ 2019-07-25 16:57 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Suspend is used for S3/S4, GPU reset, and PCI shutdown.  In
each case, we need to put the SMC into the proper state
in order to resume or reload correctly.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 4425ff06ecc4..bb4260648a97 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2174,6 +2174,39 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
 			DRM_ERROR("suspend of IP block <%s> failed %d\n",
 				  adev->ip_blocks[i].version->funcs->name, r);
 		}
+		/* handle putting the SMC in the appropriate state */
+		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
+			enum pp_mp1_state mp1_state = PP_MP1_STATE_NONE;
+
+			if (adev->in_gpu_reset) {
+				switch (amdgpu_asic_reset_method(adev)) {
+				case AMD_RESET_METHOD_MODE1:
+				case AMD_RESET_METHOD_BACO:
+					mp1_state = PP_MP1_STATE_SHUTDOWN;
+					break;
+				case AMD_RESET_METHOD_MODE2:
+					mp1_state = PP_MP1_STATE_RESET;
+					break;
+				default:
+					mp1_state = PP_MP1_STATE_NONE;
+					break;
+				}
+			} else if (adev->in_gpu_shutdown) {
+				mp1_state = PP_MP1_STATE_UNLOAD;
+			}
+			if (is_support_sw_smu(adev)) {
+				/* todo */
+			} else if (adev->powerplay.pp_funcs &&
+				   adev->powerplay.pp_funcs->set_mp1_state) {
+				r = adev->powerplay.pp_funcs->set_mp1_state(
+					adev->powerplay.pp_handle,
+					mp1_state);
+				if (r) {
+					DRM_ERROR("SMC failed to set mp1 state %d, %d\n",
+						  mp1_state, r);
+				}
+			}
+		}
 	}
 
 	return 0;
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* RE: [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspend
       [not found]     ` <20190725165758.16928-12-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2019-07-26  2:20       ` Quan, Evan
       [not found]         ` <MN2PR12MB33447331E5106CE7A8BC7786E4C00-rweVpJHSKToDMgCC8P//OwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Quan, Evan @ 2019-07-26  2:20 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Deucher, Alexander

Patch1 - patch11: Reviewed-by: Evan Quan <evan.quan@amd.com>

For patch12, comment inline

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Friday, July 26, 2019 12:58 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
> Subject: [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on
> suspend
> 
> Suspend is used for S3/S4, GPU reset, and PCI shutdown.  In each case, we
> need to put the SMC into the proper state in order to resume or reload
> correctly.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33
> ++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 4425ff06ecc4..bb4260648a97 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2174,6 +2174,39 @@ static int
> amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
>  			DRM_ERROR("suspend of IP block <%s> failed %d\n",
>  				  adev->ip_blocks[i].version->funcs->name,
> r);
>  		}
> +		/* handle putting the SMC in the appropriate state */
> +		if (adev->ip_blocks[i].version->type ==
> AMD_IP_BLOCK_TYPE_SMC) {
> +			enum pp_mp1_state mp1_state =
> PP_MP1_STATE_NONE;
> +
> +			if (adev->in_gpu_reset) {
> +				switch (amdgpu_asic_reset_method(adev)) {
> +				case AMD_RESET_METHOD_MODE1:
> +				case AMD_RESET_METHOD_BACO:
> +					mp1_state =
> PP_MP1_STATE_SHUTDOWN;
[Quan, Evan] For AMD_RESET_METHOD_BACO, it should be PP_MP1_STATE_UNLOAD.
> +					break;
> +				case AMD_RESET_METHOD_MODE2:
> +					mp1_state = PP_MP1_STATE_RESET;
> +					break;
> +				default:
> +					mp1_state = PP_MP1_STATE_NONE;
> +					break;
> +				}
> +			} else if (adev->in_gpu_shutdown) {
> +				mp1_state = PP_MP1_STATE_UNLOAD;
> +			}
[Quan, Evan] Handling for suspend only case seems missing.
> +			if (is_support_sw_smu(adev)) {
> +				/* todo */
> +			} else if (adev->powerplay.pp_funcs &&
> +				   adev->powerplay.pp_funcs-
> >set_mp1_state) {
> +				r = adev->powerplay.pp_funcs-
> >set_mp1_state(
> +					adev->powerplay.pp_handle,
> +					mp1_state);
> +				if (r) {
> +					DRM_ERROR("SMC failed to set mp1
> state %d, %d\n",
> +						  mp1_state, r);
> +				}
> +			}
> +		}
[Quan, Evan] Baco reset will be triggered in soc15_asic_reset. And there will be SMU message issued then and needs the SMU prepared.
If we stall the SMU engine here(before soc15_asic_reset), we may fail to issue BACO messages.
>  	}
> 
>  	return 0;
> --
> 2.20.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspend
       [not found]         ` <MN2PR12MB33447331E5106CE7A8BC7786E4C00-rweVpJHSKToDMgCC8P//OwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2019-07-26  2:52           ` Alex Deucher
  0 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2019-07-26  2:52 UTC (permalink / raw)
  To: Quan, Evan; +Cc: Deucher, Alexander, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Thu, Jul 25, 2019 at 10:20 PM Quan, Evan <Evan.Quan@amd.com> wrote:
>
> Patch1 - patch11: Reviewed-by: Evan Quan <evan.quan@amd.com>
>
> For patch12, comment inline
>
> > -----Original Message-----
> > From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex
> > Deucher
> > Sent: Friday, July 26, 2019 12:58 AM
> > To: amd-gfx@lists.freedesktop.org
> > Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
> > Subject: [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on
> > suspend
> >
> > Suspend is used for S3/S4, GPU reset, and PCI shutdown.  In each case, we
> > need to put the SMC into the proper state in order to resume or reload
> > correctly.
> >
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33
> > ++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > index 4425ff06ecc4..bb4260648a97 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > @@ -2174,6 +2174,39 @@ static int
> > amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
> >                       DRM_ERROR("suspend of IP block <%s> failed %d\n",
> >                                 adev->ip_blocks[i].version->funcs->name,
> > r);
> >               }
> > +             /* handle putting the SMC in the appropriate state */
> > +             if (adev->ip_blocks[i].version->type ==
> > AMD_IP_BLOCK_TYPE_SMC) {
> > +                     enum pp_mp1_state mp1_state =
> > PP_MP1_STATE_NONE;
> > +
> > +                     if (adev->in_gpu_reset) {
> > +                             switch (amdgpu_asic_reset_method(adev)) {
> > +                             case AMD_RESET_METHOD_MODE1:
> > +                             case AMD_RESET_METHOD_BACO:
> > +                                     mp1_state =
> > PP_MP1_STATE_SHUTDOWN;
> [Quan, Evan] For AMD_RESET_METHOD_BACO, it should be PP_MP1_STATE_UNLOAD.

Ok.  I thought you had said shutdown before, but see my comment below
about BACO.

> > +                                     break;
> > +                             case AMD_RESET_METHOD_MODE2:
> > +                                     mp1_state = PP_MP1_STATE_RESET;
> > +                                     break;
> > +                             default:
> > +                                     mp1_state = PP_MP1_STATE_NONE;
> > +                                     break;
> > +                             }
> > +                     } else if (adev->in_gpu_shutdown) {
> > +                             mp1_state = PP_MP1_STATE_UNLOAD;
> > +                     }
> [Quan, Evan] Handling for suspend only case seems missing.

Do you know what state we should use for suspend?  Do we even need to
a case for suspend?  Putting the chip into D3 might be enough as is.

> > +                     if (is_support_sw_smu(adev)) {
> > +                             /* todo */
> > +                     } else if (adev->powerplay.pp_funcs &&
> > +                                adev->powerplay.pp_funcs-
> > >set_mp1_state) {
> > +                             r = adev->powerplay.pp_funcs-
> > >set_mp1_state(
> > +                                     adev->powerplay.pp_handle,
> > +                                     mp1_state);
> > +                             if (r) {
> > +                                     DRM_ERROR("SMC failed to set mp1
> > state %d, %d\n",
> > +                                               mp1_state, r);
> > +                             }
> > +                     }
> > +             }
> [Quan, Evan] Baco reset will be triggered in soc15_asic_reset. And there will be SMU message issued then and needs the SMU prepared.
> If we stall the SMU engine here(before soc15_asic_reset), we may fail to issue BACO messages.

Good point.  Although thinking a bit more about how BACO works, I'm
wondering if we even need to do anything for BACO.  We use the SMU to
bring the chip in and out of BACO so I'm not sure if it makes sense to
do anything for the BACO case.

Alex

> >       }
> >
> >       return 0;
> > --
> > 2.20.1
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-07-26  2:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 16:57 [PATCH 01/12] drm/amdgpu: add an asic callback to determine the reset method Alex Deucher
     [not found] ` <20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2019-07-25 16:57   ` [PATCH 02/12] drm/amdgpu: add reset_method asic callback for si Alex Deucher
2019-07-25 16:57   ` [PATCH 03/12] drm/amdgpu: add reset_method asic callback for cik Alex Deucher
2019-07-25 16:57   ` [PATCH 04/12] drm/amdgpu: add reset_method asic callback for vi Alex Deucher
2019-07-25 16:57   ` [PATCH 05/12] drm/amdgpu: add reset_method asic callback for soc15 Alex Deucher
2019-07-25 16:57   ` [PATCH 06/12] drm/amdgpu: add reset_method asic callback for navi Alex Deucher
2019-07-25 16:57   ` [PATCH 07/12] drm/amdgpu/powerplay: add a new interface to set the mp1 state Alex Deucher
2019-07-25 16:57   ` [PATCH 08/12] drm/amdgpu/powerplay: add set_mp1_state for vega20 Alex Deucher
2019-07-25 16:57   ` [PATCH 09/12] drm/amdgpu/powerplay: add set_mp1_state for vega10 Alex Deucher
2019-07-25 16:57   ` [PATCH 10/12] drm/amdgpu/powerplay: add set_mp1_state for vega12 Alex Deucher
2019-07-25 16:57   ` [PATCH 11/12] drm/amdgpu: add a flag to note when the driver is in shutdown Alex Deucher
2019-07-25 16:57   ` [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspend Alex Deucher
     [not found]     ` <20190725165758.16928-12-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2019-07-26  2:20       ` Quan, Evan
     [not found]         ` <MN2PR12MB33447331E5106CE7A8BC7786E4C00-rweVpJHSKToDMgCC8P//OwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-07-26  2:52           ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.