[PATCH] coresight: stm: support marked packet

tingwei at codeaurora.org tingwei at codeaurora.org
Tue Jul 21 19:35:26 EDT 2020


Hi Mathieu,

On 2020-07-22 01:12, Mathieu Poirier wrote:
> Hi Tingwei,
> 
> On Sun, Jul 19, 2020 at 02:27:12PM +0800, Tingwei Zhang wrote:
>> STP_PACKET_MARKED is not supported by STM currently.
>> Add STM_FLAG_MARKED to support marked packet in STM.
>> 
>> Signed-off-by: Tingwei Zhang <tingwei at codeaurora.org>
>> ---
>>  drivers/hwtracing/coresight/coresight-stm.c | 11 +++++++----
>>  include/uapi/linux/coresight-stm.h          |  1 +
>>  2 files changed, 8 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/hwtracing/coresight/coresight-stm.c
> b/drivers/hwtracing/coresight/coresight-stm.c
>> index b908ca104645..36fb1838b1d1 100644
>> --- a/drivers/hwtracing/coresight/coresight-stm.c
>> +++ b/drivers/hwtracing/coresight/coresight-stm.c
>> @@ -412,6 +412,7 @@ static ssize_t notrace stm_generic_packet(struct
> stm_data *stm_data,
>>  	void __iomem *ch_addr;
>>  	struct stm_drvdata *drvdata = container_of(stm_data,
>>  						   struct stm_drvdata,
> stm);
>> +	unsigned int stm_flags;
>> 
>>  	if (!(drvdata && local_read(&drvdata->mode)))
>>  		return -EACCES;
>> @@ -421,8 +422,10 @@ static ssize_t notrace stm_generic_packet(struct
> stm_data *stm_data,
>> 
>>  	ch_addr = stm_channel_addr(drvdata, channel);
>> 
>> -	flags = (flags == STP_PACKET_TIMESTAMPED) ? STM_FLAG_TIMESTAMPED :
> 0;
>> -	flags |= test_bit(channel, drvdata->chs.guaranteed) ?
>> +	stm_flags = (flags & STP_PACKET_TIMESTAMPED) ?
>> +			STM_FLAG_TIMESTAMPED : 0;
>> +	stm_flags |= (flags & STP_PACKET_MARKED) ? STM_FLAG_MARKED : 0;
> 
> Looking at the STM programmer's manual there is a marked area for data
> packets
> only.  Clearing the marked bit for non-data access ends up in a 
> reserved
> area
> and yet here it is set invariably.

Thanks.  I'll fix that by set marked flag for data packet only.
> 
> Out of curiosity, what kind of use case are you using this for?
It's required for MIPI OST protocol.

Thanks,
Tingwei

> 
> Thanks,
> Mathieu
> 
>> +	stm_flags |= test_bit(channel, drvdata->chs.guaranteed) ?
>>  			   STM_FLAG_GUARANTEED : 0;
>> 
>>  	if (size > drvdata->write_bytes)
>> @@ -432,7 +435,7 @@ static ssize_t notrace stm_generic_packet(struct
> stm_data *stm_data,
>> 
>>  	switch (packet) {
>>  	case STP_PACKET_FLAG:
>> -		ch_addr += stm_channel_off(STM_PKT_TYPE_FLAG, flags);
>> +		ch_addr += stm_channel_off(STM_PKT_TYPE_FLAG, stm_flags);
>> 
>>  		/*
>>  		 * The generic STM core sets a size of '0' on flag
> packets.
>> @@ -444,7 +447,7 @@ static ssize_t notrace stm_generic_packet(struct
> stm_data *stm_data,
>>  		break;
>> 
>>  	case STP_PACKET_DATA:
>> -		ch_addr += stm_channel_off(STM_PKT_TYPE_DATA, flags);
>> +		ch_addr += stm_channel_off(STM_PKT_TYPE_DATA, stm_flags);
>>  		stm_send(ch_addr, payload, size,
>>  				drvdata->write_bytes);
>>  		break;
>> diff --git a/include/uapi/linux/coresight-stm.h
> b/include/uapi/linux/coresight-stm.h
>> index 8847dbf24151..7ff3709c01b8 100644
>> --- a/include/uapi/linux/coresight-stm.h
>> +++ b/include/uapi/linux/coresight-stm.h
>> @@ -5,6 +5,7 @@
>>  #include <linux/const.h>
>> 
>>  #define STM_FLAG_TIMESTAMPED   _BITUL(3)
>> +#define STM_FLAG_MARKED        _BITUL(4)
>>  #define STM_FLAG_GUARANTEED    _BITUL(7)
>> 
>>  /*
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum,
>> a Linux Foundation Collaborative Project
>> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



More information about the linux-arm-kernel mailing list