Re: [Patch v2 1/2] drm/amdgpu: Disable compute partition switch under SRIOV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6/22/2024 9:17 PM, Rajneesh Bhardwaj wrote:
> Do not allow the compute partition mode switch from the guest driver but
> still allow the query for current_compute_partition.
> 
> Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 5 +++++
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 9 ++-------
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 82452606ae6c..1c673c0b65d1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -1292,6 +1292,11 @@ static ssize_t amdgpu_gfx_set_compute_partition(struct device *dev,
>  	enum amdgpu_gfx_partition mode;
>  	int ret = 0, num_xcc;
>  
> +	/* Under SRIOV, this is allowed only via the host driver but not from
> +	 * within the VF */
> +	if (amdgpu_sriov_vf(adev))
> +		return -EPERM;
> +

This is not the way to do this. It needs to disable switch partition
callback in xcp_mgr for VF mode. That's the one which will be checked
for making the sysfs node read/write vs read-only.

Thanks,
Lijo
>  	num_xcc = NUM_XCC(adev->gfx.xcc_mask);
>  	if (num_xcc % 2 != 0)
>  		return -EINVAL;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> index 8d8763ebe027..f87dc1b9d77c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
> @@ -936,11 +936,7 @@ static int gfx_v9_4_3_sw_init(void *handle)
>  	if (r)
>  		return r;
>  
> -
> -	if (!amdgpu_sriov_vf(adev))
> -		r = amdgpu_gfx_sysfs_init(adev);
> -
> -	return r;
> +	return amdgpu_gfx_sysfs_init(adev);
>  }
>  
>  static int gfx_v9_4_3_sw_fini(void *handle)
> @@ -961,8 +957,7 @@ static int gfx_v9_4_3_sw_fini(void *handle)
>  	gfx_v9_4_3_mec_fini(adev);
>  	amdgpu_bo_unref(&adev->gfx.rlc.clear_state_obj);
>  	gfx_v9_4_3_free_microcode(adev);
> -	if (!amdgpu_sriov_vf(adev))
> -		amdgpu_gfx_sysfs_fini(adev);
> +	amdgpu_gfx_sysfs_fini(adev);
>  
>  	return 0;
>  }



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux