drm/amdgpu: initialize ras structures for xgmi block
Subsystems (2)
PATCH 1/2 drm/amdgpu: initialize ras structures for xgmi block
init ras common interface and fs node for xgmi block
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 36 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 7 +++++++ 4 files changed, 45 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
@@ -120,6 +120,7 @@ struct amdgpu_xgmi {/* gpu list in the same hive */ struct list_head head;bool supported; +struct ras_common_if *ras_if; };struct amdgpu_gmc {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +36 -0
@@ -25,6 +25,7 @@#include "amdgpu.h" #include "amdgpu_xgmi.h" #include "amdgpu_smu.h" +#include "amdgpu_ras.h" #include "df/df_3_6_offset.h" static DEFINE_MUTEX (xgmi_mutex);
@@ -437,3 +438,38 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)mutex_unlock (&hive->hive_lock); } } + +int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev) +{ +int r; +struct ras_ih_if ih_info = { + .cb =NULL , + }; +struct ras_fs_if fs_info = { + .sysfs_name ="xgmi_wafl_err_count" , + .debugfs_name ="xgmi_wafl_err_inject" , + }; + +if (!adev->gmc.xgmi.supported || + adev->gmc.xgmi.num_physical_nodes ==0 ) +return 0 ; + +if (!adev->gmc.xgmi.ras_if) { + adev->gmc.xgmi.ras_if =kmalloc (sizeof (struct ras_common_if ),GFP_KERNEL ); +if (!adev->gmc.xgmi.ras_if) +return -ENOMEM ; + adev->gmc.xgmi.ras_if->block =AMDGPU_RAS_BLOCK__XGMI_WAFL ; + adev->gmc.xgmi.ras_if->type =AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE ; + adev->gmc.xgmi.ras_if->sub_block_index =0 ; +strcpy (adev->gmc.xgmi.ras_if->name,"xgmi_wafl" ); + } + ih_info.head = fs_info.head = *adev->gmc.xgmi.ras_if; + r =amdgpu_ras_late_init (adev, adev->gmc.xgmi.ras_if, + &fs_info, &ih_info); +if (r || !amdgpu_ras_is_supported (adev, adev->gmc.xgmi.ras_if->block)) { +kfree (adev->gmc.xgmi.ras_if); + adev->gmc.xgmi.ras_if =NULL ; + } + +return r; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +1 -0
@@ -42,6 +42,7 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev);int amdgpu_xgmi_set_pstate (struct amdgpu_device *adev,int pstate);int amdgpu_xgmi_get_hops_count (struct amdgpu_device *adev,struct amdgpu_device *peer_adev); +int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev);static inline bool amdgpu_xgmi_same_hive (struct amdgpu_device *adev,struct amdgpu_device *bo_adev)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -0
@@ -51,6 +51,7 @@#include "ivsrcid/vmc/irqsrcs_vmc_1_0.h" #include "amdgpu_ras.h" +#include "amdgpu_xgmi.h" /* add these here since we already include dce12 headers and these are for DCN */ #define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION 0x055d
@@ -802,6 +803,12 @@ static int gmc_v9_0_ecc_late_init(void *handle)if (r)return r; } + +if (adev->gmc.xgmi.num_physical_nodes >1 ) { + r =amdgpu_xgmi_ras_late_init (adev); +if (r) +return r; + }return 0 ; }
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): 1567980418-32146-1-git-send-email-Hawking.Zhang-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: enable error injection to XGMI block via debugfs
allow inject error to XGMI block via debugfs node ras_ctrl
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -0
@@ -679,6 +679,7 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev,break ;case AMDGPU_RAS_BLOCK__UMC :case AMDGPU_RAS_BLOCK__MMHUB : +case AMDGPU_RAS_BLOCK__XGMI_WAFL : ret =psp_ras_trigger_error (&adev->psp, &block_info);break ;default :
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Monday, September 9, 2019 6:07 AM
To: [email protected]; Zhou1, Tao <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: initialize ras structures for xgmi block
init ras common interface and fs node for xgmi block
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 36 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 7 +++++++ 4 files changed, 45 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
@@ -120,6 +120,7 @@ struct amdgpu_xgmi {/* gpu list in the same hive */ struct list_head head;bool supported; +struct ras_common_if *ras_if; };struct amdgpu_gmc {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +15 -0
@@ -25,6 +25,7 @@#include "amdgpu.h" #include "amdgpu_xgmi.h" #include "amdgpu_smu.h" +#include "amdgpu_ras.h" #include "df/df_3_6_offset.h" static DEFINE_MUTEX (xgmi_mutex);
@@ -437,3 +438,38 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)mutex_unlock (&hive->hive_lock); } } + +int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev) { +int r; +struct ras_ih_if ih_info = { + .cb =NULL , + }; +struct ras_fs_if fs_info = { + .sysfs_name ="xgmi_wafl_err_count" , + .debugfs_name ="xgmi_wafl_err_inject" , + }; + +if (!adev->gmc.xgmi.supported || + adev->gmc.xgmi.num_physical_nodes ==0 ) +return 0 ;
[Guchun]Looks this check num_physical_nodes==0 is redundant, as there is already one check outside of this function.
Is it better to move these two conditions outside of this function, to allow function entrance once xgmi.supported is true and num_physical_nodes > 0?
if (adev->gmc.xgmi.num_physical_nodes > 1) {
r = amdgpu_xgmi_ras_late_init(adev);
if (r)
return r;
}+ if (!adev->gmc.xgmi.ras_if) {
+ adev->gmc.xgmi.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
+ if (!adev->gmc.xgmi.ras_if)
+ return -ENOMEM;
+ adev->gmc.xgmi.ras_if->block = AMDGPU_RAS_BLOCK__XGMI_WAFL;
+ adev->gmc.xgmi.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
+ adev->gmc.xgmi.ras_if->sub_block_index = 0;
+ strcpy(adev->gmc.xgmi.ras_if->name, "xgmi_wafl");
+ }
+ ih_info.head = fs_info.head = *adev->gmc.xgmi.ras_if;
+ r = amdgpu_ras_late_init(adev, adev->gmc.xgmi.ras_if,
+ &fs_info, &ih_info);
+ if (r || !amdgpu_ras_is_supported(adev, adev->gmc.xgmi.ras_if->block)) {
+ kfree(adev->gmc.xgmi.ras_if);
+ adev->gmc.xgmi.ras_if = NULL;
+ }
+
+ return r;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +1 -0
@@ -42,6 +42,7 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev); int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate); int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev, struct amdgpu_device *peer_adev); +int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev);static inline bool amdgpu_xgmi_same_hive (struct amdgpu_device *adev,struct amdgpu_device *bo_adev)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -0
@@ -51,6 +51,7 @@#include "ivsrcid/vmc/irqsrcs_vmc_1_0.h" #include "amdgpu_ras.h" +#include "amdgpu_xgmi.h" /* add these here since we already include dce12 headers and these are for DCN */ #define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION 0x055d
@@ -802,6 +803,12 @@ static int gmc_v9_0_ecc_late_init(void *handle)if (r)return r; } + +if (adev->gmc.xgmi.num_physical_nodes >1 ) { + r =amdgpu_xgmi_ras_late_init (adev); +if (r) +return r; + }return 0 ; }
--
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): BYAPR12MB2806FF92FAA92669B7886542F1B70-ZGDeBxoHBPk0CuAkIMgl3QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
I'd like to keep the conditional check in amdgpu_xgmi_ras_late_init internal so that it can be used anywhere without any conditional check from external. Please check v2.
Regards,
Hawking
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: 2019年9月9日 9:22
To: Zhang, Hawking <[email protected]>; [email protected]; Zhou1, Tao <[email protected]>; Li, Dennis <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: initialize ras structures for xgmi block
-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Monday, September 9, 2019 6:07 AM
To: [email protected]; Zhou1, Tao <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: initialize ras structures for xgmi block
init ras common interface and fs node for xgmi block
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 36 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 7 +++++++ 4 files changed, 45 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
@@ -120,6 +120,7 @@ struct amdgpu_xgmi {/* gpu list in the same hive */ struct list_head head;bool supported; +struct ras_common_if *ras_if; };struct amdgpu_gmc {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +15 -0
@@ -25,6 +25,7 @@#include "amdgpu.h" #include "amdgpu_xgmi.h" #include "amdgpu_smu.h" +#include "amdgpu_ras.h" #include "df/df_3_6_offset.h" static DEFINE_MUTEX (xgmi_mutex);
@@ -437,3 +438,38 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)mutex_unlock (&hive->hive_lock); } } + +int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev) { +int r; +struct ras_ih_if ih_info = { + .cb =NULL , + }; +struct ras_fs_if fs_info = { + .sysfs_name ="xgmi_wafl_err_count" , + .debugfs_name ="xgmi_wafl_err_inject" , + }; + +if (!adev->gmc.xgmi.supported || + adev->gmc.xgmi.num_physical_nodes ==0 ) +return 0 ;
[Guchun]Looks this check num_physical_nodes==0 is redundant, as there is already one check outside of this function.
Is it better to move these two conditions outside of this function, to allow function entrance once xgmi.supported is true and num_physical_nodes > 0?
if (adev->gmc.xgmi.num_physical_nodes > 1) {
r = amdgpu_xgmi_ras_late_init(adev);
if (r)
return r;
}+ if (!adev->gmc.xgmi.ras_if) {
+ adev->gmc.xgmi.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
+ if (!adev->gmc.xgmi.ras_if)
+ return -ENOMEM;
+ adev->gmc.xgmi.ras_if->block = AMDGPU_RAS_BLOCK__XGMI_WAFL;
+ adev->gmc.xgmi.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
+ adev->gmc.xgmi.ras_if->sub_block_index = 0;
+ strcpy(adev->gmc.xgmi.ras_if->name, "xgmi_wafl");
+ }
+ ih_info.head = fs_info.head = *adev->gmc.xgmi.ras_if;
+ r = amdgpu_ras_late_init(adev, adev->gmc.xgmi.ras_if,
+ &fs_info, &ih_info);
+ if (r || !amdgpu_ras_is_supported(adev, adev->gmc.xgmi.ras_if->block)) {
+ kfree(adev->gmc.xgmi.ras_if);
+ adev->gmc.xgmi.ras_if = NULL;
+ }
+
+ return r;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +1 -0
@@ -42,6 +42,7 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev); int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate); int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev, struct amdgpu_device *peer_adev); +int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev);static inline bool amdgpu_xgmi_same_hive (struct amdgpu_device *adev,struct amdgpu_device *bo_adev)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -0
@@ -51,6 +51,7 @@#include "ivsrcid/vmc/irqsrcs_vmc_1_0.h" #include "amdgpu_ras.h" +#include "amdgpu_xgmi.h" /* add these here since we already include dce12 headers and these are for DCN */ #define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION 0x055d
@@ -802,6 +803,12 @@ static int gmc_v9_0_ecc_late_init(void *handle)if (r)return r; } + +if (adev->gmc.xgmi.num_physical_nodes >1 ) { + r =amdgpu_xgmi_ras_late_init (adev); +if (r) +return r; + }return 0 ; }
--
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): DM5PR12MB1418C4508BB08873825EE12DFCB60-2J9CzHegvk81aAVlcVN8UQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
That's fine.
Regards,
Guchun
-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Tuesday, September 10, 2019 11:20 AM
To: Chen, Guchun <[email protected]>; [email protected]; Zhou1, Tao <[email protected]>; Li, Dennis <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: initialize ras structures for xgmi block
I'd like to keep the conditional check in amdgpu_xgmi_ras_late_init internal so that it can be used anywhere without any conditional check from external. Please check v2.
Regards,
Hawking
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: 2019年9月9日 9:22
To: Zhang, Hawking <[email protected]>; [email protected]; Zhou1, Tao <[email protected]>; Li, Dennis <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: initialize ras structures for xgmi block
-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Monday, September 9, 2019 6:07 AM
To: [email protected]; Zhou1, Tao <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: initialize ras structures for xgmi block
init ras common interface and fs node for xgmi block
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 36 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 1 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 7 +++++++ 4 files changed, 45 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
@@ -120,6 +120,7 @@ struct amdgpu_xgmi {/* gpu list in the same hive */ struct list_head head;bool supported; +struct ras_common_if *ras_if; };struct amdgpu_gmc {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +15 -0
@@ -25,6 +25,7 @@#include "amdgpu.h" #include "amdgpu_xgmi.h" #include "amdgpu_smu.h" +#include "amdgpu_ras.h" #include "df/df_3_6_offset.h" static DEFINE_MUTEX (xgmi_mutex);
@@ -437,3 +438,38 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)mutex_unlock (&hive->hive_lock); } } + +int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev) { +int r; +struct ras_ih_if ih_info = { + .cb =NULL , + }; +struct ras_fs_if fs_info = { + .sysfs_name ="xgmi_wafl_err_count" , + .debugfs_name ="xgmi_wafl_err_inject" , + }; + +if (!adev->gmc.xgmi.supported || + adev->gmc.xgmi.num_physical_nodes ==0 ) +return 0 ;
[Guchun]Looks this check num_physical_nodes==0 is redundant, as there is already one check outside of this function.
Is it better to move these two conditions outside of this function, to allow function entrance once xgmi.supported is true and num_physical_nodes > 0?
if (adev->gmc.xgmi.num_physical_nodes > 1) {
r = amdgpu_xgmi_ras_late_init(adev);
if (r)
return r;
}+ if (!adev->gmc.xgmi.ras_if) {
+ adev->gmc.xgmi.ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
+ if (!adev->gmc.xgmi.ras_if)
+ return -ENOMEM;
+ adev->gmc.xgmi.ras_if->block = AMDGPU_RAS_BLOCK__XGMI_WAFL;
+ adev->gmc.xgmi.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
+ adev->gmc.xgmi.ras_if->sub_block_index = 0;
+ strcpy(adev->gmc.xgmi.ras_if->name, "xgmi_wafl");
+ }
+ ih_info.head = fs_info.head = *adev->gmc.xgmi.ras_if;
+ r = amdgpu_ras_late_init(adev, adev->gmc.xgmi.ras_if,
+ &fs_info, &ih_info);
+ if (r || !amdgpu_ras_is_supported(adev, adev->gmc.xgmi.ras_if->block)) {
+ kfree(adev->gmc.xgmi.ras_if);
+ adev->gmc.xgmi.ras_if = NULL;
+ }
+
+ return r;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +1 -0
@@ -42,6 +42,7 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev); int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate); int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev, struct amdgpu_device *peer_adev); +int amdgpu_xgmi_ras_late_init (struct amdgpu_device *adev);static inline bool amdgpu_xgmi_same_hive (struct amdgpu_device *adev,struct amdgpu_device *bo_adev)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -0
@@ -51,6 +51,7 @@#include "ivsrcid/vmc/irqsrcs_vmc_1_0.h" #include "amdgpu_ras.h" +#include "amdgpu_xgmi.h" /* add these here since we already include dce12 headers and these are for DCN */ #define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION 0x055d
@@ -802,6 +803,12 @@ static int gmc_v9_0_ecc_late_init(void *handle)if (r)return r; } + +if (adev->gmc.xgmi.num_physical_nodes >1 ) { + r =amdgpu_xgmi_ras_late_init (adev); +if (r) +return r; + }return 0 ; }
--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx