diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 17 | 
1 files changed, 14 insertions, 3 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c index d175e862f222..565a1fa436d4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c @@ -239,8 +239,13 @@ static int amdgpu_xcp_dev_alloc(struct amdgpu_device *adev)  	for (i = 1; i < MAX_XCP; i++) {  		ret = amdgpu_xcp_drm_dev_alloc(&p_ddev); -		if (ret) +		if (ret == -ENOSPC) { +			dev_warn(adev->dev, +			"Skip xcp node #%d when out of drm node resource.", i); +			return 0; +		} else if (ret) {  			return ret; +		}  		/* Redirect all IOCTLs to the primary device */  		adev->xcp_mgr->xcp[i].rdev = p_ddev->render->dev; @@ -328,6 +333,9 @@ int amdgpu_xcp_dev_register(struct amdgpu_device *adev,  		return 0;  	for (i = 1; i < MAX_XCP; i++) { +		if (!adev->xcp_mgr->xcp[i].ddev) +			break; +  		ret = drm_dev_register(adev->xcp_mgr->xcp[i].ddev, ent->driver_data);  		if (ret)  			return ret; @@ -345,6 +353,9 @@ void amdgpu_xcp_dev_unplug(struct amdgpu_device *adev)  		return;  	for (i = 1; i < MAX_XCP; i++) { +		if (!adev->xcp_mgr->xcp[i].ddev) +			break; +  		p_ddev = adev->xcp_mgr->xcp[i].ddev;  		drm_dev_unplug(p_ddev);  		p_ddev->render->dev = adev->xcp_mgr->xcp[i].rdev; @@ -363,7 +374,7 @@ int amdgpu_xcp_open_device(struct amdgpu_device *adev,  	if (!adev->xcp_mgr)  		return 0; -	fpriv->xcp_id = ~0; +	fpriv->xcp_id = AMDGPU_XCP_NO_PARTITION;  	for (i = 0; i < MAX_XCP; ++i) {  		if (!adev->xcp_mgr->xcp[i].ddev)  			break; @@ -381,7 +392,7 @@ int amdgpu_xcp_open_device(struct amdgpu_device *adev,  		}  	} -	fpriv->vm.mem_id = fpriv->xcp_id == ~0 ? -1 : +	fpriv->vm.mem_id = fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION ? -1 :  				adev->xcp_mgr->xcp[fpriv->xcp_id].mem_id;  	return 0;  } |