* [PATCH] coresight: stm: support marked packet
@ 2020-07-19 6:27 Tingwei Zhang
2020-07-21 17:12 ` Mathieu Poirier
0 siblings, 1 reply; 3+ messages in thread
From: Tingwei Zhang @ 2020-07-19 6:27 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..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;
+ 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] coresight: stm: support marked packet
2020-07-19 6:27 [PATCH] coresight: stm: support marked packet Tingwei Zhang
@ 2020-07-21 17:12 ` Mathieu Poirier
2020-07-21 23:35 ` tingwei
0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Poirier @ 2020-07-21 17:12 UTC (permalink / raw)
To: Tingwei Zhang
Cc: tsoni, Sai Prakash Ranjan, Suzuki K Poulose, Alexander Shishkin,
coresight, Mao Jinlong, linux-arm-kernel
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@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.
Out of curiosity, what kind of use case are you using this for?
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] coresight: stm: support marked packet
2020-07-21 17:12 ` Mathieu Poirier
@ 2020-07-21 23:35 ` tingwei
0 siblings, 0 replies; 3+ messages in thread
From: tingwei @ 2020-07-21 23:35 UTC (permalink / raw)
To: Mathieu Poirier
Cc: tsoni, Sai Prakash Ranjan, Suzuki K Poulose, Alexander Shishkin,
coresight, Mao Jinlong, linux-arm-kernel, linux-arm-kernel
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@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@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
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] 3+ messages in thread
end of thread, other threads:[~2020-07-21 23:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-19 6:27 [PATCH] coresight: stm: support marked packet Tingwei Zhang
2020-07-21 17:12 ` Mathieu Poirier
2020-07-21 23:35 ` tingwei
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).