gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
smmu_v3_transl.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_TRANSL_HH__
39 #define __DEV_ARM_SMMU_V3_TRANSL_HH__
40 
41 #include "base/compiler.hh"
43 #include "dev/arm/smmu_v3_proc.hh"
44 #include "mem/packet.hh"
45 
46 namespace gem5
47 {
48 
49 namespace ArmISA
50 {
51 struct PageTableOps;
52 }
53 
55 {
57  unsigned size;
58  uint32_t sid; // streamId
59  uint32_t ssid; // substreamId
60  bool isWrite;
61  bool isPrefetch;
63 
65 
66  static SMMUTranslRequest fromPacket(PacketPtr pkt, bool ats = false);
67  static SMMUTranslRequest prefetch(Addr addr, uint32_t sid, uint32_t ssid);
68 };
69 
71 {
72  private:
74  {
78  uint16_t asid;
79  uint16_t vmid;
82  uint8_t t0sz;
83  uint8_t s2t0sz;
84  };
85 
86  enum FaultType
87  {
89  FAULT_TRANSLATION, // F_TRANSLATION
90  FAULT_PERMISSION, // F_PERMISSION
91  };
92 
93  struct TranslResult
94  {
98  bool writable;
99  };
100 
102 
105 
108 
109  virtual void main(Yield &yield);
110 
111  TranslResult bypass(Addr addr) const;
113 
114  bool microTLBLookup(Yield &yield, TranslResult &tr);
115  bool ifcTLBLookup(Yield &yield, TranslResult &tr, bool &wasPrefetched);
116  bool smmuTLBLookup(Yield &yield, TranslResult &tr);
117 
118  void microTLBUpdate(Yield &yield, const TranslResult &tr);
119  void ifcTLBUpdate(Yield &yield, const TranslResult &tr);
120  void smmuTLBUpdate(Yield &yield, const TranslResult &tr);
121 
122  bool configCacheLookup(Yield &yield, TranslContext &tc);
123  void configCacheUpdate(Yield &yield, const TranslContext &tc);
124  bool findConfig(Yield &yield, TranslContext &tc, TranslResult &tr);
125 
126  void walkCacheLookup(Yield &yield,
127  const WalkCache::Entry *&walkEntry,
128  Addr addr, uint16_t asid, uint16_t vmid,
129  unsigned stage, unsigned level);
130 
131  void walkCacheUpdate(Yield &yield, Addr va, Addr vaMask, Addr pa,
132  unsigned stage, unsigned level,
133  bool leaf, uint8_t permissions);
134 
136  const ArmISA::PageTableOps *pt_ops,
137  unsigned level, Addr walkPtr);
138 
139  TranslResult walkStage2(Yield &yield, Addr addr, bool final_tr,
140  const ArmISA::PageTableOps *pt_ops,
141  unsigned level, Addr walkPtr);
142 
144  TranslResult translateStage2(Yield &yield, Addr addr, bool final_tr);
145 
147  const TranslResult &s2tr) const;
148 
154  bool hazard4kCheck();
155  void hazard4kRegister();
156  void hazard4kHold(Yield &yield);
157  void hazard4kRelease();
158 
163  void hazardIdRegister();
164  void hazardIdHold(Yield &yield);
165  void hazardIdRelease();
166 
167  void issuePrefetch(Addr addr);
168 
169  void completeTransaction(Yield &yield, const TranslResult &tr);
170  void completePrefetch(Yield &yield);
171 
172  void sendEvent(Yield &yield, const SMMUEvent &ev);
173 
174  void doReadSTE(Yield &yield, StreamTableEntry &ste, uint32_t sid);
175  void doReadCD(Yield &yield, ContextDescriptor &cd,
176  const StreamTableEntry &ste, uint32_t sid, uint32_t ssid);
177  void doReadConfig(Yield &yield, Addr addr, void *ptr, size_t size,
178  uint32_t sid, uint32_t ssid);
179  void doReadPTE(Yield &yield, Addr va, Addr addr, void *ptr,
180  unsigned stage, unsigned level);
181 
182  public:
183  SMMUTranslationProcess(const std::string &name, SMMUv3 &_smmu,
184  SMMUv3DeviceInterface &_ifc);
185 
186  virtual ~SMMUTranslationProcess();
187 
188  void beginTransaction(const SMMUTranslRequest &req);
189  void resumeTransaction();
190 };
191 
192 } // namespace gem5
193 
194 #endif /* __DEV_ARM_SMMU_V3_TRANSL_HH__ */
gem5::X86ISA::level
Bitfield< 20 > level
Definition: intmessage.hh:51
gem5::SMMUTranslationProcess::FAULT_TRANSLATION
@ FAULT_TRANSLATION
Definition: smmu_v3_transl.hh:89
gem5::SMMUTranslationProcess::microTLBUpdate
void microTLBUpdate(Yield &yield, const TranslResult &tr)
Definition: smmu_v3_transl.cc:414
gem5::SMMUTranslRequest::sid
uint32_t sid
Definition: smmu_v3_transl.hh:58
gem5::SMMUTranslationProcess::hazardIdRegister
void hazardIdRegister()
Used to force ordering on transactions with the same orderId.
Definition: smmu_v3_transl.cc:1136
gem5::SMMUTranslRequest::ssid
uint32_t ssid
Definition: smmu_v3_transl.hh:59
gem5::StreamTableEntry
Definition: smmu_v3_defs.hh:194
gem5::SMMUTranslationProcess::issuePrefetch
void issuePrefetch(Addr addr)
Definition: smmu_v3_transl.cc:1215
gem5::SMMUTranslationProcess::hazardIdRelease
void hazardIdRelease()
Definition: smmu_v3_transl.cc:1190
gem5::SMMUTranslationProcess::TranslContext::ttb1
Addr ttb1
Definition: smmu_v3_transl.hh:77
gem5::SMMUProcess
Definition: smmu_v3_proc.hh:97
gem5::SMMUTranslationProcess::smmuTLBLookup
bool smmuTLBLookup(Yield &yield, TranslResult &tr)
Definition: smmu_v3_transl.cc:383
gem5::SMMUTranslationProcess::recvTick
Tick recvTick
Definition: smmu_v3_transl.hh:106
gem5::SMMUTranslationProcess::hazard4kHold
void hazard4kHold(Yield &yield)
Definition: smmu_v3_transl.cc:1078
gem5::SMMUTranslationProcess::smmuTranslation
TranslResult smmuTranslation(Yield &yield)
Definition: smmu_v3_transl.cc:255
gem5::SMMUTranslationProcess::TranslContext::ttb0
Addr ttb0
Definition: smmu_v3_transl.hh:77
gem5::SMMUTranslationProcess::translateStage1And2
TranslResult translateStage1And2(Yield &yield, Addr addr)
Definition: smmu_v3_transl.cc:889
gem5::SMMUTranslationProcess::SMMUTranslationProcess
SMMUTranslationProcess(const std::string &name, SMMUv3 &_smmu, SMMUv3DeviceInterface &_ifc)
Definition: smmu_v3_transl.cc:85
gem5::ArmISA::asid
asid
Definition: misc_types.hh:675
gem5::WalkCache::Entry
Definition: smmu_v3_caches.hh:295
gem5::SMMUTranslationProcess::configCacheUpdate
void configCacheUpdate(Yield &yield, const TranslContext &tc)
Definition: smmu_v3_transl.cc:552
gem5::SMMUTranslRequest::prefetch
static SMMUTranslRequest prefetch(Addr addr, uint32_t sid, uint32_t ssid)
Definition: smmu_v3_transl.cc:70
gem5::SMMUTranslRequest::addr
Addr addr
Definition: smmu_v3_transl.hh:56
gem5::SMMUTranslRequest::isAtsRequest
bool isAtsRequest
Definition: smmu_v3_transl.hh:62
gem5::SMMUTranslationProcess::TranslResult::addrMask
Addr addrMask
Definition: smmu_v3_transl.hh:97
gem5::SMMUTranslationProcess::context
TranslContext context
Definition: smmu_v3_transl.hh:104
gem5::SMMUTranslationProcess::TranslContext::t0sz
uint8_t t0sz
Definition: smmu_v3_transl.hh:82
gem5::SMMUTranslationProcess::TranslContext
Definition: smmu_v3_transl.hh:73
gem5::SMMUTranslationProcess::hazardIdHold
void hazardIdHold(Yield &yield)
Definition: smmu_v3_transl.cc:1151
GEM5_CLASS_VAR_USED
#define GEM5_CLASS_VAR_USED
Definition: compiler.hh:141
gem5::SMMUTranslationProcess::hazard4kRegister
void hazard4kRegister()
Definition: smmu_v3_transl.cc:1069
gem5::SMMUTranslationProcess::sendEvent
void sendEvent(Yield &yield, const SMMUEvent &ev)
Definition: smmu_v3_transl.cc:1308
gem5::SMMUTranslRequest::fromPacket
static SMMUTranslRequest fromPacket(PacketPtr pkt, bool ats=false)
Definition: smmu_v3_transl.cc:53
gem5::SMMUTranslationProcess::FAULT_PERMISSION
@ FAULT_PERMISSION
Definition: smmu_v3_transl.hh:90
gem5::SMMUTranslRequest::isPrefetch
bool isPrefetch
Definition: smmu_v3_transl.hh:61
gem5::SMMUTranslationProcess::doReadCD
void doReadCD(Yield &yield, ContextDescriptor &cd, const StreamTableEntry &ste, uint32_t sid, uint32_t ssid)
Definition: smmu_v3_transl.cc:1406
gem5::SMMUv3
Definition: smmu_v3.hh:84
gem5::SMMUTranslationProcess::configCacheLookup
bool configCacheLookup(Yield &yield, TranslContext &tc)
Definition: smmu_v3_transl.cc:512
packet.hh
gem5::SMMUTranslationProcess::doReadPTE
void doReadPTE(Yield &yield, Addr va, Addr addr, void *ptr, unsigned stage, unsigned level)
Definition: smmu_v3_transl.cc:1478
gem5::SMMUTranslRequest::isWrite
bool isWrite
Definition: smmu_v3_transl.hh:60
gem5::ContextDescriptor
Definition: smmu_v3_defs.hh:260
gem5::SMMUTranslationProcess::TranslResult::writable
bool writable
Definition: smmu_v3_transl.hh:98
gem5::SMMUProcess::name
const std::string name() const
Definition: smmu_v3_proc.hh:135
gem5::ArmISA::pa
Bitfield< 39, 12 > pa
Definition: misc_types.hh:714
gem5::SMMUTranslationProcess::faultTick
GEM5_CLASS_VAR_USED Tick faultTick
Definition: smmu_v3_transl.hh:107
gem5::SMMUTranslationProcess::~SMMUTranslationProcess
virtual ~SMMUTranslationProcess()
Definition: smmu_v3_transl.cc:99
gem5::SMMUTranslationProcess::walkStage1And2
TranslResult walkStage1And2(Yield &yield, Addr addr, const ArmISA::PageTableOps *pt_ops, unsigned level, Addr walkPtr)
Definition: smmu_v3_transl.cc:737
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::SMMUTranslationProcess::walkStage2
TranslResult walkStage2(Yield &yield, Addr addr, bool final_tr, const ArmISA::PageTableOps *pt_ops, unsigned level, Addr walkPtr)
Definition: smmu_v3_transl.cc:822
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ArmISA::PageTableOps
Definition: pagetable.hh:90
gem5::SMMUTranslRequest::pkt
PacketPtr pkt
Definition: smmu_v3_transl.hh:64
gem5::SMMUTranslationProcess::main
virtual void main(Yield &yield)
Definition: smmu_v3_transl.cc:139
gem5::SMMUTranslationProcess::TranslContext::httb
Addr httb
Definition: smmu_v3_transl.hh:77
gem5::SMMUTranslationProcess::hazard4kCheck
bool hazard4kCheck()
Used to force ordering on transactions with same (SID, SSID, 4k page) to avoid multiple identical pag...
Definition: smmu_v3_transl.cc:1052
gem5::SMMUTranslationProcess::TranslContext::stage1TranslGranule
uint8_t stage1TranslGranule
Definition: smmu_v3_transl.hh:80
gem5::ArmISA::cd
Bitfield< 32 > cd
Definition: misc_types.hh:306
gem5::SMMUTranslationProcess::TranslResult
Definition: smmu_v3_transl.hh:93
gem5::SMMUTranslationProcess::beginTransaction
void beginTransaction(const SMMUTranslRequest &req)
Definition: smmu_v3_transl.cc:113
gem5::SMMUTranslationProcess::FaultType
FaultType
Definition: smmu_v3_transl.hh:86
compiler.hh
gem5::SMMUTranslationProcess::TranslContext::vmid
uint16_t vmid
Definition: smmu_v3_transl.hh:79
gem5::SMMUv3DeviceInterface
Definition: smmu_v3_deviceifc.hh:58
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::SMMUTranslRequest::size
unsigned size
Definition: smmu_v3_transl.hh:57
smmu_v3_deviceifc.hh
gem5::SMMUTranslationProcess::request
SMMUTranslRequest request
Definition: smmu_v3_transl.hh:103
gem5::ArmISA::va
Bitfield< 8 > va
Definition: misc_types.hh:330
gem5::SMMUTranslationProcess::TranslResult::addr
Addr addr
Definition: smmu_v3_transl.hh:96
gem5::SMMUTranslationProcess::walkCacheUpdate
void walkCacheUpdate(Yield &yield, Addr va, Addr vaMask, Addr pa, unsigned stage, unsigned level, bool leaf, uint8_t permissions)
Definition: smmu_v3_transl.cc:696
gem5::SMMUTranslationProcess::ifcTLBUpdate
void ifcTLBUpdate(Yield &yield, const TranslResult &tr)
Definition: smmu_v3_transl.cc:446
gem5::SMMUTranslationProcess::hazard4kRelease
void hazard4kRelease()
Definition: smmu_v3_transl.cc:1116
gem5::SMMUTranslationProcess::TranslResult::fault
FaultType fault
Definition: smmu_v3_transl.hh:95
gem5::SMMUTranslationProcess::TranslContext::s2t0sz
uint8_t s2t0sz
Definition: smmu_v3_transl.hh:83
gem5::SMMUTranslationProcess::completeTransaction
void completeTransaction(Yield &yield, const TranslResult &tr)
Definition: smmu_v3_transl.cc:1233
smmu_v3_proc.hh
gem5::SMMUTranslationProcess::smmuTLBUpdate
void smmuTLBUpdate(Yield &yield, const TranslResult &tr)
Definition: smmu_v3_transl.cc:483
gem5::SMMUEvent
Definition: smmu_v3_defs.hh:397
gem5::SMMUTranslationProcess::combineTranslations
TranslResult combineTranslations(const TranslResult &s1tr, const TranslResult &s2tr) const
Definition: smmu_v3_transl.cc:1034
gem5::SMMUTranslationProcess::walkCacheLookup
void walkCacheLookup(Yield &yield, const WalkCache::Entry *&walkEntry, Addr addr, uint16_t asid, uint16_t vmid, unsigned stage, unsigned level)
Definition: smmu_v3_transl.cc:654
gem5::SMMUTranslationProcess::TranslContext::asid
uint16_t asid
Definition: smmu_v3_transl.hh:78
gem5::SMMUTranslRequest
Definition: smmu_v3_transl.hh:54
gem5::Coroutine::CallerType
CallerType: A reference to an object of this class will be passed to the coroutine task.
Definition: coroutine.hh:84
gem5::SMMUTranslationProcess::ifcTLBLookup
bool ifcTLBLookup(Yield &yield, TranslResult &tr, bool &wasPrefetched)
Definition: smmu_v3_transl.cc:348
gem5::SMMUTranslationProcess::FAULT_NONE
@ FAULT_NONE
Definition: smmu_v3_transl.hh:88
gem5::SMMUTranslationProcess::doReadConfig
void doReadConfig(Yield &yield, Addr addr, void *ptr, size_t size, uint32_t sid, uint32_t ssid)
Definition: smmu_v3_transl.cc:1470
gem5::SMMUTranslationProcess::TranslContext::stage1Enable
bool stage1Enable
Definition: smmu_v3_transl.hh:75
gem5::SMMUTranslationProcess::findConfig
bool findConfig(Yield &yield, TranslContext &tc, TranslResult &tr)
Definition: smmu_v3_transl.cc:584
gem5::SMMUTranslationProcess::bypass
TranslResult bypass(Addr addr) const
Definition: smmu_v3_transl.cc:243
gem5::SMMUTranslationProcess::TranslContext::stage2Enable
bool stage2Enable
Definition: smmu_v3_transl.hh:76
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::SMMUTranslationProcess::microTLBLookup
bool microTLBLookup(Yield &yield, TranslResult &tr)
Definition: smmu_v3_transl.cc:317
gem5::SMMUTranslationProcess::doReadSTE
void doReadSTE(Yield &yield, StreamTableEntry &ste, uint32_t sid)
Definition: smmu_v3_transl.cc:1338
gem5::SMMUTranslationProcess::translateStage2
TranslResult translateStage2(Yield &yield, Addr addr, bool final_tr)
Definition: smmu_v3_transl.cc:945
gem5::SMMUTranslationProcess
Definition: smmu_v3_transl.hh:70
gem5::SMMUTranslationProcess::TranslContext::stage2TranslGranule
uint8_t stage2TranslGranule
Definition: smmu_v3_transl.hh:81
gem5::SMMUTranslationProcess::completePrefetch
void completePrefetch(Yield &yield)
Definition: smmu_v3_transl.cc:1295
gem5::SMMUTranslationProcess::resumeTransaction
void resumeTransaction()
Definition: smmu_v3_transl.cc:121
gem5::SMMUTranslationProcess::ifc
SMMUv3DeviceInterface & ifc
Definition: smmu_v3_transl.hh:101
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Sun Jul 30 2023 01:56:55 for gem5 by doxygen 1.8.17