[PATCH] drm/xe/guc: Return CTB response length

Michal Wajdeczko michal.wajdeczko at intel.com
Thu Jan 11 17:07:12 UTC 2024



On 11.01.2024 17:40, Matthew Brost wrote:
> On Thu, Jan 11, 2024 at 04:27:24PM +0100, Michal Wajdeczko wrote:
>> Not all CTB responses from the GuC are fixed size and we need to
>> pass response length to the caller, if there was a response_buffer.
>> Easiest solution is to return it as positive value from all
>> xe_guc_ct_send_recv() functions.  The CTB response length is always
>> between 1 and 254 (ie. GUC_HXG_MSG_MIN_LEN and GUC_CTB_MAX_DWORDS
>> - GUC_HXG_MSG_MIN_LEN).
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
>> Cc: Matthew Brost <matthew.brost at intel.com>
> 
> I has purposed a different usage of the return value [1].
> 
> Perhaps we just have response len as a pass by ref argument?

no need for additional argument, we can still return data0 if there was
no response_buffer provided, and I also have patch for this, but didn't
send right now as it conflicts with our already in-flight HXG changes.

Michal

> 
> Matt
> 
> [1] https://patchwork.freedesktop.org/patch/541762/?series=119096&rev=1
> 
>> ---
>>  drivers/gpu/drm/xe/xe_guc_ct.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
>> index c29f095aa1b9..d490a4d42c01 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
>> @@ -780,7 +780,7 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
>>  		ret = -EIO;
>>  	}
>>  
>> -	return ret > 0 ? 0 : ret;
>> +	return ret > 0 ? response_buffer ? g2h_fence.response_len : 0 : ret;
>>  }
>>  
>>  int xe_guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
>>
>> base-commit: 79184e72263e91528195db01783148435c7e4fad
>> -- 
>> 2.25.1
>>


More information about the Intel-xe mailing list