28
28
#include <linux/reboot.h>
29
29
#include <linux/syscalls.h>
30
30
#include <linux/pm_runtime.h>
31
+ #include <linux/list_sort.h>
31
32
32
33
#include "amdgpu.h"
33
34
#include "amdgpu_ras.h"
@@ -3665,6 +3666,21 @@ static struct ras_err_node *amdgpu_ras_error_node_new(void)
3665
3666
return err_node ;
3666
3667
}
3667
3668
3669
+ static int ras_err_info_cmp (void * priv , const struct list_head * a , const struct list_head * b )
3670
+ {
3671
+ struct ras_err_node * nodea = container_of (a , struct ras_err_node , node );
3672
+ struct ras_err_node * nodeb = container_of (b , struct ras_err_node , node );
3673
+ struct amdgpu_smuio_mcm_config_info * infoa = & nodea -> err_info .mcm_info ;
3674
+ struct amdgpu_smuio_mcm_config_info * infob = & nodeb -> err_info .mcm_info ;
3675
+
3676
+ if (unlikely (infoa -> socket_id != infob -> socket_id ))
3677
+ return infoa -> socket_id - infob -> socket_id ;
3678
+ else
3679
+ return infoa -> die_id - infob -> die_id ;
3680
+
3681
+ return 0 ;
3682
+ }
3683
+
3668
3684
static struct ras_err_info * amdgpu_ras_error_get_info (struct ras_err_data * err_data ,
3669
3685
struct amdgpu_smuio_mcm_config_info * mcm_info )
3670
3686
{
@@ -3682,6 +3698,7 @@ static struct ras_err_info *amdgpu_ras_error_get_info(struct ras_err_data *err_d
3682
3698
3683
3699
err_data -> err_list_count ++ ;
3684
3700
list_add_tail (& err_node -> node , & err_data -> err_node_list );
3701
+ list_sort (NULL , & err_data -> err_node_list , ras_err_info_cmp );
3685
3702
3686
3703
return & err_node -> err_info ;
3687
3704
}
0 commit comments