Skip to content

Commit 07cf835

Browse files
miklelappogregkh
authored andcommitted
stm class: Add source type
Currently kernel HW tracing infrastrtucture and specifically its SyS-T part treats all source data in the same way. Treating and encoding different trace data sources differently might allow decoding software to make use of e.g. ftrace event ids by converting them to a SyS-T message catalog. The solution is to keep source type stored within stm_source_data structure to allow different handling by stm output/protocol. Currently we only differentiate between STM_USER and STM_FTRACE sources. Signed-off-by: Mikhail Lappo <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3df4638 commit 07cf835

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

drivers/hwtracing/stm/console.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static struct stm_console {
2222
.data = {
2323
.name = "console",
2424
.nr_chans = 1,
25+
.type = STM_USER,
2526
.link = stm_console_link,
2627
.unlink = stm_console_unlink,
2728
},

drivers/hwtracing/stm/ftrace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static struct stm_ftrace {
2323
.data = {
2424
.name = "ftrace",
2525
.nr_chans = STM_FTRACE_NR_CHANNELS,
26+
.type = STM_FTRACE,
2627
.link = stm_ftrace_link,
2728
.unlink = stm_ftrace_unlink,
2829
},

drivers/hwtracing/stm/heartbeat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static int stm_heartbeat_init(void)
7878
}
7979

8080
stm_heartbeat[i].data.nr_chans = 1;
81+
stm_heartbeat[i].data.type = STM_USER;
8182
stm_heartbeat[i].data.link = stm_heartbeat_link;
8283
stm_heartbeat[i].data.unlink = stm_heartbeat_unlink;
8384
hrtimer_init(&stm_heartbeat[i].hrtimer, CLOCK_MONOTONIC,

include/linux/stm.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ enum stp_packet_flags {
3030
STP_PACKET_TIMESTAMPED = 0x2,
3131
};
3232

33+
/**
34+
* enum stm_source_type - STM source driver
35+
* @STM_USER: any STM trace source
36+
* @STM_FTRACE: ftrace STM source
37+
*/
38+
enum stm_source_type {
39+
STM_USER,
40+
STM_FTRACE,
41+
};
42+
3343
struct stp_policy;
3444

3545
struct stm_device;
@@ -106,6 +116,7 @@ struct stm_source_device;
106116
* @name: device name, will be used for policy lookup
107117
* @src: internal structure, only used by stm class code
108118
* @nr_chans: number of channels to allocate
119+
* @type: type of STM source driver represented by stm_source_type
109120
* @link: called when this source gets linked to an STM device
110121
* @unlink: called when this source is about to get unlinked from its STM
111122
*
@@ -117,6 +128,7 @@ struct stm_source_data {
117128
struct stm_source_device *src;
118129
unsigned int percpu;
119130
unsigned int nr_chans;
131+
unsigned int type;
120132
int (*link)(struct stm_source_data *data);
121133
void (*unlink)(struct stm_source_data *data);
122134
};

0 commit comments

Comments
 (0)