gem5 v24.0.0.0
Loading...
Searching...
No Matches
smmu_v3.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013, 2018-2020, 2024 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"
55#include "mem/packet.hh"
56#include "params/SMMUv3.hh"
57#include "sim/clocked_object.hh"
58#include "sim/eventq.hh"
59
79namespace gem5
80{
81
82class ArmInterruptPin;
83
84class SMMUTranslationProcess;
85
86class SMMUv3 : public ClockedObject
87{
88 protected:
89
90 friend class SMMUProcess;
94
95 const System &system;
97
101
102 // This could be nullptr if wired implementation of the
103 // event queue interrupt is not supported
105
110
111 const bool tlbEnable;
113 const bool ipaCacheEnable;
114 const bool walkCacheEnable;
116
118 const unsigned walkCacheS1Levels;
119 const unsigned walkCacheS2Levels;
120 const unsigned requestPortWidth; // in bytes
121
129
130 SMMUSemaphore transSem; // max N transactions in SMMU
131 SMMUSemaphore ptwSem; // max N concurrent PTWs
132 SMMUSemaphore cycleSem; // max 1 table walk per cycle
133
134 // Timing parameters
141
142 // Stats
153
155
157
159 SMMURegs regs;
160
161 bool inSecureBlock(uint32_t offs) const;
162
163 std::queue<SMMUAction> packetsToRetry;
164 std::queue<SMMUAction> packetsTableWalkToRetry;
165
166
168
172
173 void processCommands();
175
176 void processCommand(const SMMUCommand &cmd);
177
178 public:
179 SMMUv3(const SMMUv3Params &p);
180 virtual ~SMMUv3() {}
181
182 virtual void init() override;
183
186 bool recvTimingResp(PacketPtr pkt);
187 void recvReqRetry();
188
191
194
195 DrainState drain() override;
196 void serialize(CheckpointOut &cp) const override;
197 void unserialize(CheckpointIn &cp) override;
198
199 virtual Port &getPort(const std::string &name,
200 PortID id = InvalidPortID) override;
201};
202
203} // namespace gem5
204
205#endif /* __DEV_ARM_SMMU_V3_HH__ */
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition addr_range.hh:82
Generic representation of an Arm interrupt pin.
Definition base_gic.hh:200
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
Wrap a member function inside MemberEventWrapper to use it as an event callback.
Definition eventq.hh:1092
virtual std::string name() const
Definition named.hh:47
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Ports are used to interface objects to each other.
Definition port.hh:62
const System & system
Definition smmu_v3.hh:95
const Cycles tlbLat
Definition smmu_v3.hh:135
const bool ipaCacheEnable
Definition smmu_v3.hh:113
const unsigned requestPortWidth
Definition smmu_v3.hh:120
SMMUCommandExecProcess commandExecutor
Definition smmu_v3.hh:156
gem5::SMMUv3::SMMUv3Stats stats
const AddrRange regsMap
Definition smmu_v3.hh:158
Tick readControl(PacketPtr pkt)
Definition smmu_v3.cc:572
SMMUSemaphore requestPortSem
Definition smmu_v3.hh:128
Tick recvAtomic(PacketPtr pkt, PortID id)
void recvReqRetry()
Definition smmu_v3.cc:151
SMMUSemaphore walkSem
Definition smmu_v3.hh:127
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition smmu_v3.cc:780
SMMUAction runProcess(SMMUProcess *proc, PacketPtr pkt)
Definition smmu_v3.cc:226
virtual ~SMMUv3()
Definition smmu_v3.hh:180
const bool configCacheEnable
Definition smmu_v3.hh:112
SMMUSemaphore ptwSem
Definition smmu_v3.hh:131
SMMUSemaphore cycleSem
Definition smmu_v3.hh:132
std::vector< SMMUv3DeviceInterface * > deviceInterfaces
Definition smmu_v3.hh:154
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition smmu_v3.cc:788
SMMUSemaphore tlbSem
Definition smmu_v3.hh:122
ARMArchTLB tlb
Definition smmu_v3.hh:106
SMMUSemaphore transSem
Definition smmu_v3.hh:130
ConfigCache configCache
Definition smmu_v3.hh:107
SMMUControlPort controlPort
Definition smmu_v3.hh:100
SMMUTableWalkPort tableWalkPort
Definition smmu_v3.hh:99
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition smmu_v3.cc:715
WalkCache walkCache
Definition smmu_v3.hh:109
const Cycles configLat
Definition smmu_v3.hh:138
SMMUAction runProcessAtomic(SMMUProcess *proc, PacketPtr pkt)
Definition smmu_v3.cc:238
const bool tlbEnable
Definition smmu_v3.hh:111
bool recvTimingResp(PacketPtr pkt)
Definition smmu_v3.cc:134
const Cycles smmuIfcLat
Definition smmu_v3.hh:137
bool inSecureBlock(uint32_t offs) const
Definition smmu_v3.cc:706
ArmInterruptPin *const eventqInterrupt
Definition smmu_v3.hh:104
const Cycles ifcSmmuLat
Definition smmu_v3.hh:136
const bool walkCacheNonfinalEnable
Definition smmu_v3.hh:117
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
Tick writeControl(PacketPtr pkt)
Definition smmu_v3.cc:605
const Cycles walkLat
Definition smmu_v3.hh:140
const unsigned walkCacheS1Levels
Definition smmu_v3.hh:118
SMMURequestPort requestPort
Definition smmu_v3.hh:98
const bool walkCacheEnable
Definition smmu_v3.hh:114
void scheduleDeviceRetries()
Definition smmu_v3.cc:218
std::queue< SMMUAction > packetsTableWalkToRetry
Definition smmu_v3.hh:164
DrainState drain() override
Provide a default implementation of the drain interface for objects that don't need draining.
Definition smmu_v3.cc:770
const unsigned walkCacheS2Levels
Definition smmu_v3.hh:119
IPACache ipaCache
Definition smmu_v3.hh:108
bool tableWalkPortEnable
Definition smmu_v3.hh:115
const RequestorID requestorId
Definition smmu_v3.hh:96
std::queue< SMMUAction > packetsToRetry
Definition smmu_v3.hh:163
bool recvTimingReq(PacketPtr pkt, PortID id)
SMMUSemaphore ifcSmmuSem
Definition smmu_v3.hh:123
void processCommand(const SMMUCommand &cmd)
Definition smmu_v3.cc:390
SMMUSemaphore smmuIfcSem
Definition smmu_v3.hh:124
void tableWalkRecvReqRetry()
Definition smmu_v3.cc:197
SMMURegs regs
Definition smmu_v3.hh:159
SMMUv3(const SMMUv3Params &p)
Definition smmu_v3.cc:59
MemberEventWrapper<&SMMUv3::processCommands > processCommandsEvent
Definition smmu_v3.hh:174
void processCommands()
Definition smmu_v3.cc:374
SMMUAction runProcessTiming(SMMUProcess *proc, PacketPtr pkt)
Definition smmu_v3.cc:287
bool tableWalkRecvTimingResp(PacketPtr pkt)
Definition smmu_v3.cc:180
const Cycles ipaLat
Definition smmu_v3.hh:139
SMMUSemaphore configSem
Definition smmu_v3.hh:125
SMMUSemaphore ipaSem
Definition smmu_v3.hh:126
A simple distribution stat.
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
STL vector class.
Definition stl.hh:37
ClockedObject declaration and implementation.
DrainState
Object drain/handover states.
Definition drain.hh:75
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
const PortID InvalidPortID
Definition types.hh:246
std::ostream CheckpointOut
Definition serialize.hh:66
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition types.hh:245
uint64_t Tick
Tick count type.
Definition types.hh:58
uint16_t RequestorID
Definition request.hh:95
Declaration of the Packet class.
Declaration of Statistics objects.
SMMUv3Stats(statistics::Group *parent)
Definition smmu_v3.cc:735
statistics::Distribution ptwTimeDist
Definition smmu_v3.hh:151
statistics::Scalar cdL1Fetches
Definition smmu_v3.hh:148
statistics::Scalar steL1Fetches
Definition smmu_v3.hh:146
statistics::Scalar steFetches
Definition smmu_v3.hh:147
statistics::Distribution translationTimeDist
Definition smmu_v3.hh:150
statistics::Scalar cdFetches
Definition smmu_v3.hh:149

Generated on Tue Jun 18 2024 16:24:03 for gem5 by doxygen 1.11.0