gem5 v24.0.0.0
Loading...
Searching...
No Matches
smmu_v3_defs.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013, 2018-2019, 2024 Arm Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef __DEV_ARM_SMMU_V3_DEFS_HH__
39#define __DEV_ARM_SMMU_V3_DEFS_HH__
40
41#include <stdint.h>
42
43#include "base/bitunion.hh"
44
45namespace gem5
46{
47
48enum
49{
50 SMMU_SECURE_SZ = 0x184, // Secure regs are within page0
54};
55
56enum
57{
63};
64
65enum
66{
70};
71
72enum
73{
78};
79
80enum
81{
86};
87
88enum
89{
90 ST_BASE_ADDR_MASK = 0x0000ffffffffffe0ULL,
91 ST_CFG_SIZE_MASK = 0x000000000000003fULL,
92 ST_CFG_SPLIT_MASK = 0x00000000000007c0ULL,
93 ST_CFG_FMT_MASK = 0x0000000000030000ULL,
94 ST_CFG_FMT_LINEAR = 0x0000000000000000ULL,
95 ST_CFG_FMT_2LEVEL = 0x0000000000010000ULL,
96 ST_L2_SPAN_MASK = 0x000000000000001fULL,
97 ST_L2_ADDR_MASK = 0x0000ffffffffffe0ULL,
98
99 VMT_BASE_ADDR_MASK = 0x0000ffffffffffe0ULL,
100 VMT_BASE_SIZE_MASK = 0x000000000000001fULL,
101
102 Q_BASE_ADDR_MASK = 0x0000ffffffffffe0ULL,
103 Q_BASE_SIZE_MASK = 0x000000000000001fULL,
104
105 E_BASE_ADDR_MASK = 0x0000fffffffffffcULL,
106};
107
109 Bitfield<0> s2p;
110 Bitfield<1> s1p;
111 Bitfield<3, 2> ttf;
112 Bitfield<4> cohacc;
113 Bitfield<5> btm;
114 Bitfield<7, 6> httu;
115 Bitfield<8> dormhint;
116 Bitfield<9> hyp;
117 Bitfield<10> ats;
118 Bitfield<11> ns1ats;
119 Bitfield<12> asid16;
120 Bitfield<13> msi;
121 Bitfield<14> sev;
122 Bitfield<15> atos;
123 Bitfield<16> pri;
124 Bitfield<17> vmw;
125 Bitfield<18> vmid16;
126 Bitfield<19> cd2l;
127 Bitfield<20> vatos;
128 Bitfield<22, 21> ttEndian;
129 Bitfield<23> atsRecErr;
130 Bitfield<25, 24> stallModel;
131 Bitfield<26> termModel;
132 Bitfield<28, 27> stLevel;
134
135BitUnion32(IRQCtrl)
136 Bitfield<0> gerrorIrqEn;
137 Bitfield<1> priqIrqEn;
138 Bitfield<2> eventqIrqEn;
140
141union SMMURegs
142{
143 uint8_t data[SMMU_REG_SIZE];
144
145 struct
146 {
147 uint32_t idr0; // 0x0000
148 uint32_t idr1; // 0x0004
149 uint32_t idr2; // 0x0008
150 uint32_t idr3; // 0x000c
151 uint32_t idr4; // 0x0010
152 uint32_t idr5; // 0x0014
153 uint32_t iidr; // 0x0018
154 uint32_t aidr; // 0x001c
155 uint32_t cr0; // 0x0020
156 uint32_t cr0ack; // 0x0024
157 uint32_t cr1; // 0x0028
158 uint32_t cr2; // 0x002c
159 uint32_t _pad1; // 0x0030
160 uint32_t _pad2; // 0x0034
161 uint32_t _pad3; // 0x0038
162 uint32_t _pad4; // 0x003c
163 uint32_t statusr; // 0x0040
164 uint32_t gbpa; // 0x0044
165 uint32_t agbpa; // 0x0048
166 uint32_t _pad5; // 0x004c
167 uint32_t irq_ctrl; // 0x0050
168 uint32_t irq_ctrlack; // 0x0054
169 uint32_t _pad6; // 0x0058
170 uint32_t _pad7; // 0x005c
171
172 uint32_t gerror; // 0x0060
173 uint32_t gerrorn; // 0x0064
174 uint64_t gerror_irq_cfg0; // 0x0068, 64 bit
175 uint32_t gerror_irq_cfg1; // 0x0070
176 uint32_t gerror_irq_cfg2; // 0x0074
177 uint32_t _pad_1; // 0x0078
178 uint32_t _pad_2; // 0x007c
179
180 uint64_t strtab_base; // 0x0080, 64 bit
181 uint32_t strtab_base_cfg; // 0x0088
182
183 uint64_t cmdq_base; // 0x0090, 64 bit
184 uint32_t cmdq_prod; // 0x0098
185 uint32_t cmdq_cons; // 0x009c
186 uint64_t eventq_base; // 0x00a0, 64 bit
187 uint32_t _pad8; // 0x00a8
188 uint32_t _pad9; // 0x00ac
189 uint64_t eventq_irq_cfg0; // 0x00b0, 64 bit
190 uint32_t eventq_irq_cfg1; // 0x00b8
191 uint32_t eventq_irq_cfg2; // 0x00bc
192 uint64_t priq_base; // 0x00c0, 64 bit
193 uint32_t _pad10; // 0x00c8
194 uint32_t _pad11; // 0x00cc
195
196 uint64_t priq_irq_cfg0; // 0x00d0
197 uint32_t priq_irq_cfg1; // 0x00d8
198 uint32_t priq_irq_cfg2; // 0x00dc
199
200 uint32_t _pad12[8]; // 0x00e0 - 0x0100
201 uint32_t gatos_ctrl; // 0x0100
202 uint32_t _pad13; // 0x0104
203 uint64_t gatos_sid; // 0x0108
204 uint64_t gatos_addr; // 0x0110
205 uint64_t gatos_par; // 0x0118
206 uint32_t _pad14[24]; // 0x0120
207 uint32_t vatos_sel; // 0x0180
208
209 uint32_t _pad15[8095]; // 0x184 - 0x7ffc
210
211 uint8_t _secure_regs[SMMU_SECURE_SZ]; // 0x8000 - 0x8180
212
213 uint32_t _pad16[8095]; // 0x8184 - 0x10000
214
215 // Page 1
216 uint32_t _pad17[42]; // 0x10000
217 uint32_t eventq_prod; // 0x100A8
218 uint32_t eventq_cons; // 0x100AC
219
220 uint32_t _pad18[6]; // 0x100B0
221 uint32_t priq_prod; // 0x100C8
222 uint32_t priq_cons; // 0x100CC
223 };
224};
225
227{
229 Bitfield<0> valid;
230 Bitfield<3, 1> config;
231 Bitfield<5, 4> s1fmt;
232 Bitfield<51, 6> s1ctxptr;
233 Bitfield<63, 59> s1cdmax;
235 DWORD0 dw0;
236
238 Bitfield<1, 0> s1dss;
239 Bitfield<3, 2> s1cir;
240 Bitfield<5, 4> s1cor;
241 Bitfield<7, 6> s1csh;
242 Bitfield<8> s2hwu59;
243 Bitfield<9> s2hwu60;
244 Bitfield<10> s2hwu61;
245 Bitfield<11> s2hwu62;
246 Bitfield<12> dre;
247 Bitfield<16, 13> cont;
248 Bitfield<17> dcp;
249 Bitfield<18> ppar;
250 Bitfield<19> mev;
251 Bitfield<27> s1stalld;
252 Bitfield<29, 28> eats;
253 Bitfield<31, 30> strw;
254 Bitfield<35, 32> memattr;
255 Bitfield<36> mtcfg;
256 Bitfield<40, 37> alloccfg;
257 Bitfield<45, 44> shcfg;
258 Bitfield<47, 46> nscfg;
259 Bitfield<49, 48> privcfg;
260 Bitfield<51, 50> instcfg;
262 DWORD1 dw1;
263
265 Bitfield<15, 0> s2vmid;
266 Bitfield<37, 32> s2t0sz;
267 Bitfield<39, 38> s2sl0;
268 Bitfield<41, 40> s2ir0;
269 Bitfield<43, 42> s2or0;
270 Bitfield<45, 44> s2sh0;
271 Bitfield<47, 46> s2tg;
272 Bitfield<50, 48> s2ps;
273 Bitfield<51> s2aa64;
274 Bitfield<52> s2endi;
275 Bitfield<53> s2affd;
276 Bitfield<54> s2ptw;
277 Bitfield<55> s2hd;
278 Bitfield<56> s2ha;
279 Bitfield<57> s2s;
280 Bitfield<58> s2r;
282 DWORD2 dw2;
283
285 Bitfield<51, 4> s2ttb;
287 DWORD3 dw3;
288
289 uint64_t _pad[4];
290};
291
293{
295 Bitfield<5, 0> t0sz;
296 Bitfield<7, 6> tg0;
297 Bitfield<9, 8> ir0;
298 Bitfield<11, 10> or0;
299 Bitfield<13, 12> sh0;
300 Bitfield<14> epd0;
301 Bitfield<15> endi;
302 Bitfield<21, 16> t1sz;
303 Bitfield<23, 22> tg1;
304 Bitfield<25, 24> ir1;
305 Bitfield<27, 26> or1;
306 Bitfield<29, 28> sh1;
307 Bitfield<30> epd1;
308 Bitfield<31> valid;
309 Bitfield<34, 32> ips;
310 Bitfield<35> affd;
311 Bitfield<36> wxn;
312 Bitfield<37> uwxn;
313 Bitfield<39, 38> tbi;
314 Bitfield<40> pan;
315 Bitfield<41> aa64;
316 Bitfield<42> hd;
317 Bitfield<43> ha;
318 Bitfield<44> s;
319 Bitfield<45> r;
320 Bitfield<46> a;
321 Bitfield<47> aset;
322 Bitfield<63, 48> asid;
324 DWORD0 dw0;
325
327 Bitfield<0> nscfg0;
328 Bitfield<1> had0;
329 Bitfield<51, 4> ttb0;
330 Bitfield<60> hwu0g59;
331 Bitfield<61> hwu0g60;
332 Bitfield<62> hwu0g61;
333 Bitfield<63> hwu0g62;
335 DWORD1 dw1;
336
338 Bitfield<0> nscfg1;
339 Bitfield<1> had1;
340 Bitfield<51, 4> ttb1;
341 Bitfield<60> hwu1g59;
342 Bitfield<61> hwu1g60;
343 Bitfield<62> hwu1g61;
344 Bitfield<63> hwu1g62;
346 DWORD2 dw2;
347
348 uint64_t mair;
349 uint64_t amair;
350 uint64_t _pad[3];
351};
352
353enum
354{
361};
362
390
392{
394 Bitfield<7, 0> type;
395 Bitfield<10> ssec;
396 Bitfield<11> ssv;
397 Bitfield<31, 12> ssid;
398 Bitfield<47, 32> vmid;
399 Bitfield<63, 48> asid;
400 Bitfield<63, 32> sid;
402 DWORD0 dw0;
403
405 Bitfield<0> leaf;
406 Bitfield<4, 0> size;
407 Bitfield<4, 0> range;
408 Bitfield<63, 12> address;
410 DWORD1 dw1;
411
412 uint64_t addr() const
413 {
414 uint64_t address = (uint64_t)(dw1.address) << 12;
415 return address;
416 }
417};
418
420{
421 struct Data {
423 Bitfield<7, 0> eventType;
424 Bitfield<11> ssv;
425 Bitfield<31, 12> substreamId;
426 Bitfield<63, 32> streamId;
428 DWORD0 dw0;
429
431 Bitfield<16, 0> stag;
432 Bitfield<33> pnu;
433 Bitfield<34> ind;
434 Bitfield<35> rnw;
435 Bitfield<38> nsipa;
436 Bitfield<39> s2;
437 Bitfield<41, 40> clss;
439 DWORD1 dw1;
440
442 Bitfield<63, 0> inputAddr;
444 DWORD2 dw2;
445
447 Bitfield<51, 3> fetchAddr;
448 Bitfield<51, 12> ipa;
450 DWORD3 dw3;
452
453 std::string print() const;
454};
455
456enum
457{
460
461} // namespace gem5
462
463#endif /* __DEV_ARM_SMMU_V3_DEFS_HH__ */
#define BitUnion32(name)
Definition bitunion.hh:495
const char data[]
#define BitUnion64(name)
Use this to define conveniently sized values overlayed with bitfields.
Definition bitunion.hh:494
#define EndBitUnion(name)
This closes off the class and union started by the above macro.
Definition bitunion.hh:428
Bitfield< 20 > uwxn
Bitfield< 14 > tg0
Bitfield< 40 > hd
Bitfield< 19 > wxn
Bitfield< 34, 32 > ips
Bitfield< 22 > pan
Definition misc_types.hh:59
Bitfield< 18, 16 > t1sz
Bitfield< 4 > s
Bitfield< 23 > epd1
Bitfield< 20 > tbi
Bitfield< 8 > a
Definition misc_types.hh:66
Bitfield< 17, 16 > or0
Bitfield< 39 > ha
Bitfield< 2, 0 > t0sz
Bitfield< 7 > epd0
SignedBitfield< 31, 16 > sh1
Definition int.hh:61
SignedBitfield< 15, 0 > sh0
Definition int.hh:62
Bitfield< 30 > tg1
Bitfield< 19, 18 > or1
Bitfield< 3, 2 > ir1
Bitfield< 3 > msi
Definition misc.hh:1258
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
Bitfield< 1 > s1p
Bitfield< 17 > vmw
@ STE_CONFIG_ABORT
@ STE_CONFIG_STAGE1_ONLY
@ STE_CONFIG_STAGE2_ONLY
@ STE_CONFIG_BYPASS
@ STE_CONFIG_STAGE1_AND_2
@ STAGE1_CFG_2L_4K
@ STAGE1_CFG_1L
@ STAGE1_CFG_2L_64K
Bitfield< 18 > vmid16
@ ST_CFG_FMT_LINEAR
@ VMT_BASE_SIZE_MASK
@ ST_CFG_FMT_2LEVEL
@ ST_CFG_SPLIT_MASK
@ Q_BASE_ADDR_MASK
@ ST_L2_ADDR_MASK
@ Q_BASE_SIZE_MASK
@ ST_BASE_ADDR_MASK
@ ST_CFG_SIZE_MASK
@ ST_L2_SPAN_MASK
@ ST_CFG_FMT_MASK
@ VMT_BASE_ADDR_MASK
@ E_BASE_ADDR_MASK
Bitfield< 15 > atos
@ CR0_EVENTQEN_MASK
@ CR0_ATSCHK_MASK
@ CR0_VMW_MASK
@ CR0_CMDQEN_MASK
@ CR0_SMMUEN_MASK
@ CR0_PRIQEN_MASK
Bitfield< 2 > eventqIrqEn
Bitfield< 22, 21 > ttEndian
Bitfield< 28, 27 > stLevel
Bitfield< 14 > sev
Bitfield< 7, 6 > httu
@ CMD_CFGI_STE
@ CMD_ATC_INV
@ CMD_TLBI_S2_IPA
@ CMD_TLBI_S12_VMALL
@ CMD_TLBI_EL2_VA
@ CMD_TLBI_EL3_ALL
@ CMD_CFGI_STE_RANGE
@ CMD_TLBI_NH_ASID
@ CMD_TLBI_EL2_ASID
@ CMD_TLBI_EL3_VA
@ CMD_TLBI_NH_VA
@ CMD_TLBI_EL2_VAA
@ CMD_CFGI_CD_ALL
@ CMD_PRF_CONFIG
@ CMD_TLBI_EL2_ALL
@ CMD_TLBI_NSNH_ALL
@ CMD_CFGI_CD
@ CMD_TLBI_NH_ALL
@ CMD_PRF_ADDR
@ CMD_STALL_TERM
@ CMD_TLBI_NH_VAA
@ CMD_PRI_RESP
Bitfield< 16 > pri
Bitfield< 25, 24 > stallModel
Bitfield< 10 > ats
@ ST_CFG_SPLIT_SHIFT
@ STE_S2TTB_SHIFT
@ ST_CD_ADDR_SHIFT
@ CD_TTB_SHIFT
@ TRANS_GRANULE_INVALID
@ TRANS_GRANULE_16K
@ TRANS_GRANULE_4K
@ TRANS_GRANULE_64K
Bitfield< 20 > vatos
Bitfield< 19 > cd2l
Bitfield< 5 > btm
Bitfield< 8 > dormhint
@ SMMU_MAX_TRANS_ID
Bitfield< 9 > hyp
Bitfield< 3, 2 > ttf
@ SMMU_SECURE_SZ
@ SMMU_PAGE_ZERO_SZ
@ SMMU_PAGE_ONE_SZ
@ SMMU_REG_SIZE
Bitfield< 11 > ns1ats
Bitfield< 4 > cohacc
Bitfield< 12 > asid16
Bitfield< 1 > priqIrqEn
Bitfield< 23 > atsRecErr
Bitfield< 26 > termModel
Overload hash function for BasicBlockRange type.
Definition binary32.hh:81
BitUnion64(DWORD0) Bitfield< 5
BitUnion64(DWORD0) Bitfield< 7
BitUnion64(DWORD0) Bitfield< 7
Bitfield< 51, 6 > s1ctxptr
Bitfield< 3, 1 > config
Bitfield< 7, 6 > s1csh
Bitfield< 27 > s1stalld
Bitfield< 45, 44 > shcfg
Bitfield< 29, 28 > eats
Bitfield< 5, 4 > s1fmt
Bitfield< 16, 13 > cont
Bitfield< 47, 46 > nscfg
Bitfield< 37, 32 > s2t0sz
BitUnion64(DWORD1) Bitfield< 1
Bitfield< 49, 48 > privcfg
Bitfield< 35, 32 > memattr
Bitfield< 39, 38 > s2sl0
Bitfield< 5, 4 > s1cor
Bitfield< 45, 44 > s2sh0
Bitfield< 47, 46 > s2tg
Bitfield< 51, 50 > instcfg
Bitfield< 3, 2 > s1cir
Bitfield< 31, 30 > strw
Bitfield< 40, 37 > alloccfg
Bitfield< 63, 59 > s1cdmax
EndBitUnion(DWORD0) DWORD0 dw0
Bitfield< 50, 48 > s2ps
Bitfield< 41, 40 > s2ir0
BitUnion64(DWORD0) Bitfield< 0 > valid
Bitfield< 43, 42 > s2or0

Generated on Tue Jun 18 2024 16:24:03 for gem5 by doxygen 1.11.0