diff options
| author | Lijo Lazar <lijo.lazar@amd.com> | 2023-02-03 18:46:40 +0530 | 
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2023-06-09 09:57:14 -0400 | 
| commit | e47947abb9e71176ea2d9c8f55e03134dabd2605 (patch) | |
| tree | e9b903ca8dfe2c80dc128737385ab212cf23aec3 /drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | |
| parent | 15e3eee8d3939d1f28cd314a5db2590ab94109d6 (diff) | |
drm/amdgpu: Move initialization of xcp before kfd
After partition switch, fill all relevant xcp information before kfd
starts initialization.
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 16 | 
1 files changed, 7 insertions, 9 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c index e1d3727036a1..bca226cc4e0b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c @@ -113,12 +113,17 @@ static void __amdgpu_xcp_add_block(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id,  	xcp->valid = true;  } -static int __amdgpu_xcp_init(struct amdgpu_xcp_mgr *xcp_mgr, int num_xcps) +int amdgpu_xcp_init(struct amdgpu_xcp_mgr *xcp_mgr, int num_xcps, int mode)  {  	struct amdgpu_xcp_ip ip;  	uint8_t mem_id;  	int i, j, ret; +	if (!num_xcps || num_xcps > MAX_XCP) +		return -EINVAL; + +	xcp_mgr->mode = mode; +  	for (i = 0; i < MAX_XCP; ++i)  		xcp_mgr->xcp[i].valid = false; @@ -181,13 +186,6 @@ int amdgpu_xcp_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, int mode)  		goto out;  	} -	if (!num_xcps || num_xcps > MAX_XCP) { -		ret = -EINVAL; -		goto out; -	} - -	xcp_mgr->mode = mode; -	__amdgpu_xcp_init(xcp_mgr, num_xcps);  out:  	mutex_unlock(&xcp_mgr->xcp_lock); @@ -240,7 +238,7 @@ int amdgpu_xcp_mgr_init(struct amdgpu_device *adev, int init_mode,  	mutex_init(&xcp_mgr->xcp_lock);  	if (init_mode != AMDGPU_XCP_MODE_NONE) -		__amdgpu_xcp_init(xcp_mgr, init_num_xcps); +		amdgpu_xcp_init(xcp_mgr, init_num_xcps, init_mode);  	adev->xcp_mgr = xcp_mgr; | 
