gem5  v21.2.1.1
smmu_v3.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, 2018-2020 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_HH__
39 #define __DEV_ARM_SMMU_V3_HH__
40 
41 #include <list>
42 #include <map>
43 #include <queue>
44 #include <string>
45 #include <vector>
46 
47 #include "base/statistics.hh"
50 #include "dev/arm/smmu_v3_defs.hh"
53 #include "dev/arm/smmu_v3_ports.hh"
54 #include "dev/arm/smmu_v3_proc.hh"
55 #include "mem/packet.hh"
56 #include "params/SMMUv3.hh"
57 #include "sim/clocked_object.hh"
58 #include "sim/eventq.hh"
59 
79 namespace gem5
80 {
81 
82 class SMMUTranslationProcess;
83 
84 class SMMUv3 : public ClockedObject
85 {
86  protected:
87 
88  friend class SMMUProcess;
89  friend class SMMUTranslationProcess;
90  friend class SMMUCommandExecProcess;
91  friend class SMMUv3DeviceInterface;
92 
93  const System &system;
95 
99 
100  const bool irqInterfaceEnable;
101 
106 
107  const bool tlbEnable;
108  const bool configCacheEnable;
109  const bool ipaCacheEnable;
110  const bool walkCacheEnable;
112 
114  const unsigned walkCacheS1Levels;
115  const unsigned walkCacheS2Levels;
116  const unsigned requestPortWidth; // in bytes
117 
125 
126  SMMUSemaphore transSem; // max N transactions in SMMU
127  SMMUSemaphore ptwSem; // max N concurrent PTWs
128  SMMUSemaphore cycleSem; // max 1 table walk per cycle
129 
130  // Timing parameters
131  const Cycles tlbLat;
135  const Cycles ipaLat;
137 
138  // Stats
140  {
148  } stats;
149 
151 
153 
156 
157  bool inSecureBlock(uint32_t offs) const;
158 
159  std::queue<SMMUAction> packetsToRetry;
160  std::queue<SMMUAction> packetsTableWalkToRetry;
161 
162 
163  void scheduleDeviceRetries();
164 
168 
169  void processCommands();
171 
172  void processCommand(const SMMUCommand &cmd);
173 
174  public:
175  SMMUv3(const SMMUv3Params &p);
176  virtual ~SMMUv3() {}
177 
178  virtual void init() override;
179 
180  Tick recvAtomic(PacketPtr pkt, PortID id);
181  bool recvTimingReq(PacketPtr pkt, PortID id);
182  bool recvTimingResp(PacketPtr pkt);
183  void recvReqRetry();
184 
186  void tableWalkRecvReqRetry();
187 
190 
191  DrainState drain() override;
192  void serialize(CheckpointOut &cp) const override;
193  void unserialize(CheckpointIn &cp) override;
194 
195  virtual Port &getPort(const std::string &name,
196  PortID id = InvalidPortID) override;
197 };
198 
199 } // namespace gem5
200 
201 #endif /* __DEV_ARM_SMMU_V3_HH__ */
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1930
gem5::SMMUv3::packetsToRetry
std::queue< SMMUAction > packetsToRetry
Definition: smmu_v3.hh:159
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:252
gem5::SMMUv3::walkCache
WalkCache walkCache
Definition: smmu_v3.hh:105
gem5::SMMUv3::ifcSmmuSem
SMMUSemaphore ifcSmmuSem
Definition: smmu_v3.hh:119
gem5::SMMURegs
Definition: smmu_v3_defs.hh:109
gem5::statistics::Distribution
A simple distribution stat.
Definition: statistics.hh:2084
gem5::EventWrapper
Definition: eventq.hh:1084
gem5::SMMUProcess
Definition: smmu_v3_proc.hh:97
gem5::SMMUv3::requestPortWidth
const unsigned requestPortWidth
Definition: smmu_v3.hh:116
gem5::SMMUv3::drain
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: smmu_v3.cc:770
gem5::SMMUv3::transSem
SMMUSemaphore transSem
Definition: smmu_v3.hh:126
gem5::SMMUv3::runProcessTiming
SMMUAction runProcessTiming(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:286
gem5::SMMUv3::regs
SMMURegs regs
Definition: smmu_v3.hh:155
gem5::SMMUAction
Definition: smmu_v3_proc.hh:70
gem5::SMMUv3::controlPort
SMMUControlPort controlPort
Definition: smmu_v3.hh:98
gem5::SMMUv3::requestorId
const RequestorID requestorId
Definition: smmu_v3.hh:94
gem5::SMMUv3::ipaCacheEnable
const bool ipaCacheEnable
Definition: smmu_v3.hh:109
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::SMMUv3::SMMUv3Stats::ptwTimeDist
statistics::Distribution ptwTimeDist
Definition: smmu_v3.hh:147
gem5::SMMUv3::tlbLat
const Cycles tlbLat
Definition: smmu_v3.hh:131
gem5::SMMUv3::walkCacheS1Levels
const unsigned walkCacheS1Levels
Definition: smmu_v3.hh:114
gem5::SMMUv3::ifcSmmuLat
const Cycles ifcSmmuLat
Definition: smmu_v3.hh:132
smmu_v3_cmdexec.hh
gem5::SMMUv3::SMMUv3Stats::cdFetches
statistics::Scalar cdFetches
Definition: smmu_v3.hh:145
gem5::SMMUv3::processCommands
void processCommands()
Definition: smmu_v3.cc:373
std::vector
STL vector class.
Definition: stl.hh:37
gem5::SMMUv3::SMMUv3Stats::steFetches
statistics::Scalar steFetches
Definition: smmu_v3.hh:143
gem5::SMMUv3::writeControl
Tick writeControl(PacketPtr pkt)
Definition: smmu_v3.cc:604
gem5::SMMUv3::recvAtomic
Tick recvAtomic(PacketPtr pkt, PortID id)
smmu_v3_events.hh
gem5::SMMUv3::configSem
SMMUSemaphore configSem
Definition: smmu_v3.hh:121
gem5::SMMUv3::SMMUv3Stats::steL1Fetches
statistics::Scalar steL1Fetches
Definition: smmu_v3.hh:142
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:253
gem5::SMMUv3::requestPort
SMMURequestPort requestPort
Definition: smmu_v3.hh:96
gem5::SMMUv3::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: smmu_v3.cc:788
gem5::SMMUv3::walkCacheEnable
const bool walkCacheEnable
Definition: smmu_v3.hh:110
gem5::SMMUv3::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Definition: smmu_v3.cc:133
gem5::SMMUv3::runProcessAtomic
SMMUAction runProcessAtomic(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:237
gem5::SMMUv3::SMMUv3
SMMUv3(const SMMUv3Params &p)
Definition: smmu_v3.cc:58
gem5::SMMUv3::walkCacheNonfinalEnable
const bool walkCacheNonfinalEnable
Definition: smmu_v3.hh:113
gem5::SMMUv3::SMMUv3Stats::translationTimeDist
statistics::Distribution translationTimeDist
Definition: smmu_v3.hh:146
gem5::SMMUv3
Definition: smmu_v3.hh:84
packet.hh
gem5::SMMUv3::configCache
ConfigCache configCache
Definition: smmu_v3.hh:103
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::SMMUv3::~SMMUv3
virtual ~SMMUv3()
Definition: smmu_v3.hh:176
gem5::SMMUv3::recvReqRetry
void recvReqRetry()
Definition: smmu_v3.cc:150
gem5::DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:74
gem5::SMMUv3::regsMap
const AddrRange regsMap
Definition: smmu_v3.hh:154
gem5::System
Definition: system.hh:75
gem5::SMMUv3::cycleSem
SMMUSemaphore cycleSem
Definition: smmu_v3.hh:128
smmu_v3_ports.hh
gem5::Named::name
virtual std::string name() const
Definition: named.hh:47
gem5::SMMUv3::irqInterfaceEnable
const bool irqInterfaceEnable
Definition: smmu_v3.hh:100
gem5::SMMUv3::tableWalkRecvReqRetry
void tableWalkRecvReqRetry()
Definition: smmu_v3.cc:196
gem5::SMMUv3::requestPortSem
SMMUSemaphore requestPortSem
Definition: smmu_v3.hh:124
gem5::SMMUSemaphore
Definition: smmu_v3_proc.hh:81
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
statistics.hh
gem5::SMMUv3::ptwSem
SMMUSemaphore ptwSem
Definition: smmu_v3.hh:127
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::SMMUv3::readControl
Tick readControl(PacketPtr pkt)
Definition: smmu_v3.cc:571
gem5::SMMUv3::getPort
virtual Port & getPort(const std::string &name, PortID id=InvalidPortID) override
Get a port with a given name and index.
Definition: smmu_v3.cc:796
gem5::SMMUv3::inSecureBlock
bool inSecureBlock(uint32_t offs) const
Definition: smmu_v3.cc:706
gem5::SMMUv3::processCommand
void processCommand(const SMMUCommand &cmd)
Definition: smmu_v3.cc:389
gem5::SMMUv3::init
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: smmu_v3.cc:715
gem5::SMMUv3::tlbSem
SMMUSemaphore tlbSem
Definition: smmu_v3.hh:118
gem5::SMMUv3::ipaLat
const Cycles ipaLat
Definition: smmu_v3.hh:135
gem5::SMMUv3::walkLat
const Cycles walkLat
Definition: smmu_v3.hh:136
gem5::IPACache
Definition: smmu_v3_caches.hh:205
gem5::SMMUv3::tlbEnable
const bool tlbEnable
Definition: smmu_v3.hh:107
gem5::SMMUv3::smmuIfcSem
SMMUSemaphore smmuIfcSem
Definition: smmu_v3.hh:120
gem5::SMMUControlPort
Definition: smmu_v3_ports.hh:97
gem5::SMMUv3::ipaCache
IPACache ipaCache
Definition: smmu_v3.hh:104
gem5::SMMUv3DeviceInterface
Definition: smmu_v3_deviceifc.hh:58
gem5::SMMUv3::SMMUv3Stats::SMMUv3Stats
SMMUv3Stats(statistics::Group *parent)
Definition: smmu_v3.cc:735
gem5::SMMUv3::tableWalkRecvTimingResp
bool tableWalkRecvTimingResp(PacketPtr pkt)
Definition: smmu_v3.cc:179
smmu_v3_deviceifc.hh
gem5::SMMUv3::smmuIfcLat
const Cycles smmuIfcLat
Definition: smmu_v3.hh:133
gem5::ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:234
gem5::SMMUv3::SMMUv3Stats
Definition: smmu_v3.hh:139
gem5::SMMUTableWalkPort
Definition: smmu_v3_ports.hh:64
gem5::SMMUv3::processCommandsEvent
EventWrapper< SMMUv3, &SMMUv3::processCommands > processCommandsEvent
Definition: smmu_v3.hh:170
gem5::SMMUv3::system
const System & system
Definition: smmu_v3.hh:93
gem5::SMMUv3::walkCacheS2Levels
const unsigned walkCacheS2Levels
Definition: smmu_v3.hh:115
gem5::SMMUv3::packetsTableWalkToRetry
std::queue< SMMUAction > packetsTableWalkToRetry
Definition: smmu_v3.hh:160
gem5::ConfigCache
Definition: smmu_v3_caches.hh:245
smmu_v3_proc.hh
smmu_v3_caches.hh
gem5::SMMUv3::tableWalkPort
SMMUTableWalkPort tableWalkPort
Definition: smmu_v3.hh:97
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::SMMUv3::ipaSem
SMMUSemaphore ipaSem
Definition: smmu_v3.hh:122
clocked_object.hh
gem5::SMMUCommand
Definition: smmu_v3_defs.hh:359
gem5::WalkCache
Definition: smmu_v3_caches.hh:292
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::SMMUv3::configCacheEnable
const bool configCacheEnable
Definition: smmu_v3.hh:108
gem5::SMMUv3::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: smmu_v3.cc:780
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::RequestorID
uint16_t RequestorID
Definition: request.hh:95
gem5::SMMUv3::tlb
ARMArchTLB tlb
Definition: smmu_v3.hh:102
gem5::SMMUv3::deviceInterfaces
std::vector< SMMUv3DeviceInterface * > deviceInterfaces
Definition: smmu_v3.hh:150
gem5::SMMUv3::configLat
const Cycles configLat
Definition: smmu_v3.hh:134
gem5::AddrRange
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:81
smmu_v3_defs.hh
gem5::SMMUCommandExecProcess
Definition: smmu_v3_cmdexec.hh:49
gem5::SMMUv3::stats
gem5::SMMUv3::SMMUv3Stats stats
gem5::SMMUv3::recvTimingReq
bool recvTimingReq(PacketPtr pkt, PortID id)
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60
gem5::SMMUv3::scheduleDeviceRetries
void scheduleDeviceRetries()
Definition: smmu_v3.cc:217
gem5::ARMArchTLB
Definition: smmu_v3_caches.hh:161
gem5::SMMUv3::runProcess
SMMUAction runProcess(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:225
gem5::SMMUv3::tableWalkPortEnable
bool tableWalkPortEnable
Definition: smmu_v3.hh:111
gem5::SMMUv3::SMMUv3Stats::cdL1Fetches
statistics::Scalar cdL1Fetches
Definition: smmu_v3.hh:144
gem5::SMMUv3::commandExecutor
SMMUCommandExecProcess commandExecutor
Definition: smmu_v3.hh:152
gem5::SMMUv3::walkSem
SMMUSemaphore walkSem
Definition: smmu_v3.hh:123
gem5::SMMUTranslationProcess
Definition: smmu_v3_transl.hh:70
gem5::SMMURequestPort
Definition: smmu_v3_ports.hh:50
eventq.hh

Generated on Wed May 4 2022 12:13:56 for gem5 by doxygen 1.8.17