Lines Matching full:decoder
23 #include "arm-spe-decoder.h"
83 struct arm_spe_decoder *decoder; in arm_spe_decoder_new() local
88 decoder = zalloc(sizeof(struct arm_spe_decoder)); in arm_spe_decoder_new()
89 if (!decoder) in arm_spe_decoder_new()
92 decoder->get_trace = params->get_trace; in arm_spe_decoder_new()
93 decoder->data = params->data; in arm_spe_decoder_new()
95 return decoder; in arm_spe_decoder_new()
98 void arm_spe_decoder_free(struct arm_spe_decoder *decoder) in arm_spe_decoder_free() argument
100 free(decoder); in arm_spe_decoder_free()
103 static int arm_spe_get_data(struct arm_spe_decoder *decoder) in arm_spe_get_data() argument
109 ret = decoder->get_trace(&buffer, decoder->data); in arm_spe_get_data()
113 decoder->buf = buffer.buf; in arm_spe_get_data()
114 decoder->len = buffer.len; in arm_spe_get_data()
116 if (!decoder->len) in arm_spe_get_data()
119 return decoder->len; in arm_spe_get_data()
122 static int arm_spe_get_next_packet(struct arm_spe_decoder *decoder) in arm_spe_get_next_packet() argument
127 if (!decoder->len) { in arm_spe_get_next_packet()
128 ret = arm_spe_get_data(decoder); in arm_spe_get_next_packet()
135 ret = arm_spe_get_packet(decoder->buf, decoder->len, in arm_spe_get_next_packet()
136 &decoder->packet); in arm_spe_get_next_packet()
139 decoder->buf += 1; in arm_spe_get_next_packet()
140 decoder->len -= 1; in arm_spe_get_next_packet()
144 decoder->buf += ret; in arm_spe_get_next_packet()
145 decoder->len -= ret; in arm_spe_get_next_packet()
146 } while (decoder->packet.type == ARM_SPE_PAD); in arm_spe_get_next_packet()
151 static int arm_spe_read_record(struct arm_spe_decoder *decoder) in arm_spe_read_record() argument
157 memset(&decoder->record, 0x0, sizeof(decoder->record)); in arm_spe_read_record()
158 decoder->record.context_id = (u64)-1; in arm_spe_read_record()
161 err = arm_spe_get_next_packet(decoder); in arm_spe_read_record()
165 idx = decoder->packet.index; in arm_spe_read_record()
166 payload = decoder->packet.payload; in arm_spe_read_record()
168 switch (decoder->packet.type) { in arm_spe_read_record()
170 decoder->record.timestamp = payload; in arm_spe_read_record()
177 decoder->record.from_ip = ip; in arm_spe_read_record()
179 decoder->record.to_ip = ip; in arm_spe_read_record()
181 decoder->record.virt_addr = ip; in arm_spe_read_record()
183 decoder->record.phys_addr = ip; in arm_spe_read_record()
187 decoder->record.latency = payload; in arm_spe_read_record()
190 decoder->record.context_id = payload; in arm_spe_read_record()
195 decoder->record.op |= ARM_SPE_OP_LDST; in arm_spe_read_record()
197 decoder->record.op |= ARM_SPE_OP_ST; in arm_spe_read_record()
199 decoder->record.op |= ARM_SPE_OP_LD; in arm_spe_read_record()
201 decoder->record.op |= ARM_SPE_OP_SVE_LDST; in arm_spe_read_record()
204 decoder->record.op |= ARM_SPE_OP_OTHER; in arm_spe_read_record()
206 decoder->record.op |= ARM_SPE_OP_SVE_OTHER; in arm_spe_read_record()
209 decoder->record.op |= ARM_SPE_OP_BRANCH_ERET; in arm_spe_read_record()
218 decoder->record.type |= ARM_SPE_L1D_MISS; in arm_spe_read_record()
221 decoder->record.type |= ARM_SPE_L1D_ACCESS; in arm_spe_read_record()
224 decoder->record.type |= ARM_SPE_TLB_MISS; in arm_spe_read_record()
227 decoder->record.type |= ARM_SPE_TLB_ACCESS; in arm_spe_read_record()
230 decoder->record.type |= ARM_SPE_LLC_MISS; in arm_spe_read_record()
233 decoder->record.type |= ARM_SPE_LLC_ACCESS; in arm_spe_read_record()
236 decoder->record.type |= ARM_SPE_REMOTE_ACCESS; in arm_spe_read_record()
239 decoder->record.type |= ARM_SPE_BRANCH_MISS; in arm_spe_read_record()
242 decoder->record.type |= ARM_SPE_SVE_PARTIAL_PRED; in arm_spe_read_record()
245 decoder->record.type |= ARM_SPE_SVE_EMPTY_PRED; in arm_spe_read_record()
249 decoder->record.source = payload; in arm_spe_read_record()
264 int arm_spe_decode(struct arm_spe_decoder *decoder) in arm_spe_decode() argument
266 return arm_spe_read_record(decoder); in arm_spe_decode()