2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2019 Alex Richardson
6 * This software was developed by SRI International and the University of
7 * Cambridge Computer Laboratory (Department of Computer Science and
8 * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
9 * DARPA SSITH research programme.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #ifndef _DEV_HWPMC_HWPMC_BERI_H_
36 #define _DEV_HWPMC_HWPMC_BERI_H_
38 #define STATCOUNTER_ITEM(name, X, Y) \
39 static inline uint64_t statcounters_get_##name##_count(void) \
43 ".word (0x1f << 26) | (0x0 << 21) | \
44 (12 << 16) | ("#X" << 11) | \
45 ( "#Y" << 6) | 0x3b\n\t" \
46 "move %0,$12" : "=r" (ret) :: "$12"); \
50 STATCOUNTER_ITEM(cycle,2,0)
51 STATCOUNTER_ITEM(inst,4,0)
52 STATCOUNTER_ITEM(inst_user,4,1)
53 STATCOUNTER_ITEM(inst_kernel,4,2)
54 STATCOUNTER_ITEM(imprecise_setbounds,4,3)
55 STATCOUNTER_ITEM(unrepresentable_caps,4,4)
56 STATCOUNTER_ITEM(itlb_miss,5,0)
57 STATCOUNTER_ITEM(dtlb_miss,6,0)
58 STATCOUNTER_ITEM(icache_write_hit,8,0)
59 STATCOUNTER_ITEM(icache_write_miss,8,1)
60 STATCOUNTER_ITEM(icache_read_hit,8,2)
61 STATCOUNTER_ITEM(icache_read_miss,8,3)
62 STATCOUNTER_ITEM(icache_evict,8,6)
63 STATCOUNTER_ITEM(dcache_write_hit,9,0)
64 STATCOUNTER_ITEM(dcache_write_miss,9,1)
65 STATCOUNTER_ITEM(dcache_read_hit,9,2)
66 STATCOUNTER_ITEM(dcache_read_miss,9,3)
67 STATCOUNTER_ITEM(dcache_evict,9,6)
68 STATCOUNTER_ITEM(dcache_set_tag_write,9,8)
69 STATCOUNTER_ITEM(dcache_set_tag_read,9,9)
70 STATCOUNTER_ITEM(l2cache_write_hit,10,0)
71 STATCOUNTER_ITEM(l2cache_write_miss,10,1)
72 STATCOUNTER_ITEM(l2cache_read_hit,10,2)
73 STATCOUNTER_ITEM(l2cache_read_miss,10,3)
74 STATCOUNTER_ITEM(l2cache_evict,10,6)
75 STATCOUNTER_ITEM(l2cache_set_tag_write,10,8)
76 STATCOUNTER_ITEM(l2cache_set_tag_read,10,9)
77 STATCOUNTER_ITEM(mem_byte_read,11,0)
78 STATCOUNTER_ITEM(mem_byte_write,11,1)
79 STATCOUNTER_ITEM(mem_hword_read,11,2)
80 STATCOUNTER_ITEM(mem_hword_write,11,3)
81 STATCOUNTER_ITEM(mem_word_read,11,4)
82 STATCOUNTER_ITEM(mem_word_write,11,5)
83 STATCOUNTER_ITEM(mem_dword_read,11,6)
84 STATCOUNTER_ITEM(mem_dword_write,11,7)
85 STATCOUNTER_ITEM(mem_cap_read,11,8)
86 STATCOUNTER_ITEM(mem_cap_write,11,9)
87 STATCOUNTER_ITEM(mem_cap_read_tag_set,11,10)
88 STATCOUNTER_ITEM(mem_cap_write_tag_set,11,11)
89 STATCOUNTER_ITEM(tagcache_write_hit,12,0)
90 STATCOUNTER_ITEM(tagcache_write_miss,12,1)
91 STATCOUNTER_ITEM(tagcache_read_hit,12,2)
92 STATCOUNTER_ITEM(tagcache_read_miss,12,3)
93 STATCOUNTER_ITEM(tagcache_evict,12,6)
94 STATCOUNTER_ITEM(l2cachemaster_read_req,13,0)
95 STATCOUNTER_ITEM(l2cachemaster_write_req,13,1)
96 STATCOUNTER_ITEM(l2cachemaster_write_req_flit,13,2)
97 STATCOUNTER_ITEM(l2cachemaster_read_rsp,13,3)
98 STATCOUNTER_ITEM(l2cachemaster_read_rsp_flit,13,4)
99 STATCOUNTER_ITEM(l2cachemaster_write_rsp,13,5)
100 STATCOUNTER_ITEM(tagcachemaster_read_req,14,0)
101 STATCOUNTER_ITEM(tagcachemaster_write_req,14,1)
102 STATCOUNTER_ITEM(tagcachemaster_write_req_flit,14,2)
103 STATCOUNTER_ITEM(tagcachemaster_read_rsp,14,3)
104 STATCOUNTER_ITEM(tagcachemaster_read_rsp_flit,14,4)
105 STATCOUNTER_ITEM(tagcachemaster_write_rsp,14,5)
107 #endif /* !_DEV_HWPMC_HWPMC_BERI_H_ */