gem5  v20.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
smmu_v3_defs.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, 2018-2019 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 
45 enum {
46  SMMU_SECURE_SZ = 0x184, // Secure regs are within page0
47  SMMU_PAGE_ZERO_SZ = 0x10000,
48  SMMU_PAGE_ONE_SZ = 0x10000,
50 };
51 
52 enum {
58 };
59 
60 enum {
64 };
65 
66 enum {
71 };
72 
73 enum {
78 };
79 
80 enum {
81  ST_BASE_ADDR_MASK = 0x0000ffffffffffe0ULL,
82  ST_CFG_SIZE_MASK = 0x000000000000003fULL,
83  ST_CFG_SPLIT_MASK = 0x00000000000007c0ULL,
84  ST_CFG_FMT_MASK = 0x0000000000030000ULL,
85  ST_CFG_FMT_LINEAR = 0x0000000000000000ULL,
86  ST_CFG_FMT_2LEVEL = 0x0000000000010000ULL,
87  ST_L2_SPAN_MASK = 0x000000000000001fULL,
88  ST_L2_ADDR_MASK = 0x0000ffffffffffe0ULL,
89 
90  VMT_BASE_ADDR_MASK = 0x0000ffffffffffe0ULL,
91  VMT_BASE_SIZE_MASK = 0x000000000000001fULL,
92 
93  Q_BASE_ADDR_MASK = 0x0000ffffffffffe0ULL,
94  Q_BASE_SIZE_MASK = 0x000000000000001fULL,
95 
96  E_BASE_ENABLE_MASK = 0x8000000000000000ULL,
97  E_BASE_ADDR_MASK = 0x0000fffffffffffcULL,
98 };
99 
100 union SMMURegs
101 {
102  uint8_t data[SMMU_REG_SIZE];
103 
104  struct
105  {
106  uint32_t idr0; // 0x0000
107  uint32_t idr1; // 0x0004
108  uint32_t idr2; // 0x0008
109  uint32_t idr3; // 0x000c
110  uint32_t idr4; // 0x0010
111  uint32_t idr5; // 0x0014
112  uint32_t iidr; // 0x0018
113  uint32_t aidr; // 0x001c
114  uint32_t cr0; // 0x0020
115  uint32_t cr0ack; // 0x0024
116  uint32_t cr1; // 0x0028
117  uint32_t cr2; // 0x002c
118  uint32_t _pad1; // 0x0030
119  uint32_t _pad2; // 0x0034
120  uint32_t _pad3; // 0x0038
121  uint32_t _pad4; // 0x003c
122  uint32_t statusr; // 0x0040
123  uint32_t gbpa; // 0x0044
124  uint32_t agbpa; // 0x0048
125  uint32_t _pad5; // 0x004c
126  uint32_t irq_ctrl; // 0x0050
127  uint32_t irq_ctrlack; // 0x0054
128  uint32_t _pad6; // 0x0058
129  uint32_t _pad7; // 0x005c
130 
131  uint32_t gerror; // 0x0060
132  uint32_t gerrorn; // 0x0064
133  uint64_t gerror_irq_cfg0; // 0x0068, 64 bit
134  uint32_t gerror_irq_cfg1; // 0x0070
135  uint32_t gerror_irq_cfg2; // 0x0074
136  uint32_t _pad_1; // 0x0078
137  uint32_t _pad_2; // 0x007c
138 
139  uint64_t strtab_base; // 0x0080, 64 bit
140  uint32_t strtab_base_cfg; // 0x0088
141 
142  uint64_t cmdq_base; // 0x0090, 64 bit
143  uint32_t cmdq_prod; // 0x0098
144  uint32_t cmdq_cons; // 0x009c
145  uint64_t eventq_base; // 0x00a0, 64 bit
146  uint32_t _pad8; // 0x00a8
147  uint32_t _pad9; // 0x00ac
148  uint64_t eventq_irq_cfg0; // 0x00b0, 64 bit
149  uint32_t eventq_irq_cfg1; // 0x00b8
150  uint32_t eventq_irq_cfg2; // 0x00bc
151  uint64_t priq_base; // 0x00c0, 64 bit
152  uint32_t _pad10; // 0x00c8
153  uint32_t _pad11; // 0x00cc
154 
155  uint64_t priq_irq_cfg0; // 0x00d0
156  uint32_t priq_irq_cfg1; // 0x00d8
157  uint32_t priq_irq_cfg2; // 0x00dc
158 
159  uint32_t _pad12[8]; // 0x00e0 - 0x0100
160  uint32_t gatos_ctrl; // 0x0100
161  uint32_t _pad13; // 0x0104
162  uint64_t gatos_sid; // 0x0108
163  uint64_t gatos_addr; // 0x0110
164  uint64_t gatos_par; // 0x0118
165  uint32_t _pad14[24]; // 0x0120
166  uint32_t vatos_sel; // 0x0180
167 
168  uint32_t _pad15[8095]; // 0x184 - 0x7ffc
169 
170  uint8_t _secure_regs[SMMU_SECURE_SZ]; // 0x8000 - 0x8180
171 
172  uint32_t _pad16[8095]; // 0x8184 - 0x10000
173 
174  // Page 1
175  uint32_t _pad17[42]; // 0x10000
176  uint32_t eventq_prod; // 0x100A8
177  uint32_t eventq_cons; // 0x100AC
178 
179  uint32_t _pad18[6]; // 0x100B0
180  uint32_t priq_prod; // 0x100C8
181  uint32_t priq_cons; // 0x100CC
182  };
183 };
184 
186 {
187  BitUnion64(DWORD0)
188  Bitfield<0> valid;
189  Bitfield<3, 1> config;
190  Bitfield<5, 4> s1fmt;
191  Bitfield<51, 6> s1ctxptr;
192  Bitfield<63, 59> s1cdmax;
193  EndBitUnion(DWORD0)
194  DWORD0 dw0;
195 
196  BitUnion64(DWORD1)
197  Bitfield<1, 0> s1dss;
198  Bitfield<3, 2> s1cir;
199  Bitfield<5, 4> s1cor;
200  Bitfield<7, 6> s1csh;
201  Bitfield<8> s2hwu59;
202  Bitfield<9> s2hwu60;
203  Bitfield<10> s2hwu61;
204  Bitfield<11> s2hwu62;
205  Bitfield<12> dre;
206  Bitfield<16, 13> cont;
207  Bitfield<17> dcp;
208  Bitfield<18> ppar;
209  Bitfield<19> mev;
210  Bitfield<27> s1stalld;
211  Bitfield<29, 28> eats;
212  Bitfield<31, 30> strw;
213  Bitfield<35, 32> memattr;
214  Bitfield<36> mtcfg;
215  Bitfield<40, 37> alloccfg;
216  Bitfield<45, 44> shcfg;
217  Bitfield<47, 46> nscfg;
218  Bitfield<49, 48> privcfg;
219  Bitfield<51, 50> instcfg;
220  EndBitUnion(DWORD1)
221  DWORD1 dw1;
222 
223  BitUnion64(DWORD2)
224  Bitfield<15, 0> s2vmid;
225  Bitfield<37, 32> s2t0sz;
226  Bitfield<39, 38> s2sl0;
227  Bitfield<41, 40> s2ir0;
228  Bitfield<43, 42> s2or0;
229  Bitfield<45, 44> s2sh0;
230  Bitfield<47, 46> s2tg;
231  Bitfield<50, 48> s2ps;
232  Bitfield<51> s2aa64;
233  Bitfield<52> s2endi;
234  Bitfield<53> s2affd;
235  Bitfield<54> s2ptw;
236  Bitfield<55> s2hd;
237  Bitfield<56> s2ha;
238  Bitfield<57> s2s;
239  Bitfield<58> s2r;
240  EndBitUnion(DWORD2)
241  DWORD2 dw2;
242 
243  BitUnion64(DWORD3)
244  Bitfield<51, 4> s2ttb;
245  EndBitUnion(DWORD3)
246  DWORD3 dw3;
247 
248  uint64_t _pad[4];
249 };
250 
252 {
253  BitUnion64(DWORD0)
254  Bitfield<5, 0> t0sz;
255  Bitfield<7, 6> tg0;
256  Bitfield<9, 8> ir0;
257  Bitfield<11, 10> or0;
258  Bitfield<13, 12> sh0;
259  Bitfield<14> epd0;
260  Bitfield<15> endi;
261  Bitfield<21, 16> t1sz;
262  Bitfield<23, 22> tg1;
263  Bitfield<25, 24> ir1;
264  Bitfield<27, 26> or1;
265  Bitfield<29, 28> sh1;
266  Bitfield<30> epd1;
267  Bitfield<31> valid;
268  Bitfield<34, 32> ips;
269  Bitfield<35> affd;
270  Bitfield<36> wxn;
271  Bitfield<37> uwxn;
272  Bitfield<39, 38> tbi;
273  Bitfield<40> pan;
274  Bitfield<41> aa64;
275  Bitfield<42> hd;
276  Bitfield<43> ha;
277  Bitfield<44> s;
278  Bitfield<45> r;
279  Bitfield<46> a;
280  Bitfield<47> aset;
281  Bitfield<63, 48> asid;
282  EndBitUnion(DWORD0)
283  DWORD0 dw0;
284 
285  BitUnion64(DWORD1)
286  Bitfield<0> nscfg0;
287  Bitfield<1> had0;
288  Bitfield<51, 4> ttb0;
289  Bitfield<60> hwu0g59;
290  Bitfield<61> hwu0g60;
291  Bitfield<62> hwu0g61;
292  Bitfield<63> hwu0g62;
293  EndBitUnion(DWORD1)
294  DWORD1 dw1;
295 
296  BitUnion64(DWORD2)
297  Bitfield<0> nscfg1;
298  Bitfield<1> had1;
299  Bitfield<51, 4> ttb1;
300  Bitfield<60> hwu1g59;
301  Bitfield<61> hwu1g60;
302  Bitfield<62> hwu1g61;
303  Bitfield<63> hwu1g62;
304  EndBitUnion(DWORD2)
305  DWORD2 dw2;
306 
307  uint64_t mair;
308  uint64_t amair;
309  uint64_t _pad[3];
310 };
311 
312 enum {
318  CR0_VMW_MASK = 0x1C0,
319 };
320 
323  CMD_PRF_ADDR = 0x02,
324  CMD_CFGI_STE = 0x03,
326  CMD_CFGI_CD = 0x05,
341  CMD_ATC_INV = 0x40,
342  CMD_PRI_RESP = 0x41,
343  CMD_RESUME = 0x44,
345  CMD_SYNC = 0x46,
346 };
347 
349 {
350  BitUnion64(DWORD0)
351  Bitfield<7, 0> type;
352  Bitfield<10> ssec;
353  Bitfield<11> ssv;
354  Bitfield<31, 12> ssid;
355  Bitfield<47, 32> vmid;
356  Bitfield<63, 48> asid;
357  Bitfield<63, 32> sid;
358  EndBitUnion(DWORD0)
359  DWORD0 dw0;
360 
361  BitUnion64(DWORD1)
362  Bitfield<0> leaf;
363  Bitfield<4, 0> size;
364  Bitfield<4, 0> range;
365  Bitfield<63, 12> address;
366  EndBitUnion(DWORD1)
367  DWORD1 dw1;
368 
369  uint64_t addr() const
370  {
371  uint64_t address = (uint64_t)(dw1.address) << 12;
372  return address;
373  }
374 };
375 
377  EVT_FAULT = 0x0001,
378 };
379 
381  EVF_WRITE = 0x0001,
382 };
383 
384 struct SMMUEvent
385 {
386  uint16_t type;
387  uint16_t stag;
388  uint32_t flags;
389  uint32_t streamId;
390  uint32_t substreamId;
391  uint64_t va;
392  uint64_t ipa;
393 };
394 
395 enum {
397 };
398 
399 #endif /* __DEV_ARM_SMMU_V3_DEFS_HH__ */
uint32_t irq_ctrl
uint32_t _pad18[6]
EndBitUnion(UserDescFlags) struct UserDesc32
Definition: process.cc:152
uint32_t idr3
uint32_t iidr
uint32_t aidr
uint32_t _pad13
uint32_t _pad_2
uint64_t eventq_base
Bitfield< 8 > a
uint32_t idr4
ip6_addr_t addr
Definition: inet.hh:330
uint32_t irq_ctrlack
uint32_t _pad9
uint32_t gatos_ctrl
uint64_t ipa
uint32_t _pad5
uint32_t priq_irq_cfg2
uint32_t _pad1
uint32_t eventq_irq_cfg2
Bitfield< 13, 12 > sh0
uint32_t _pad3
uint16_t type
uint32_t gerror_irq_cfg2
Bitfield< 51, 6 > s1ctxptr
uint32_t _pad16[8095]
Bitfield< 19, 18 > or1
uint32_t _pad12[8]
uint8_t type
Definition: inet.hh:328
Bitfield< 18, 16 > t1sz
Bitfield< 30 > tg1
uint32_t _pad17[42]
Bitfield< 14 > tg0
uint32_t priq_prod
Bitfield< 4 > s
uint32_t eventq_prod
uint32_t cr0ack
uint64_t strtab_base
uint64_t gatos_sid
uint64_t va
uint32_t _pad8
uint32_t _pad15[8095]
uint32_t _pad6
uint32_t idr5
SMMUCommandType
uint32_t cmdq_cons
uint32_t idr0
uint32_t cr2
Bitfield< 19 > wxn
SMMUEventTypes
Bitfield< 5, 4 > s1fmt
uint32_t strtab_base_cfg
Bitfield< 7 > epd0
Bitfield< 63, 59 > s1cdmax
uint8_t _secure_regs[SMMU_SECURE_SZ]
uint64_t priq_base
uint32_t _pad2
Bitfield< 39 > ha
#define ULL(N)
uint64_t constant
Definition: types.hh:48
uint64_t eventq_irq_cfg0
uint32_t cr1
Bitfield< 29, 28 > sh1
uint32_t _pad10
uint32_t substreamId
uint32_t vatos_sel
uint32_t gerror_irq_cfg1
uint16_t stag
uint32_t agbpa
uint32_t _pad7
uint32_t eventq_irq_cfg1
uint32_t eventq_cons
uint32_t _pad11
Bitfield< 3, 2 > ir1
Bitfield< 40 > hd
uint32_t cr0
uint32_t _pad14[24]
uint32_t _pad4
Bitfield< 17, 16 > or0
uint8_t data[SMMU_REG_SIZE]
uint32_t _pad_1
uint64_t priq_irq_cfg0
uint32_t idr1
Bitfield< 22 > pan
uint64_t gerror_irq_cfg0
uint32_t priq_irq_cfg1
uint32_t streamId
Bitfield< 2, 0 > t0sz
uint32_t flags
Bitfield< 3, 1 > config
Bitfield< 34, 32 > ips
uint32_t idr2
uint32_t gerror
uint32_t priq_cons
uint32_t cmdq_prod
#define BitUnion64(name)
Definition: bitunion.hh:374
SMMUEventFlags
uint32_t gbpa
uint64_t gatos_par
uint32_t statusr
Bitfield< 20 > uwxn
Bitfield< 20 > tbi
uint64_t cmdq_base
uint32_t gerrorn
uint64_t gatos_addr
Bitfield< 23 > epd1

Generated on Thu May 28 2020 16:21:32 for gem5 by doxygen 1.8.13