gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  * Authors: Stan Czerniawski
38  */
39 
40 #ifndef __DEV_ARM_SMMU_V3_HH__
41 #define __DEV_ARM_SMMU_V3_HH__
42 
43 #include <list>
44 #include <map>
45 #include <queue>
46 #include <string>
47 #include <vector>
48 
49 #include "base/statistics.hh"
52 #include "dev/arm/smmu_v3_defs.hh"
54 #include "dev/arm/smmu_v3_ports.hh"
55 #include "dev/arm/smmu_v3_proc.hh"
56 #include "dev/arm/smmu_v3_ptops.hh"
58 #include "mem/packet.hh"
59 #include "params/SMMUv3.hh"
60 #include "sim/clocked_object.hh"
61 #include "sim/eventq.hh"
62 
82 
83 class SMMUv3 : public ClockedObject
84 {
85  protected:
86 
87  friend class SMMUProcess;
88  friend class SMMUTranslationProcess;
89  friend class SMMUCommandExecProcess;
90  friend class SMMUv3SlaveInterface;
91 
92  const System &system;
94 
98 
103 
104  const bool tlbEnable;
105  const bool configCacheEnable;
106  const bool ipaCacheEnable;
107  const bool walkCacheEnable;
109 
111  const unsigned walkCacheS1Levels;
112  const unsigned walkCacheS2Levels;
113  const unsigned masterPortWidth; // in bytes
114 
122 
123  SMMUSemaphore transSem; // max N transactions in SMMU
124  SMMUSemaphore ptwSem; // max N concurrent PTWs
125  SMMUSemaphore cycleSem; // max 1 table walk per cycle
126 
127  // Timing parameters
128  const Cycles tlbLat;
132  const Cycles ipaLat;
134 
135  // Stats
142 
144 
146 
149 
150  bool inSecureBlock(uint32_t offs) const;
151 
152  std::queue<SMMUAction> packetsToRetry;
153  std::queue<SMMUAction> packetsTableWalkToRetry;
154 
155 
156  void scheduleSlaveRetries();
157 
161 
162  void processCommands();
164 
165  void processCommand(const SMMUCommand &cmd);
166 
167  const PageTableOps *getPageTableOps(uint8_t trans_granule);
168 
169  public:
170  SMMUv3(SMMUv3Params *p);
171  virtual ~SMMUv3() {}
172 
173  virtual void init() override;
174  virtual void regStats() override;
175 
177  bool slaveRecvTimingReq(PacketPtr pkt, PortID id);
179  void masterRecvReqRetry();
180 
183 
186 
187  DrainState drain() override;
188  void serialize(CheckpointOut &cp) const override;
189  void unserialize(CheckpointIn &cp) override;
190 
191  virtual Port &getPort(const std::string &name,
192  PortID id = InvalidPortID) override;
193 };
194 
195 #endif /* __DEV_ARM_SMMU_V3_HH__ */
SMMUSemaphore ifcSmmuSem
Definition: smmu_v3.hh:116
const Cycles tlbLat
Definition: smmu_v3.hh:128
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: smmu_v3.cc:810
std::queue< SMMUAction > packetsTableWalkToRetry
Definition: smmu_v3.hh:153
IPACache ipaCache
Definition: smmu_v3.hh:101
Ports are used to interface objects to each other.
Definition: port.hh:60
bool inSecureBlock(uint32_t offs) const
Definition: smmu_v3.cc:710
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
SMMUSemaphore tlbSem
Definition: smmu_v3.hh:115
SMMUAction runProcess(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:221
Stats::Scalar steFetches
Definition: smmu_v3.hh:137
Stats::Distribution translationTimeDist
Definition: smmu_v3.hh:140
std::queue< SMMUAction > packetsToRetry
Definition: smmu_v3.hh:152
const PortID InvalidPortID
Definition: types.hh:238
DrainState
Object drain/handover states.
Definition: drain.hh:71
SMMUSemaphore ptwSem
Definition: smmu_v3.hh:124
SMMUSemaphore ipaSem
Definition: smmu_v3.hh:119
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: smmu_v3.cc:719
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: smmu_v3.cc:802
const Cycles smmuIfcLat
Definition: smmu_v3.hh:130
const Cycles ifcSmmuLat
Definition: smmu_v3.hh:129
Tick readControl(PacketPtr pkt)
Definition: smmu_v3.cc:582
Tick writeControl(PacketPtr pkt)
Definition: smmu_v3.cc:615
void scheduleSlaveRetries()
Definition: smmu_v3.cc:213
const unsigned walkCacheS1Levels
Definition: smmu_v3.hh:111
Definition: system.hh:77
const unsigned masterPortWidth
Definition: smmu_v3.hh:113
EventWrapper< SMMUv3, &SMMUv3::processCommands > processCommandsEvent
Definition: smmu_v3.hh:163
Stats::Scalar steL1Fetches
Definition: smmu_v3.hh:136
Definition: cprintf.cc:42
void processCommand(const SMMUCommand &cmd)
Definition: smmu_v3.cc:384
Tick slaveRecvAtomic(PacketPtr pkt, PortID id)
const bool tlbEnable
Definition: smmu_v3.hh:104
Declaration of Statistics objects.
Stats::Scalar cdFetches
Definition: smmu_v3.hh:139
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2508
STL vector class.
Definition: stl.hh:40
virtual Port & getPort(const std::string &name, PortID id=InvalidPortID) override
Get a port with a given name and index.
Definition: smmu_v3.cc:818
std::vector< SMMUv3SlaveInterface * > slaveInterfaces
Definition: smmu_v3.hh:143
Stats::Scalar cdL1Fetches
Definition: smmu_v3.hh:138
void masterRecvReqRetry()
Definition: smmu_v3.cc:146
SMMUControlPort controlPort
Definition: smmu_v3.hh:97
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:72
void masterTableWalkRecvReqRetry()
Definition: smmu_v3.cc:192
SMMUCommandExecProcess commandExecutor
Definition: smmu_v3.hh:145
SMMUv3(SMMUv3Params *p)
Definition: smmu_v3.cc:56
SMMUSemaphore transSem
Definition: smmu_v3.hh:123
const Cycles ipaLat
Definition: smmu_v3.hh:132
uint64_t Tick
Tick count type.
Definition: types.hh:63
Stats::Distribution ptwTimeDist
Definition: smmu_v3.hh:141
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
A simple distribution stat.
Definition: statistics.hh:2592
SMMUSemaphore smmuIfcSem
Definition: smmu_v3.hh:117
ClockedObject declaration and implementation.
bool masterRecvTimingResp(PacketPtr pkt)
Definition: smmu_v3.cc:129
const Cycles walkLat
Definition: smmu_v3.hh:133
WalkCache walkCache
Definition: smmu_v3.hh:102
DrainState drain() override
Notify an object that it needs to drain its state.
Definition: smmu_v3.cc:792
SMMUSemaphore masterPortSem
Definition: smmu_v3.hh:121
uint16_t MasterID
Definition: request.hh:86
virtual const std::string name() const
Definition: sim_object.hh:120
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:255
SMMUMasterPort masterPort
Definition: smmu_v3.hh:95
ARMArchTLB tlb
Definition: smmu_v3.hh:99
SMMUSemaphore configSem
Definition: smmu_v3.hh:118
virtual ~SMMUv3()
Definition: smmu_v3.hh:171
bool masterTableWalkRecvTimingResp(PacketPtr pkt)
Definition: smmu_v3.cc:175
SMMUAction runProcessTiming(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:282
Declaration of the Packet class.
SMMURegs regs
Definition: smmu_v3.hh:148
std::ostream CheckpointOut
Definition: serialize.hh:68
SMMUSemaphore walkSem
Definition: smmu_v3.hh:120
const System & system
Definition: smmu_v3.hh:92
const PageTableOps * getPageTableOps(uint8_t trans_granule)
Definition: smmu_v3.cc:566
const bool walkCacheNonfinalEnable
Definition: smmu_v3.hh:110
SMMUSemaphore cycleSem
Definition: smmu_v3.hh:125
void processCommands()
Definition: smmu_v3.cc:368
const bool walkCacheEnable
Definition: smmu_v3.hh:107
bool slaveRecvTimingReq(PacketPtr pkt, PortID id)
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
const bool ipaCacheEnable
Definition: smmu_v3.hh:106
const unsigned walkCacheS2Levels
Definition: smmu_v3.hh:112
ConfigCache configCache
Definition: smmu_v3.hh:100
Bitfield< 0 > p
const MasterID masterId
Definition: smmu_v3.hh:93
const bool configCacheEnable
Definition: smmu_v3.hh:105
SMMUAction runProcessAtomic(SMMUProcess *proc, PacketPtr pkt)
Definition: smmu_v3.cc:233
const AddrRange regsMap
Definition: smmu_v3.hh:147
virtual void regStats() override
Callback to set stat parameters.
Definition: smmu_v3.cc:740
bool tableWalkPortEnable
Definition: smmu_v3.hh:108
const Cycles configLat
Definition: smmu_v3.hh:131
SMMUMasterTableWalkPort masterTableWalkPort
Definition: smmu_v3.hh:96

Generated on Fri Feb 28 2020 16:27:00 for gem5 by doxygen 1.8.13