[PATCH 07/12] amdgpu: using IB flags for TMZ or non-TMZ

Huang, Ray Ray.Huang at amd.com
Fri Nov 15 09:39:30 UTC 2019


On Fri, Nov 15, 2019 at 11:34:50AM +0800, Liu, Aaron wrote:
> In kernel, cs->in.flags is used for TMZ. Hence libdrm should transfer 
> the flag to kernel.
> 
> Signed-off-by: Aaron Liu <aaron.liu at amd.com>
> ---
>  amdgpu/amdgpu.h    | 4 +++-
>  amdgpu/amdgpu_cs.c | 4 ++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index f45f9f7..aee3f3d 
> 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -342,7 +342,9 @@ struct amdgpu_cs_fence_info {
>   * \sa amdgpu_cs_submit()
>  */
>  struct amdgpu_cs_request {
> -	/** Specify flags with additional information */
> +	/** Specify flags with additional information
> +	 * 0-normal, 1-tmz
> +	 */
>  	uint64_t flags;
>  
>  	/** Specify HW IP block type to which to send the IB. */ diff --git 
> a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 437c4a4..6f70771 
> 100644
> --- a/amdgpu/amdgpu_cs.c
> +++ b/amdgpu/amdgpu_cs.c
> @@ -254,6 +254,10 @@ static int amdgpu_cs_submit_one(amdgpu_context_handle context,
>  	memset(&cs, 0, sizeof(cs));
>  	cs.in.chunks = (uint64_t)(uintptr_t)chunk_array;
>  	cs.in.ctx_id = context->id;
> +	/* in kernel, _pad is used as flags
> +	 * #define AMDGPU_CS_FLAGS_SECURE          (1 << 0)
> +	 */
> +	cs.in._pad = (uint32_t)ibs_request->flags;

_pad is not good here. Because it's used to pass the flags to input param.

It's better to rename "_pad" in drm_amdgpu_cs_in as "flags" here.

Thanks,
Ray

>  	if (ibs_request->resources)
>  		cs.in.bo_list_handle = ibs_request->resources->handle;
>  	cs.in.num_chunks = ibs_request->number_of_ibs;
> --
> 2.7.4
> 


More information about the amd-gfx mailing list