mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
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>
This commit is contained in:
parent
5183411b56
commit
ed2bf5229c
2 changed files with 16 additions and 13 deletions
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
#include "amdgpu_psp.h"
|
|
||||||
#include "amdgpu_xgmi.h"
|
#include "amdgpu_xgmi.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,16 +31,15 @@ static DEFINE_MUTEX(xgmi_mutex);
|
||||||
#define AMDGPU_MAX_XGMI_HIVE 8
|
#define AMDGPU_MAX_XGMI_HIVE 8
|
||||||
#define AMDGPU_MAX_XGMI_DEVICE_PER_HIVE 4
|
#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 struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE];
|
||||||
static unsigned hive_count = 0;
|
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)
|
struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -61,6 +59,8 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
|
||||||
tmp = &xgmi_hives[hive_count++];
|
tmp = &xgmi_hives[hive_count++];
|
||||||
tmp->hive_id = adev->gmc.xgmi.hive_id;
|
tmp->hive_id = adev->gmc.xgmi.hive_id;
|
||||||
INIT_LIST_HEAD(&tmp->device_list);
|
INIT_LIST_HEAD(&tmp->device_list);
|
||||||
|
mutex_init(&tmp->hive_lock);
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,15 @@
|
||||||
#ifndef __AMDGPU_XGMI_H__
|
#ifndef __AMDGPU_XGMI_H__
|
||||||
#define __AMDGPU_XGMI_H__
|
#define __AMDGPU_XGMI_H__
|
||||||
|
|
||||||
/*
|
#include "amdgpu_psp.h"
|
||||||
* functions used by amdgpu_xgmi.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
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);
|
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);
|
int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_device *adev);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue