linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] coresight: stm: support marked packet
@ 2020-07-26  2:39 Tingwei Zhang
  2020-08-10 21:59 ` Mathieu Poirier
  0 siblings, 1 reply; 2+ messages in thread
From: Tingwei Zhang @ 2020-07-26  2:39 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose, Alexander Shishkin
  Cc: tsoni, Sai Prakash Ranjan, coresight, Mao Jinlong, Tingwei Zhang,
	linux-arm-kernel

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@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..f1969051a6aa 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,9 @@ 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 |= test_bit(channel, drvdata->chs.guaranteed) ?
 			   STM_FLAG_GUARANTEED : 0;
 
 	if (size > drvdata->write_bytes)
@@ -432,7 +434,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 +446,8 @@ 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);
+		stm_flags |= (flags & STP_PACKET_MARKED) ? STM_FLAG_MARKED : 0;
+		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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] coresight: stm: support marked packet
  2020-07-26  2:39 [PATCH v2] coresight: stm: support marked packet Tingwei Zhang
@ 2020-08-10 21:59 ` Mathieu Poirier
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2020-08-10 21:59 UTC (permalink / raw)
  To: Tingwei Zhang
  Cc: tsoni, Sai Prakash Ranjan, Suzuki K Poulose, Alexander Shishkin,
	coresight, Mao Jinlong, linux-arm-kernel

On Sun, Jul 26, 2020 at 10:39:50AM +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@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..f1969051a6aa 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,9 @@ 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 |= test_bit(channel, drvdata->chs.guaranteed) ?
>  			   STM_FLAG_GUARANTEED : 0;
>  
>  	if (size > drvdata->write_bytes)
> @@ -432,7 +434,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 +446,8 @@ 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);
> +		stm_flags |= (flags & STP_PACKET_MARKED) ? STM_FLAG_MARKED : 0;
> +		ch_addr += stm_channel_off(STM_PKT_TYPE_DATA, stm_flags);

Much better - I have applied this patch to my local tree.  It will be published
next week when 5.9-rc1 is released.

Thanks,
Mathieu

>  		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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-10 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-26  2:39 [PATCH v2] coresight: stm: support marked packet Tingwei Zhang
2020-08-10 21:59 ` Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).