gem5 v24.0.0.0
Loading...
Searching...
No Matches
tlbi_op.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2023 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#include "arch/arm/tlbi_op.hh"
39
40#include "arch/arm/mmu.hh"
41#include "cpu/checker/cpu.hh"
42
43namespace gem5
44{
45
46namespace ArmISA {
47
48void
50{
52 currentEL = currEL(tc);
53
54 getMMUPtr(tc)->flush(*this);
55
56 // If CheckerCPU is connected, need to notify it of a flush
57 CheckerCPU *checker = tc->getCheckerCpuPtr();
58 if (checker) {
59 getMMUPtr(checker)->flush(*this);
60 }
61}
62
63bool
65{
66 return te->valid && secureLookup == !te->nstid &&
67 (te->vmid == vmid || el2Enabled) &&
68 te->checkRegime(targetRegime);
69}
70
71void
77
78bool
80{
81 return TLBIALL::match(te, vmid) && (te->type & TypeTLB::instruction);
82}
83
84void
90
91bool
93{
94 return TLBIALL::match(te, vmid) && (te->type & TypeTLB::data);
95}
96
97void
99{
100 getMMUPtr(tc)->flush(*this);
101
102 // If CheckerCPU is connected, need to notify it of a flush
103 CheckerCPU *checker = tc->getCheckerCpuPtr();
104 if (checker) {
105 getMMUPtr(checker)->flush(*this);
106 }
107}
108
109bool
111{
112 return te->valid && secureLookup == !te->nstid &&
113 te->checkRegime(targetRegime);
114}
115
116void
118{
120
121 getMMUPtr(tc)->flush(*this);
122
123 // If CheckerCPU is connected, need to notify it of a flush
124 CheckerCPU *checker = tc->getCheckerCpuPtr();
125 if (checker) {
126 getMMUPtr(checker)->flush(*this);
127 }
128}
129
130bool
132{
133 return te->valid && secureLookup == !te->nstid &&
134 te->checkRegime(targetRegime) &&
135 (te->vmid == vmid || !el2Enabled || !useVMID(targetRegime));
136}
137
138void
140{
142
143 getMMUPtr(tc)->flushStage1(*this);
144 CheckerCPU *checker = tc->getCheckerCpuPtr();
145 if (checker) {
146 getMMUPtr(checker)->flushStage1(*this);
147 }
148}
149
150bool
152{
153 return te->valid && te->asid == asid &&
154 secureLookup == !te->nstid &&
155 te->checkRegime(targetRegime) &&
156 (te->vmid == vmid || !el2Enabled || !useVMID(targetRegime));
157}
158
159void
161{
163 getMMUPtr(tc)->iflush(*this);
164}
165
166bool
168{
169 return TLBIASID::match(te, vmid) && (te->type & TypeTLB::instruction);
170}
171
172void
174{
176 getMMUPtr(tc)->dflush(*this);
177}
178
179bool
181{
182 return TLBIASID::match(te, vmid) && (te->type & TypeTLB::data);
183}
184
185void
187{
188 getMMUPtr(tc)->flush(*this);
189
190 CheckerCPU *checker = tc->getCheckerCpuPtr();
191 if (checker) {
192 getMMUPtr(checker)->flush(*this);
193 }
194}
195
196bool
198{
199 return te->valid && te->nstid &&
200 te->checkRegime(targetRegime);
201}
202
205{
206 TlbEntry::Lookup lookup_data;
207 lookup_data.va = sext<56>(addr);
208 lookup_data.ignoreAsn = true;
209 lookup_data.vmid = vmid;
210 lookup_data.secure = secureLookup;
211 lookup_data.functional = true;
212 lookup_data.targetRegime = targetRegime;
213 lookup_data.mode = BaseMMU::Read;
214 return lookup_data;
215}
216
217void
219{
220 getMMUPtr(tc)->flushStage1(*this);
221
222 CheckerCPU *checker = tc->getCheckerCpuPtr();
223 if (checker) {
224 getMMUPtr(checker)->flushStage1(*this);
225 }
226}
227
228bool
230{
231 TlbEntry::Lookup lookup_data = lookupGen(vmid);
232
233 return te->match(lookup_data) && (!lastLevel || !te->partial);
234}
235
238{
239 TlbEntry::Lookup lookup_data;
240 lookup_data.va = sext<56>(addr);
241 lookup_data.asn = asid;
242 lookup_data.ignoreAsn = false;
243 lookup_data.vmid = vmid;
244 lookup_data.secure = secureLookup;
245 lookup_data.functional = true;
246 lookup_data.targetRegime = targetRegime;
247 lookup_data.mode = BaseMMU::Read;
248
249 return lookup_data;
250}
251
252void
254{
255 getMMUPtr(tc)->flushStage1(*this);
256
257 CheckerCPU *checker = tc->getCheckerCpuPtr();
258 if (checker) {
259 getMMUPtr(checker)->flushStage1(*this);
260 }
261}
262
263bool
265{
266 TlbEntry::Lookup lookup_data = lookupGen(vmid);
267
268 return te->match(lookup_data) && (!lastLevel || !te->partial);
269}
270
271void
273{
274 getMMUPtr(tc)->iflush(*this);
275}
276
277bool
279{
280 return TLBIMVA::match(te, vmid) && (te->type & TypeTLB::instruction);
281}
282
283void
285{
286 getMMUPtr(tc)->dflush(*this);
287}
288
289bool
291{
292 return TLBIMVA::match(te, vmid) && (te->type & TypeTLB::data);
293}
294
295void
297{
299
300 CheckerCPU *checker = tc->getCheckerCpuPtr();
301 if (checker) {
302 getMMUPtr(checker)->flushStage2(makeStage2());
303 }
304}
305
306bool
308{
309 TlbEntry::Lookup lookup_data = lookupGen(vmid);
310 lookup_data.size = rangeSize();
311
312 auto addr_match = te->match(lookup_data) && (!lastLevel || !te->partial);
313 if (addr_match) {
314 return tgMap[rangeData.tg] == te->tg &&
315 (resTLBIttl(rangeData.tg, rangeData.ttl) ||
316 rangeData.ttl == te->lookupLevel);
317 } else {
318 return false;
319 }
320}
321
322bool
324{
325 TlbEntry::Lookup lookup_data = lookupGen(vmid);
326 lookup_data.size = rangeSize();
327
328 auto addr_match = te->match(lookup_data) && (!lastLevel || !te->partial);
329 if (addr_match) {
330 return tgMap[rangeData.tg] == te->tg &&
331 (resTLBIttl(rangeData.tg, rangeData.ttl) ||
332 rangeData.ttl == te->lookupLevel);
333 } else {
334 return false;
335 }
336}
337
338} // namespace ArmISA
339} // namespace gem5
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:85
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:92
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:173
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:180
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:284
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:290
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:79
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:72
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:160
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:167
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:272
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:278
void flushStage2(const OP &tlbi_op)
Definition mmu.hh:330
void iflush(const OP &tlbi_op)
Definition mmu.hh:338
void flushStage1(const OP &tlbi_op)
Definition mmu.hh:315
void flush(const OP &tlbi_op)
Definition mmu.hh:302
void dflush(const OP &tlbi_op)
Definition mmu.hh:350
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:98
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:110
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:186
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:197
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:64
ExceptionLevel currentEL
Definition tlbi_op.hh:135
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:49
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:139
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:151
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:296
virtual TLBIMVAA makeStage2() const
TLBIIPA is basically a TLBIMVAA for stage2 TLBs.
Definition tlbi_op.hh:439
TlbEntry::Lookup lookupGen(vmid_t vmid) const
Definition tlbi_op.cc:204
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:229
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:218
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:264
TlbEntry::Lookup lookupGen(vmid_t vmid) const
Definition tlbi_op.cc:237
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:253
TranslationRegime targetRegime
Definition tlbi_op.hh:104
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:323
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:307
bool resTLBIttl(uint8_t tg, uint8_t ttl) const
Definition tlbi_op.hh:401
Addr rangeSize() const
Definition tlbi_op.hh:395
bool match(TlbEntry *entry, vmid_t curr_vmid) const override
Definition tlbi_op.cc:131
void operator()(ThreadContext *tc) override
Definition tlbi_op.cc:117
CheckerCPU class.
Definition cpu.hh:85
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual CheckerCPU * getCheckerCpuPtr()=0
constexpr uint64_t sext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
Definition bitfield.hh:129
static bool useVMID(TranslationRegime regime)
Definition utility.hh:376
Bitfield< 30 > te
ExceptionLevel currEL(const ThreadContext *tc)
Returns the current Exception Level (EL) of the provided ThreadContext.
Definition utility.cc:133
MMU * getMMUPtr(T *tc)
Definition mmu.hh:510
bool EL2Enabled(ThreadContext *tc)
Definition utility.cc:267
uint16_t vmid_t
Definition types.hh:57
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
TranslationRegime targetRegime
Definition pagetable.hh:206
The file contains the definition of a set of TLB Invalidate Instructions.

Generated on Tue Jun 18 2024 16:23:57 for gem5 by doxygen 1.11.0