RE: [PATCH] drm/amdgpu: Reset error code for 'no handler' case

2021-03-28 Thread Chen, Guchun
[AMD Public Use]

Reviewed-and-tested-by: Guchun Chen 
guchun.c...@amd.com

Regards,
Guchun

From: Lazar, Lijo 
Sent: Monday, March 29, 2021 12:04 PM
To: amd-gfx@lists.freedesktop.org
Cc: Zhang, Hawking ; Xu, Feifei ; 
Chen, Guchun 
Subject: [PATCH] drm/amdgpu: Reset error code for 'no handler' case


[AMD Public Use]

If reset handler is not implemented, reset error before proceeding.

Fixes issue with the following trace -
[  106.508592] amdgpu :b1:00.0: amdgpu: ASIC reset failed with error, -38 
for drm dev, :b1:00.0
[  106.508972] amdgpu :b1:00.0: amdgpu: GPU reset succeeded, trying to 
resume
[  106.509116] [drm] PCIE GART of 512M enabled.
[  106.509120] [drm] PTB located at 0x0080
[  106.509136] [drm] VRAM is lost due to GPU reset!
[  106.509332] [drm] PSP is resuming...

Signed-off-by: Lijo Lazar lijo.la...@amd.com
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 ---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 319d69646a13..a501d1a4d000 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4281,7 +4281,10 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device 
*adev,
   drm_sched_increase_karma(>base);

r = amdgpu_reset_prepare_hwcontext(adev, reset_context);
-  if (r != -ENOSYS)
+ /* If reset handler not implemented, continue; otherwise return */
+ if (r == -ENOSYS)
+ r = 0;
+ else
   return r;

/* Don't suspend on bare metal if we are not going to HW reset 
the ASIC */
@@ -4323,8 +4326,10 @@ int amdgpu_do_asic_reset(struct list_head 
*device_list_handle,
   tmp_adev = list_first_entry(device_list_handle, struct 
amdgpu_device,
   reset_list);
   r = amdgpu_reset_perform_reset(tmp_adev, reset_context);
-
-  if (r != -ENOSYS)
+ /* If reset handler not implemented, continue; otherwise return */
+ if (r == -ENOSYS)
+ r = 0;
+ else
   return r;

/* Reset handler not implemented, use the default method */
--
2.17.1

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


[PATCH] drm/amdgpu: Reset error code for 'no handler' case

2021-03-28 Thread Lazar, Lijo
[AMD Public Use]

If reset handler is not implemented, reset error before proceeding.

Fixes issue with the following trace -
[  106.508592] amdgpu :b1:00.0: amdgpu: ASIC reset failed with error, -38 
for drm dev, :b1:00.0
[  106.508972] amdgpu :b1:00.0: amdgpu: GPU reset succeeded, trying to 
resume
[  106.509116] [drm] PCIE GART of 512M enabled.
[  106.509120] [drm] PTB located at 0x0080
[  106.509136] [drm] VRAM is lost due to GPU reset!
[  106.509332] [drm] PSP is resuming...

Signed-off-by: Lijo Lazar lijo.la...@amd.com
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 ---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 319d69646a13..a501d1a4d000 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4281,7 +4281,10 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device 
*adev,
   drm_sched_increase_karma(>base);
r = amdgpu_reset_prepare_hwcontext(adev, reset_context);
-  if (r != -ENOSYS)
+ /* If reset handler not implemented, continue; otherwise return */
+ if (r == -ENOSYS)
+ r = 0;
+ else
   return r;
/* Don't suspend on bare metal if we are not going to HW reset 
the ASIC */
@@ -4323,8 +4326,10 @@ int amdgpu_do_asic_reset(struct list_head 
*device_list_handle,
   tmp_adev = list_first_entry(device_list_handle, struct 
amdgpu_device,
   reset_list);
   r = amdgpu_reset_perform_reset(tmp_adev, reset_context);
-
-  if (r != -ENOSYS)
+ /* If reset handler not implemented, continue; otherwise return */
+ if (r == -ENOSYS)
+ r = 0;
+ else
   return r;
/* Reset handler not implemented, use the default method */
--
2.17.1

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


RE: [PATCH] drm/amd/amdgpu: set MP1 state to UNLOAD before reload its FW for vega20

2021-03-28 Thread Chen, Guchun
[AMD Public Use]

It's better to add below error info in commit message for audience's 
understanding.

[  121.642772] [drm] reserve 0x40 from 0x87fec0 for PSP TMR
[  123.801051] [drm] failed to load ucode id (24) 
[  123.801055] [drm] psp command (0x6) failed and response status is (0x0)
[  123.801214] [drm:psp_load_smu_fw [amdgpu]] *ERROR* PSP load smu failed!
[  123.801398] [drm:psp_resume [amdgpu]] *ERROR* PSP resume failed
[  123.801536] [drm:amdgpu_device_fw_loading [amdgpu]] *ERROR* resume of IP 
block  failed -22
[  123.801632] amdgpu :04:00.0: amdgpu: GPU reset(9) failed
[  123.801691] amdgpu :07:00.0: amdgpu: GPU reset(9) failed
[  123.802899] amdgpu :04:00.0: amdgpu: GPU reset end with ret = -22

With above added, the patch is:
Reviewed-and-tested-by: Guchun Chen 

Regards,
Guchun

-Original Message-
From: Chengming Gui  
Sent: Monday, March 29, 2021 11:39 AM
To: amd-gfx@lists.freedesktop.org
Cc: Chen, Guchun ; Quan, Evan ; Long, 
Gang ; Gui, Jack 
Subject: [PATCH] drm/amd/amdgpu: set MP1 state to UNLOAD before reload its FW 
for vega20

When resume from gpu reset, need set MP1 state to UNLOAD before reload SMU FW

Signed-off-by: Chengming Gui 
Change-Id: I54c2accab58d53a2780d10720f26a717bf1ff130
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 60dbb8c1e74d..aa16bc292a16 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -2148,7 +2148,8 @@ static int psp_load_smu_fw(struct psp_context *psp)
 
if ((amdgpu_in_reset(adev) &&
 ras && ras->supported &&
-adev->asic_type == CHIP_ARCTURUS) ||
+(adev->asic_type == CHIP_ARCTURUS ||
+ adev->asic_type == CHIP_VEGA20)) ||
 (adev->in_runpm &&
  adev->asic_type >= CHIP_NAVI10 &&
  adev->asic_type <= CHIP_NAVI12)) {
--
2.17.1
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [PATCH] drm/amdgpu/vangogh: don't check for dpm in is_dpm_running when in suspend

2021-03-28 Thread Quan, Evan
[AMD Public Use]

Acked-by: Evan Quan 

> -Original Message-
> From: amd-gfx  On Behalf Of Alex
> Deucher
> Sent: Saturday, March 27, 2021 4:58 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander 
> Subject: [PATCH] drm/amdgpu/vangogh: don't check for dpm in
> is_dpm_running when in suspend
> 
> Do the same thing we do for Renoir.  We can check, but since
> the sbios has started DPM, it will always return true which
> causes the driver to skip some of the SMU init when it shouldn't.
> 
> Signed-off-by: Alex Deucher 
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
> index 2f502fec67d5..ed11e0ab8299 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
> @@ -384,10 +384,15 @@ static int vangogh_dpm_set_jpeg_enable(struct
> smu_context *smu, bool enable)
> 
>  static bool vangogh_is_dpm_running(struct smu_context *smu)
>  {
> + struct amdgpu_device *adev = smu->adev;
>   int ret = 0;
>   uint32_t feature_mask[2];
>   uint64_t feature_enabled;
> 
> + /* we need to re-init after suspend so return false */
> + if (adev->in_suspend)
> + return false;
> +
>   ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2);
> 
>   if (ret)
> --
> 2.30.2
> 
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
> freedesktop.org%2Fmailman%2Flistinfo%2Famd-
> gfxdata=04%7C01%7Cevan.quan%40amd.com%7C43d4981ccc7545675
> bfe08d8f099fac3%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637
> 523891416957673%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAi
> LCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=2C
> 8w1ValXDpaPW3jzDN%2BdNmiDK10FOxgQ20h%2FJ%2F66sc%3Dreser
> ved=0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 1/1] drm/amd/display: Remove duplicated header file inclusion

2021-03-28 Thread Zhen Lei
The header file  is included in the following common
section and can be removed here.

Signed-off-by: Zhen Lei 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 573cf17262da4e1..74989ed502016ee 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -44,7 +44,6 @@
 #include "amdgpu_dm.h"
 #ifdef CONFIG_DRM_AMD_DC_HDCP
 #include "amdgpu_dm_hdcp.h"
-#include 
 #endif
 #include "amdgpu_pm.h"
 
-- 
1.8.3


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


[PATCH] amd: display: dc: struct dc_state is declared twice

2021-03-28 Thread Wan Jiabing
struct dc_state has been declared at 273rd line.
Remove the duplicate.
Delete duplicate blank lines.

Signed-off-by: Wan Jiabing 
---
 drivers/gpu/drm/amd/display/dc/dc.h | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 18ed0d3f247e..dc667298ab5b 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -234,7 +234,6 @@ struct dc_static_screen_params {
unsigned int num_frames;
 };
 
-
 /* Surface update type is used by dc_update_surfaces_and_stream
  * The update type is determined at the very beginning of the function based
  * on parameters passed in and decides how much programming (or updating) is
@@ -272,7 +271,6 @@ struct dc;
 struct dc_plane_state;
 struct dc_state;
 
-
 struct dc_cap_funcs {
bool (*get_dcc_compression_cap)(const struct dc *dc,
const struct dc_dcc_surface_param *input,
@@ -281,7 +279,6 @@ struct dc_cap_funcs {
 
 struct link_training_settings;
 
-
 /* Structure to hold configuration flags set by dm at dc creation. */
 struct dc_config {
bool gpu_vm_support;
@@ -581,7 +578,6 @@ struct dc_bounding_box_overrides {
int min_dcfclk_mhz;
 };
 
-struct dc_state;
 struct resource_pool;
 struct dce_hwseq;
 struct gpu_info_soc_bounding_box_v1_0;
@@ -757,7 +753,6 @@ enum dc_transfer_func_predefined {
TRANSFER_FUNCTION_GAMMA26
 };
 
-
 struct dc_transfer_func {
struct kref refcount;
enum dc_transfer_func_type type;
@@ -770,7 +765,6 @@ struct dc_transfer_func {
};
 };
 
-
 union dc_3dlut_state {
struct {
uint32_t initialized:1; /*if 3dlut is went through 
color module for initialization */
@@ -784,7 +778,6 @@ union dc_3dlut_state {
uint32_t raw;
 };
 
-
 struct dc_3dlut {
struct kref refcount;
struct tetrahedral_params lut_3d;
@@ -1014,7 +1007,6 @@ enum dc_status dc_validate_global_state(
struct dc_state *new_ctx,
bool fast_validate);
 
-
 void dc_resource_state_construct(
const struct dc *dc,
struct dc_state *dst_ctx);
@@ -1167,7 +1159,6 @@ struct dc_container_id {
unsigned short productCode;
 };
 
-
 struct dc_sink_dsc_caps {
// 'true' if these are virtual DPCD's DSC caps (immediately upstream of 
sink in MST topology),
// 'false' if they are sink's DSC caps
@@ -1229,7 +1220,6 @@ struct dc_cursor {
struct dc_cursor_attributes attributes;
 };
 
-
 
/***
  * Interrupt interfaces
  
**/
-- 
2.25.1

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


[PATCH 1/1] drm/amd/display: Remove duplicated header file inclusion

2021-03-28 Thread Zhen Lei
The header file "dce110/dce110_resource.h" is already included above and
can be removed here.

Signed-off-by: Zhen Lei 
---
 drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
index 4a3df13c9e49add..c4fe21b3b23f65a 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
@@ -61,7 +61,6 @@
 #include "dcn21/dcn21_dccg.h"
 #include "dcn21_hubbub.h"
 #include "dcn10/dcn10_resource.h"
-#include "dce110/dce110_resource.h"
 #include "dce/dce_panel_cntl.h"
 
 #include "dcn20/dcn20_dwb.h"
-- 
1.8.3


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