*/
 #include <linux/list.h>
 #include "amdgpu.h"
-#include "amdgpu_psp.h"
 #include "amdgpu_xgmi.h"
 
 
 #define AMDGPU_MAX_XGMI_HIVE                   8
 #define AMDGPU_MAX_XGMI_DEVICE_PER_HIVE                4
 
-struct amdgpu_hive_info {
-       uint64_t                hive_id;
-       struct list_head        device_list;
-       struct psp_xgmi_topology_info   topology_info;
-       int number_devices;
-};
-
 static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE];
 static unsigned hive_count = 0;
 
+
+void *amdgpu_xgmi_hive_try_lock(struct amdgpu_hive_info *hive)
+{
+       return &hive->device_list;
+}
+
 struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
 {
        int i;
        tmp = &xgmi_hives[hive_count++];
        tmp->hive_id = adev->gmc.xgmi.hive_id;
        INIT_LIST_HEAD(&tmp->device_list);
+       mutex_init(&tmp->hive_lock);
+
        return tmp;
 }
 
 
 #ifndef __AMDGPU_XGMI_H__
 #define __AMDGPU_XGMI_H__
 
-/*
- * functions used by amdgpu_xgmi.c
- */
+#include "amdgpu_psp.h"
 
-struct amdgpu_device;
-struct amdgpu_hive_info;
+struct amdgpu_hive_info {
+       uint64_t                hive_id;
+       struct list_head        device_list;
+       struct psp_xgmi_topology_info   topology_info;
+       int number_devices;
+       struct mutex hive_lock;
+};
 
 struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev);
 int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_device *adev);