aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
diff options
context:
space:
mode:
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>2018-11-14 15:50:05 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-11-28 15:55:36 -0500
commited2bf5229c53f20cfbca7a34fcbafa91c3168e1e (patch)
tree7af9e39d1847570e71d23a053b7bf1389a8ce9ac /drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
parent5183411b56bde159e5c3172fcb8904f8421c2c38 (diff)
drm/amdgpu: Expose hive adev list and xgmi_mutex
It's needed for device reset of entire hive. v3: Add per hive lock to allow avoiding duplicate resets triggered by multiple members of same hive. Expose amdgpu_hive_info instead of adding getter functions. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index 59e667a8f01b..fb37e69f1bba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -23,7 +23,6 @@
23 */ 23 */
24#include <linux/list.h> 24#include <linux/list.h>
25#include "amdgpu.h" 25#include "amdgpu.h"
26#include "amdgpu_psp.h"
27#include "amdgpu_xgmi.h" 26#include "amdgpu_xgmi.h"
28 27
29 28
@@ -32,16 +31,15 @@ static DEFINE_MUTEX(xgmi_mutex);
32#define AMDGPU_MAX_XGMI_HIVE 8 31#define AMDGPU_MAX_XGMI_HIVE 8
33#define AMDGPU_MAX_XGMI_DEVICE_PER_HIVE 4 32#define AMDGPU_MAX_XGMI_DEVICE_PER_HIVE 4
34 33
35struct amdgpu_hive_info {
36 uint64_t hive_id;
37 struct list_head device_list;
38 struct psp_xgmi_topology_info topology_info;
39 int number_devices;
40};
41
42static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE]; 34static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE];
43static unsigned hive_count = 0; 35static unsigned hive_count = 0;
44 36
37
38void *amdgpu_xgmi_hive_try_lock(struct amdgpu_hive_info *hive)
39{
40 return &hive->device_list;
41}
42
45struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev) 43struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
46{ 44{
47 int i; 45 int i;
@@ -61,6 +59,8 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
61 tmp = &xgmi_hives[hive_count++]; 59 tmp = &xgmi_hives[hive_count++];
62 tmp->hive_id = adev->gmc.xgmi.hive_id; 60 tmp->hive_id = adev->gmc.xgmi.hive_id;
63 INIT_LIST_HEAD(&tmp->device_list); 61 INIT_LIST_HEAD(&tmp->device_list);
62 mutex_init(&tmp->hive_lock);
63
64 return tmp; 64 return tmp;
65} 65}
66 66