Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * arm_spe_decoder.h: Arm Statistical Profiling Extensions support
4 * Copyright (c) 2019-2020, Arm Ltd.
5 */
6
7#ifndef INCLUDE__ARM_SPE_DECODER_H__
8#define INCLUDE__ARM_SPE_DECODER_H__
9
10#include <stdbool.h>
11#include <stddef.h>
12#include <stdint.h>
13
14#include "arm-spe-pkt-decoder.h"
15
16enum arm_spe_sample_type {
17 ARM_SPE_L1D_ACCESS = 1 << 0,
18 ARM_SPE_L1D_MISS = 1 << 1,
19 ARM_SPE_LLC_ACCESS = 1 << 2,
20 ARM_SPE_LLC_MISS = 1 << 3,
21 ARM_SPE_TLB_ACCESS = 1 << 4,
22 ARM_SPE_TLB_MISS = 1 << 5,
23 ARM_SPE_BRANCH_MISS = 1 << 6,
24 ARM_SPE_REMOTE_ACCESS = 1 << 7,
25};
26
27struct arm_spe_record {
28 enum arm_spe_sample_type type;
29 int err;
30 u64 from_ip;
31 u64 to_ip;
32 u64 timestamp;
33};
34
35struct arm_spe_insn;
36
37struct arm_spe_buffer {
38 const unsigned char *buf;
39 size_t len;
40 u64 offset;
41 u64 trace_nr;
42};
43
44struct arm_spe_params {
45 int (*get_trace)(struct arm_spe_buffer *buffer, void *data);
46 void *data;
47};
48
49struct arm_spe_decoder {
50 int (*get_trace)(struct arm_spe_buffer *buffer, void *data);
51 void *data;
52 struct arm_spe_record record;
53
54 const unsigned char *buf;
55 size_t len;
56
57 struct arm_spe_pkt packet;
58};
59
60struct arm_spe_decoder *arm_spe_decoder_new(struct arm_spe_params *params);
61void arm_spe_decoder_free(struct arm_spe_decoder *decoder);
62
63int arm_spe_decode(struct arm_spe_decoder *decoder);
64
65#endif