Skip to contentSkip to conversation

coresight: stm: support marked packet

PATCH Superseded Tingwei Zhang 2 participants 3 messages Jul 19, 2020 – Jul 21, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 coresight: stm: support marked packet

STP_PACKET_MARKED is not supported by STM currently. Add STM_FLAG_MARKED to support marked packet in STM.

---
 drivers/hwtracing/coresight/coresight-stm.c | 11 +++++++----
 include/uapi/linux/coresight-stm.h          |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/hwtracing/coresight/coresight-stm.c +7 -4
index b908ca104645..36fb1838b1d1 100644
@@ -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;
include/uapi/linux/coresight-stm.h +1 -0
index 8847dbf24151..7ff3709c01b8 100644
@@ -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)
 
 /*
Signature · 8 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

Hi Tingwei,

Quoted 22 lines · Tingwei Zhang

STP_PACKET_MARKED is not supported by STM currently. Add STM_FLAG_MARKED to support marked packet in STM.

---
 drivers/hwtracing/coresight/coresight-stm.c | 11 +++++++----
 include/uapi/linux/coresight-stm.h          |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/hwtracing/coresight/coresight-stm.c +1 -0
index b908ca104645..36fb1838b1d1 100644
@@ -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;

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct stm_data *stm_data, · line 427

Quoted 8 lines
drivers/hwtracing/coresight/coresight-stm.c +3 -2
@@ -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

Quoted 38 lines
drivers/hwtracing/coresight/coresight-stm.c +3 -2
+	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;
include/uapi/linux/coresight-stm.h +1 -0
index 8847dbf24151..7ff3709c01b8 100644
@@ -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)
 
 /*
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

Hi Mathieu,

Quoted 34 lines · Mathieu Poirier

Hi Tingwei,

Review

Quoted 10 lines · Tingwei Zhang

STP_PACKET_MARKED is not supported by STM currently. Add STM_FLAG_MARKED to support marked packet in STM.

---
 drivers/hwtracing/coresight/coresight-stm.c | 11 +++++++----
 include/uapi/linux/coresight-stm.h          |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/hwtracing/coresight/coresight-stm.c

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct

Quoted 4 lines

index b908ca104645..36fb1838b1d1 100644

drivers/hwtracing/coresight/coresight-stm.c +0 -0
@@ -412,6 +412,7 @@ static ssize_t notrace stm_generic_packet(struct

stm_data *stm_data,

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,

Quoted 3 lines
drivers/hwtracing/coresight/coresight-stm.c +0 -0
 	void __iomem *ch_addr;
 	struct stm_drvdata *drvdata = container_of(stm_data,
 						   struct stm_drvdata,

stm);

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct

Quoted 5 lines
drivers/hwtracing/coresight/coresight-stm.c +1 -0
+	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,

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,

Quoted 4 lines
drivers/hwtracing/coresight/coresight-stm.c +0 -1
 	ch_addr = stm_channel_addr(drvdata, channel);
 
-	flags = (flags == STP_PACKET_TIMESTAMPED) ? STM_FLAG_TIMESTAMPED :

0;

Quoted 10 lines

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct stm_data *stm_data, · line 427

Quoted 4 lines
drivers/hwtracing/coresight/coresight-stm.c +3 -1
-	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.

Quoted 2 lines

Out of curiosity, what kind of use case are you using this for?

It's required for MIPI OST protocol.

Thanks,
Tingwei

Quoted 45 lines

Thanks,
Mathieu

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct

Quoted 5 lines
drivers/hwtracing/coresight/coresight-stm.c +1 -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,

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,

Quoted 8 lines
drivers/hwtracing/coresight/coresight-stm.c +1 -1
 	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.

drivers/hwtracing/coresight/coresight-stm.c static ssize_t notrace stm_generic_packet(struct

Quoted 1 line
drivers/hwtracing/coresight/coresight-stm.c +0 -0
@@ -444,7 +447,7 @@ static ssize_t notrace stm_generic_packet(struct

stm_data *stm_data,

Review

Quoted 9 lines
drivers/hwtracing/coresight/coresight-stm.c +1 -1
 		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;
(quoted diff) +0 -0

b/include/uapi/linux/coresight-stm.h

Quoted 12 lines

index 8847dbf24151..7ff3709c01b8 100644

include/uapi/linux/coresight-stm.h +1 -1
@@ -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)
 
 /*
--
Quoted 1 line

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora

Forum,

Quoted 7 lines
Quoted 2 lines

a Linux Foundation Collaborative Project

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel