gem5  v20.1.0.0
tlbi_op.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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 #include "arch/arm/tlbi_op.hh"
39 
40 #include "arch/arm/tlb.hh"
41 #include "cpu/checker/cpu.hh"
42 
43 namespace ArmISA {
44 
45 void
47 {
48  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
49  bool in_host = (hcr.tge == 1 && hcr.e2h == 1);
52 
53  // If CheckerCPU is connected, need to notify it of a flush
54  CheckerCPU *checker = tc->getCheckerCpuPtr();
55  if (checker) {
57  targetEL, in_host);
59  targetEL, in_host);
60  }
61 }
62 
63 void
65 {
67 }
68 
69 void
71 {
73 }
74 
75 void
77 {
78  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
79  bool in_host = (hcr.tge == 1 && hcr.e2h == 1);
80  getITBPtr(tc)->flushAsid(asid, secureLookup, targetEL, in_host);
81  getDTBPtr(tc)->flushAsid(asid, secureLookup, targetEL, in_host);
82  CheckerCPU *checker = tc->getCheckerCpuPtr();
83  if (checker) {
84  getITBPtr(checker)->flushAsid(asid, secureLookup, targetEL, in_host);
85  getDTBPtr(checker)->flushAsid(asid, secureLookup, targetEL, in_host);
86  }
87 }
88 
89 void
91 {
93 }
94 
95 void
97 {
99 }
100 
101 void
103 {
106 
107  CheckerCPU *checker = tc->getCheckerCpuPtr();
108  if (checker) {
109  getITBPtr(checker)->flushAllNs(targetEL);
110  getDTBPtr(checker)->flushAllNs(targetEL);
111  }
112 }
113 
114 void
116 {
117  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
118  bool in_host = (hcr.tge == 1 && hcr.e2h == 1);
119  getITBPtr(tc)->flushMva(addr, secureLookup, targetEL, in_host);
120  getDTBPtr(tc)->flushMva(addr, secureLookup, targetEL, in_host);
121 
122  CheckerCPU *checker = tc->getCheckerCpuPtr();
123  if (checker) {
124  getITBPtr(checker)->flushMva(addr, secureLookup, targetEL, in_host);
125  getDTBPtr(checker)->flushMva(addr, secureLookup, targetEL, in_host);
126  }
127 }
128 
129 void
131 {
132  HCR hcr = tc->readMiscReg(MISCREG_HCR_EL2);
133  bool in_host = (hcr.tge == 1 && hcr.e2h == 1);
135  secureLookup, targetEL, in_host);
137  secureLookup, targetEL, in_host);
138 
139  CheckerCPU *checker = tc->getCheckerCpuPtr();
140  if (checker) {
141  getITBPtr(checker)->flushMvaAsid(
142  addr, asid, secureLookup, targetEL, in_host);
143  getDTBPtr(checker)->flushMvaAsid(
144  addr, asid, secureLookup, targetEL, in_host);
145  }
146 }
147 
148 void
150 {
151  getITBPtr(tc)->flushMvaAsid(
153 }
154 
155 void
157 {
158  getDTBPtr(tc)->flushMvaAsid(
160 }
161 
162 void
164 {
169 
170  CheckerCPU *checker = tc->getCheckerCpuPtr();
171  if (checker) {
172  getITBPtr(checker)->flushIpaVmid(addr,
174  getDTBPtr(checker)->flushIpaVmid(addr,
176  }
177 }
178 
179 } // namespace ArmISA
ArmISA::TLB::flushIpaVmid
void flushIpaVmid(Addr ipa, bool secure_lookup, ExceptionLevel target_el)
Invalidate all entries in the stage 2 TLB that match the given ipa and the current VMID.
Definition: tlb.cc:379
ArmISA::TLBIASID::asid
uint16_t asid
Definition: tlbi_op.hh:128
ArmISA::TLB::flushAllSecurity
void flushAllSecurity(bool secure_lookup, ExceptionLevel target_el, bool ignore_el=false, bool in_host=false)
Reset the entire TLB.
Definition: tlb.cc:248
ArmISA::DTLBIASID::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:96
ArmISA::ITLBIASID::asid
uint16_t asid
Definition: tlbi_op.hh:144
ArmISA::DTLBIMVA::addr
Addr addr
Definition: tlbi_op.hh:237
CheckerCPU
CheckerCPU class.
Definition: cpu.hh:85
tlb.hh
ArmISA::TLBIMVAA::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:115
ArmISA::DTLBIASID::asid
uint16_t asid
Definition: tlbi_op.hh:160
ArmISA::TLBIMVA::addr
Addr addr
Definition: tlbi_op.hh:201
ArmISA
Definition: ccregs.hh:41
ArmISA::TLBIALL::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:46
ArmISA::TLBIIPA::addr
Addr addr
Definition: tlbi_op.hh:252
ArmISA::DTLBIMVA::asid
uint16_t asid
Definition: tlbi_op.hh:238
ArmISA::TLBIOp::secureLookup
bool secureLookup
Definition: tlbi_op.hh:76
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
ArmISA::TLBIOp::targetEL
ExceptionLevel targetEL
Definition: tlbi_op.hh:77
ArmISA::ITLBIASID::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:90
ArmISA::TLB::flushMva
void flushMva(Addr mva, bool secure_lookup, ExceptionLevel target_el, bool in_host=false)
Remove all entries that match the va regardless of asn.
Definition: tlb.cc:346
cpu.hh
ArmISA::getDTBPtr
TLB * getDTBPtr(T *tc)
Definition: tlb.hh:479
tlbi_op.hh
ArmISA::ITLBIALL::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:64
ArmISA::TLBIMVAA::addr
Addr addr
Definition: tlbi_op.hh:186
ArmISA::MISCREG_HCR_EL2
@ MISCREG_HCR_EL2
Definition: miscregs.hh:578
ArmISA::TLB::flushAsid
void flushAsid(uint64_t asn, bool secure_lookup, ExceptionLevel target_el, bool in_host=false)
Remove any entries that match the asn.
Definition: tlb.cc:321
ArmISA::TLBIMVA::asid
uint16_t asid
Definition: tlbi_op.hh:202
ArmISA::TLB::flushMvaAsid
void flushMvaAsid(Addr mva, uint64_t asn, bool secure_lookup, ExceptionLevel target_el, bool in_host=false)
Remove any entries that match both a va and asn.
Definition: tlb.cc:310
ArmISA::getITBPtr
TLB * getITBPtr(T *tc)
Definition: tlb.hh:470
ArmISA::TLBIMVA::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:130
ArmISA::TLB::flushAllNs
void flushAllNs(ExceptionLevel target_el, bool ignore_el=false)
Remove all entries in the non secure world, depending on whether they were allocated in hyp mode or n...
Definition: tlb.cc:279
ArmISA::TLBIALLN::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:102
ArmISA::ITLBIMVA::addr
Addr addr
Definition: tlbi_op.hh:219
ThreadContext::readMiscReg
virtual RegVal readMiscReg(RegIndex misc_reg)=0
ThreadContext::getCheckerCpuPtr
virtual CheckerCPU * getCheckerCpuPtr()=0
ArmISA::DTLBIALL::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:70
ArmISA::DTLBIMVA::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:156
ArmISA::ITLBIMVA::asid
uint16_t asid
Definition: tlbi_op.hh:220
ArmISA::TLBIASID::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:76
ArmISA::ITLBIMVA::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:149
ArmISA::TLBIIPA::operator()
void operator()(ThreadContext *tc) override
Definition: tlbi_op.cc:163

Generated on Wed Sep 30 2020 14:02:01 for gem5 by doxygen 1.8.17