gem5  v20.1.0.0
smmu_v3.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_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 "dev/arm/smmu_v3_ptops.hh"
56 #include "mem/packet.hh"
57 #include "params/SMMUv3.hh"
58 #include "sim/clocked_object.hh"
59 #include "sim/eventq.hh"
60 
80 
81 class SMMUv3 : public ClockedObject
82 {
83  protected:
84 
85  friend class SMMUProcess;
86  friend class SMMUTranslationProcess;
87  friend class SMMUCommandExecProcess;
88  friend class SMMUv3DeviceInterface;
89 
90  const System &system;
92 
96 
101 
102  const bool tlbEnable;
103  const bool configCacheEnable;
104  const bool ipaCacheEnable;
105  const bool walkCacheEnable;
107 
109  const unsigned walkCacheS1Levels;
110  const unsigned walkCacheS2Levels;
111  const unsigned requestPortWidth; // in bytes
112 
120 
121  SMMUSemaphore transSem; // max N transactions in SMMU
122  SMMUSemaphore ptwSem; // max N concurrent PTWs
123  SMMUSemaphore cycleSem; // max 1 table walk per cycle
124 
125  // Timing parameters
126  const Cycles tlbLat;
130  const Cycles ipaLat;
132 
133  // Stats
140 
142 
144 
147 
148  bool inSecureBlock(uint32_t offs) const;
149 
150  std::queue<SMMUAction> packetsToRetry;
151  std::queue<SMMUAction> packetsTableWalkToRetry;
152 
153 
154  void scheduleDeviceRetries();
155 
159 
160  void processCommands();
162 
163  void processCommand(const SMMUCommand &cmd);
164 
165  const PageTableOps *getPageTableOps(uint8_t trans_granule);
166 
167  public:
168  SMMUv3(SMMUv3Params *p);
169  virtual ~SMMUv3() {}
170 
171  virtual void init() override;
172  virtual void regStats() override;
173 
174  Tick recvAtomic(PacketPtr pkt, PortID id);
175  bool recvTimingReq(PacketPtr pkt, PortID id);
176  bool recvTimingResp(PacketPtr pkt);
177  void recvReqRetry();
178 
180  void tableWalkRecvReqRetry();
181 
184 
185  DrainState drain() override;
186  void serialize(CheckpointOut &cp) const override;
187  void unserialize(CheckpointIn &cp) override;
188 
189  virtual Port &getPort(const std::string &name,
190  PortID id = InvalidPortID) override;
191 };
192 
193 #endif /* __DEV_ARM_SMMU_V3_HH__ */
SMMUv3::walkCacheS2Levels
const unsigned walkCacheS2Levels
Definition: smmu_v3.hh:110
SMMUv3::tlbEnable
const bool tlbEnable
Definition: smmu_v3.hh:102
SMMUv3::recvAtomic
Tick recvAtomic(PacketPtr pkt, PortID id)
SMMUv3::walkCacheS1Levels
const unsigned walkCacheS1Levels
Definition: smmu_v3.hh:109
SMMUv3::processCommandsEvent
EventWrapper< SMMUv3, &SMMUv3::processCommands > processCommandsEvent
Definition: smmu_v3.hh:161
SMMUv3::configLat
const Cycles configLat
Definition: smmu_v3.hh:129
SMMUv3::regsMap
const AddrRange regsMap
Definition: smmu_v3.hh:145
SMMUv3::ipaCacheEnable
const bool ipaCacheEnable
Definition: smmu_v3.hh:104
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
SMMUProcess
Definition: smmu_v3_proc.hh:93
SMMUv3::smmuIfcSem
SMMUSemaphore smmuIfcSem
Definition: smmu_v3.hh:115
SMMUv3::configCacheEnable
const bool configCacheEnable
Definition: smmu_v3.hh:103
SMMUv3::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Definition: smmu_v3.cc:127
SMMUv3::cdFetches
Stats::Scalar cdFetches
Definition: smmu_v3.hh:137
SMMUv3::ipaCache
IPACache ipaCache
Definition: smmu_v3.hh:99
SMMUv3::getPageTableOps
const PageTableOps * getPageTableOps(uint8_t trans_granule)
Definition: smmu_v3.cc:565
SMMUv3::regs
SMMURegs regs
Definition: smmu_v3.hh:146
EventWrapper< SMMUv3, &SMMUv3::processCommands >
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
SMMUv3::ifcSmmuSem
SMMUSemaphore ifcSmmuSem
Definition: smmu_v3.hh:114
SMMUv3::ipaLat
const Cycles ipaLat
Definition: smmu_v3.hh:130
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
SMMUv3::runProcess
SMMUAction runProcess(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:219
smmu_v3_cmdexec.hh
SMMUv3::scheduleDeviceRetries
void scheduleDeviceRetries()
Definition: smmu_v3.cc:211
std::vector< SMMUv3DeviceInterface * >
SMMUv3::~SMMUv3
virtual ~SMMUv3()
Definition: smmu_v3.hh:169
SMMUv3::runProcessTiming
SMMUAction runProcessTiming(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:280
SMMUv3::tlb
ARMArchTLB tlb
Definition: smmu_v3.hh:97
SMMUv3::walkLat
const Cycles walkLat
Definition: smmu_v3.hh:131
SMMUv3::packetsTableWalkToRetry
std::queue< SMMUAction > packetsTableWalkToRetry
Definition: smmu_v3.hh:151
smmu_v3_events.hh
SMMUv3::walkCacheEnable
const bool walkCacheEnable
Definition: smmu_v3.hh:105
SMMUv3::walkCache
WalkCache walkCache
Definition: smmu_v3.hh:100
SMMUv3::requestPort
SMMURequestPort requestPort
Definition: smmu_v3.hh:93
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
packet.hh
SMMUCommand
Definition: smmu_v3_defs.hh:348
SMMUv3::configCache
ConfigCache configCache
Definition: smmu_v3.hh:98
SMMUv3::walkSem
SMMUSemaphore walkSem
Definition: smmu_v3.hh:118
SMMUv3DeviceInterface
Definition: smmu_v3_deviceifc.hh:55
DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:71
SMMUv3::runProcessAtomic
SMMUAction runProcessAtomic(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:231
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
SMMUv3::recvTimingReq
bool recvTimingReq(PacketPtr pkt, PortID id)
RequestorID
uint16_t RequestorID
Definition: request.hh:85
SMMUv3::tlbLat
const Cycles tlbLat
Definition: smmu_v3.hh:126
SMMUv3::cycleSem
SMMUSemaphore cycleSem
Definition: smmu_v3.hh:123
cp
Definition: cprintf.cc:40
smmu_v3_ports.hh
AddrRange
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:68
SMMUv3::tlbSem
SMMUSemaphore tlbSem
Definition: smmu_v3.hh:113
SMMUv3::requestorId
const RequestorID requestorId
Definition: smmu_v3.hh:91
ConfigCache
Definition: smmu_v3_caches.hh:234
System
Definition: system.hh:73
SMMURegs
Definition: smmu_v3_defs.hh:100
statistics.hh
SMMUv3::inSecureBlock
bool inSecureBlock(uint32_t offs) const
Definition: smmu_v3.cc:709
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
SMMUv3::translationTimeDist
Stats::Distribution translationTimeDist
Definition: smmu_v3.hh:138
SMMUAction
Definition: smmu_v3_proc.hh:66
smmu_v3_ptops.hh
SMMUv3::commandExecutor
SMMUCommandExecProcess commandExecutor
Definition: smmu_v3.hh:143
SMMUv3::requestPortWidth
const unsigned requestPortWidth
Definition: smmu_v3.hh:111
SMMUv3::tableWalkPort
SMMUTableWalkPort tableWalkPort
Definition: smmu_v3.hh:94
SMMUv3::ptwSem
SMMUSemaphore ptwSem
Definition: smmu_v3.hh:122
SMMURequestPort
Definition: smmu_v3_ports.hh:47
SMMUv3::readControl
Tick readControl(PacketPtr pkt)
Definition: smmu_v3.cc:581
SMMUv3::system
const System & system
Definition: smmu_v3.hh:90
SMMUv3::deviceInterfaces
std::vector< SMMUv3DeviceInterface * > deviceInterfaces
Definition: smmu_v3.hh:141
SMMUv3::packetsToRetry
std::queue< SMMUAction > packetsToRetry
Definition: smmu_v3.hh:150
SMMUCommandExecProcess
Definition: smmu_v3_cmdexec.hh:46
SMMUControlPort
Definition: smmu_v3_ports.hh:94
SMMUv3::steFetches
Stats::Scalar steFetches
Definition: smmu_v3.hh:135
SMMUv3::processCommands
void processCommands()
Definition: smmu_v3.cc:367
SMMUv3::controlPort
SMMUControlPort controlPort
Definition: smmu_v3.hh:95
SMMUv3::ifcSmmuLat
const Cycles ifcSmmuLat
Definition: smmu_v3.hh:127
Stats::Distribution
A simple distribution stat.
Definition: statistics.hh:2617
SMMUv3::smmuIfcLat
const Cycles smmuIfcLat
Definition: smmu_v3.hh:128
smmu_v3_deviceifc.hh
SMMUv3::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: smmu_v3.cc:801
SMMUv3::recvReqRetry
void recvReqRetry()
Definition: smmu_v3.cc:144
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:133
smmu_v3_proc.hh
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:791
SMMUv3::requestPortSem
SMMUSemaphore requestPortSem
Definition: smmu_v3.hh:119
smmu_v3_caches.hh
SMMUv3::tableWalkRecvReqRetry
void tableWalkRecvReqRetry()
Definition: smmu_v3.cc:190
SMMUv3::transSem
SMMUSemaphore transSem
Definition: smmu_v3.hh:121
SMMUv3::steL1Fetches
Stats::Scalar steL1Fetches
Definition: smmu_v3.hh:134
WalkCache
Definition: smmu_v3_caches.hh:281
SMMUv3::ipaSem
SMMUSemaphore ipaSem
Definition: smmu_v3.hh:117
SMMUv3::regStats
virtual void regStats() override
Callback to set stat parameters.
Definition: smmu_v3.cc:739
SMMUv3::configSem
SMMUSemaphore configSem
Definition: smmu_v3.hh:116
clocked_object.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
SMMUTranslationProcess
Definition: smmu_v3_transl.hh:63
SMMUv3::writeControl
Tick writeControl(PacketPtr pkt)
Definition: smmu_v3.cc:614
IPACache
Definition: smmu_v3_caches.hh:194
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
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:817
ARMArchTLB
Definition: smmu_v3_caches.hh:150
SMMUv3::tableWalkPortEnable
bool tableWalkPortEnable
Definition: smmu_v3.hh:106
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
SMMUv3
Definition: smmu_v3.hh:81
PageTableOps
Definition: smmu_v3_ptops.hh:45
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:718
SMMUv3::tableWalkRecvTimingResp
bool tableWalkRecvTimingResp(PacketPtr pkt)
Definition: smmu_v3.cc:173
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
smmu_v3_defs.hh
SMMUv3::SMMUv3
SMMUv3(SMMUv3Params *p)
Definition: smmu_v3.cc:54
CheckpointIn
Definition: serialize.hh:67
SMMUSemaphore
Definition: smmu_v3_proc.hh:77
SMMUv3::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: smmu_v3.cc:809
SMMUv3::processCommand
void processCommand(const SMMUCommand &cmd)
Definition: smmu_v3.cc:383
SMMUv3::ptwTimeDist
Stats::Distribution ptwTimeDist
Definition: smmu_v3.hh:139
SMMUv3::cdL1Fetches
Stats::Scalar cdL1Fetches
Definition: smmu_v3.hh:136
SMMUTableWalkPort
Definition: smmu_v3_ports.hh:61
SMMUv3::walkCacheNonfinalEnable
const bool walkCacheNonfinalEnable
Definition: smmu_v3.hh:108
eventq.hh

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