Skip to content

Commit 0b4d79d

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Assign unique id to compute partition
Assign unique id to compute partition. This is the unique id of the first XCD instance belonging to the partition. Signed-off-by: Lijo Lazar <[email protected]> Reviewed-by: Asad Kamal <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6fa8216 commit 0b4d79d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,25 @@ static void __amdgpu_xcp_add_block(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id,
120120
xcp->valid = true;
121121
}
122122

123+
static void __amdgpu_xcp_set_unique_id(struct amdgpu_xcp_mgr *xcp_mgr,
124+
int xcp_id)
125+
{
126+
struct amdgpu_xcp *xcp = &xcp_mgr->xcp[xcp_id];
127+
struct amdgpu_device *adev = xcp_mgr->adev;
128+
uint32_t inst_mask;
129+
uint64_t uid;
130+
int i;
131+
132+
if (!amdgpu_xcp_get_inst_details(xcp, AMDGPU_XCP_GFX, &inst_mask) &&
133+
inst_mask) {
134+
i = GET_INST(GC, (ffs(inst_mask) - 1));
135+
uid = amdgpu_device_get_uid(xcp_mgr->adev->uid_info,
136+
AMDGPU_UID_TYPE_XCD, i);
137+
if (uid)
138+
xcp->unique_id = uid;
139+
}
140+
}
141+
123142
int amdgpu_xcp_init(struct amdgpu_xcp_mgr *xcp_mgr, int num_xcps, int mode)
124143
{
125144
struct amdgpu_device *adev = xcp_mgr->adev;
@@ -158,6 +177,7 @@ int amdgpu_xcp_init(struct amdgpu_xcp_mgr *xcp_mgr, int num_xcps, int mode)
158177
else
159178
xcp_mgr->xcp[i].mem_id = mem_id;
160179
}
180+
__amdgpu_xcp_set_unique_id(xcp_mgr, i);
161181
}
162182

163183
xcp_mgr->num_xcps = num_xcps;

drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ struct amdgpu_xcp {
112112
struct amdgpu_sched gpu_sched[AMDGPU_HW_IP_NUM][AMDGPU_RING_PRIO_MAX];
113113
struct amdgpu_xcp_mgr *xcp_mgr;
114114
struct kobject kobj;
115+
uint64_t unique_id;
115116
};
116117

117118
struct amdgpu_xcp_mgr {

0 commit comments

Comments
 (0)