Commit f33a8770 authored by Andrey Grodzovsky's avatar Andrey Grodzovsky Committed by Alex Deucher

drm/amdgpu: Add task barrier to XGMI hive.

Signed-off-by: default avatarAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: default avatarLe Ma <Le.Ma@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 368fd0aa
...@@ -261,6 +261,7 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo ...@@ -261,6 +261,7 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo
INIT_LIST_HEAD(&tmp->device_list); INIT_LIST_HEAD(&tmp->device_list);
mutex_init(&tmp->hive_lock); mutex_init(&tmp->hive_lock);
mutex_init(&tmp->reset_lock); mutex_init(&tmp->reset_lock);
task_barrier_init(&tmp->tb);
if (lock) if (lock)
mutex_lock(&tmp->hive_lock); mutex_lock(&tmp->hive_lock);
...@@ -408,6 +409,8 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) ...@@ -408,6 +409,8 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
top_info->num_nodes = count; top_info->num_nodes = count;
hive->number_devices = count; hive->number_devices = count;
task_barrier_add_task(&hive->tb);
if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP)) { if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP)) {
list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) { list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {
/* update node list for other device in the hive */ /* update node list for other device in the hive */
...@@ -470,6 +473,7 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev) ...@@ -470,6 +473,7 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)
mutex_destroy(&hive->hive_lock); mutex_destroy(&hive->hive_lock);
mutex_destroy(&hive->reset_lock); mutex_destroy(&hive->reset_lock);
} else { } else {
task_barrier_rem_task(&hive->tb);
amdgpu_xgmi_sysfs_rem_dev_info(adev, hive); amdgpu_xgmi_sysfs_rem_dev_info(adev, hive);
mutex_unlock(&hive->hive_lock); mutex_unlock(&hive->hive_lock);
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#ifndef __AMDGPU_XGMI_H__ #ifndef __AMDGPU_XGMI_H__
#define __AMDGPU_XGMI_H__ #define __AMDGPU_XGMI_H__
#include <drm/task_barrier.h>
#include "amdgpu_psp.h" #include "amdgpu_psp.h"
struct amdgpu_hive_info { struct amdgpu_hive_info {
...@@ -33,6 +34,7 @@ struct amdgpu_hive_info { ...@@ -33,6 +34,7 @@ struct amdgpu_hive_info {
struct device_attribute dev_attr; struct device_attribute dev_attr;
struct amdgpu_device *adev; struct amdgpu_device *adev;
int pstate; /*0 -- low , 1 -- high , -1 unknown*/ int pstate; /*0 -- low , 1 -- high , -1 unknown*/
struct task_barrier tb;
}; };
struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lock); struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment