]> Git Repo - linux.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
Merge tag 'kvm-x86-hyperv-6.8' of https://github.com/kvm-x86/linux into HEAD
[linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ras.c
index 84e5987b14e05ecd2c52c9d93635f4d182a34a5f..63fb4cd85e53b71c106daa9a5e3179da6cc42b1c 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/reboot.h>
 #include <linux/syscalls.h>
 #include <linux/pm_runtime.h>
+#include <linux/list_sort.h>
 
 #include "amdgpu.h"
 #include "amdgpu_ras.h"
@@ -1188,7 +1189,7 @@ static int amdgpu_ras_query_error_status_helper(struct amdgpu_device *adev,
                        }
 
                        if (block_obj->hw_ops->query_ras_error_count)
-                               block_obj->hw_ops->query_ras_error_count(adev, &err_data);
+                               block_obj->hw_ops->query_ras_error_count(adev, err_data);
 
                        if ((info->head.block == AMDGPU_RAS_BLOCK__SDMA) ||
                            (info->head.block == AMDGPU_RAS_BLOCK__GFX) ||
@@ -3665,6 +3666,21 @@ static struct ras_err_node *amdgpu_ras_error_node_new(void)
        return err_node;
 }
 
+static int ras_err_info_cmp(void *priv, const struct list_head *a, const struct list_head *b)
+{
+       struct ras_err_node *nodea = container_of(a, struct ras_err_node, node);
+       struct ras_err_node *nodeb = container_of(b, struct ras_err_node, node);
+       struct amdgpu_smuio_mcm_config_info *infoa = &nodea->err_info.mcm_info;
+       struct amdgpu_smuio_mcm_config_info *infob = &nodeb->err_info.mcm_info;
+
+       if (unlikely(infoa->socket_id != infob->socket_id))
+               return infoa->socket_id - infob->socket_id;
+       else
+               return infoa->die_id - infob->die_id;
+
+       return 0;
+}
+
 static struct ras_err_info *amdgpu_ras_error_get_info(struct ras_err_data *err_data,
                                                      struct amdgpu_smuio_mcm_config_info *mcm_info)
 {
@@ -3682,6 +3698,7 @@ static struct ras_err_info *amdgpu_ras_error_get_info(struct ras_err_data *err_d
 
        err_data->err_list_count++;
        list_add_tail(&err_node->node, &err_data->err_node_list);
+       list_sort(NULL, &err_data->err_node_list, ras_err_info_cmp);
 
        return &err_node->err_info;
 }
This page took 0.038153 seconds and 4 git commands to generate.