gem5 [DEVELOP-FOR-25.1]
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 "sim/clocked_object.hh"
57#include "sim/eventq.hh"
58
77
78namespace gem5
79{
80
81class ArmInterruptPin;
83class System;
84
85struct SMMUv3Params;
86
87class SMMUv3 : public ClockedObject
88{
89 protected:
90
91 friend class SMMUProcess;
95
96 const System &system;
98
102
103 // This could be nullptr if wired implementation of the
104 // event queue interrupt is not supported
106
111
112 const bool tlbEnable;
114 const bool ipaCacheEnable;
115 const bool walkCacheEnable;
117
119 const unsigned walkCacheS1Levels;
120 const unsigned walkCacheS2Levels;
121 const unsigned requestPortWidth; // in bytes
122
130
131 SMMUSemaphore transSem; // max N transactions in SMMU
132 SMMUSemaphore ptwSem; // max N concurrent PTWs
133 SMMUSemaphore cycleSem; // max 1 table walk per cycle
134
135 // Timing parameters
142
143 // Stats
154
156
158
160 SMMURegs regs;
161
162 bool inSecureBlock(uint32_t offs) const;
163
164 std::queue<SMMUAction> packetsToRetry;
165 std::queue<SMMUAction> packetsTableWalkToRetry;
166
167
169
173
174 void processCommands();
176
177 void processCommand(const SMMUCommand &cmd);
178
179 public:
180 SMMUv3(const SMMUv3Params &p);
181 virtual ~SMMUv3() {}
182
183 virtual void init() override;
184
187 bool recvTimingResp(PacketPtr pkt);
188 void recvReqRetry();
189
192
195
196 DrainState drain() override;
197 void serialize(CheckpointOut &cp) const override;
198 void unserialize(CheckpointIn &cp) override;
199
200 virtual Port &getPort(const std::string &name,
201 PortID id = InvalidPortID) override;
202};
203
204} // namespace gem5
205
206#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
ClockedObject(const ClockedObjectParams &p)
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:60
Ports are used to interface objects to each other.
Definition port.hh:62
const System & system
Definition smmu_v3.hh:96
const Cycles tlbLat
Definition smmu_v3.hh:136
const bool ipaCacheEnable
Definition smmu_v3.hh:114
const unsigned requestPortWidth
Definition smmu_v3.hh:121
SMMUCommandExecProcess commandExecutor
Definition smmu_v3.hh:157
gem5::SMMUv3::SMMUv3Stats stats
const AddrRange regsMap
Definition smmu_v3.hh:159
Tick readControl(PacketPtr pkt)
Definition smmu_v3.cc:573
SMMUSemaphore requestPortSem
Definition smmu_v3.hh:129
Tick recvAtomic(PacketPtr pkt, PortID id)
void recvReqRetry()
Definition smmu_v3.cc:152
SMMUSemaphore walkSem
Definition smmu_v3.hh:128
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition smmu_v3.cc:781
SMMUAction runProcess(SMMUProcess *proc, PacketPtr pkt)
Definition smmu_v3.cc:227
friend class SMMUTranslationProcess
Definition smmu_v3.hh:92
virtual ~SMMUv3()
Definition smmu_v3.hh:181
const bool configCacheEnable
Definition smmu_v3.hh:113
SMMUSemaphore ptwSem
Definition smmu_v3.hh:132
SMMUSemaphore cycleSem
Definition smmu_v3.hh:133
std::vector< SMMUv3DeviceInterface * > deviceInterfaces
Definition smmu_v3.hh:155
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition smmu_v3.cc:789
SMMUSemaphore tlbSem
Definition smmu_v3.hh:123
ARMArchTLB tlb
Definition smmu_v3.hh:107
SMMUSemaphore transSem
Definition smmu_v3.hh:131
ConfigCache configCache
Definition smmu_v3.hh:108
SMMUControlPort controlPort
Definition smmu_v3.hh:101
SMMUTableWalkPort tableWalkPort
Definition smmu_v3.hh:100
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition smmu_v3.cc:716
friend class SMMUv3DeviceInterface
Definition smmu_v3.hh:94
WalkCache walkCache
Definition smmu_v3.hh:110
const Cycles configLat
Definition smmu_v3.hh:139
SMMUAction runProcessAtomic(SMMUProcess *proc, PacketPtr pkt)
Definition smmu_v3.cc:239
const bool tlbEnable
Definition smmu_v3.hh:112
bool recvTimingResp(PacketPtr pkt)
Definition smmu_v3.cc:135
const Cycles smmuIfcLat
Definition smmu_v3.hh:138
bool inSecureBlock(uint32_t offs) const
Definition smmu_v3.cc:707
ArmInterruptPin *const eventqInterrupt
Definition smmu_v3.hh:105
const Cycles ifcSmmuLat
Definition smmu_v3.hh:137
const bool walkCacheNonfinalEnable
Definition smmu_v3.hh:118
virtual Port & getPort(const std::string &name, PortID id=InvalidPortID) override
Get a port with a given name and index.
Definition smmu_v3.cc:797
Tick writeControl(PacketPtr pkt)
Definition smmu_v3.cc:606
const Cycles walkLat
Definition smmu_v3.hh:141
const unsigned walkCacheS1Levels
Definition smmu_v3.hh:119
SMMURequestPort requestPort
Definition smmu_v3.hh:99
const bool walkCacheEnable
Definition smmu_v3.hh:115
void scheduleDeviceRetries()
Definition smmu_v3.cc:219
std::queue< SMMUAction > packetsTableWalkToRetry
Definition smmu_v3.hh:165
DrainState drain() override
Provide a default implementation of the drain interface for objects that don't need draining.
Definition smmu_v3.cc:771
const unsigned walkCacheS2Levels
Definition smmu_v3.hh:120
IPACache ipaCache
Definition smmu_v3.hh:109
bool tableWalkPortEnable
Definition smmu_v3.hh:116
const RequestorID requestorId
Definition smmu_v3.hh:97
std::queue< SMMUAction > packetsToRetry
Definition smmu_v3.hh:164
bool recvTimingReq(PacketPtr pkt, PortID id)
SMMUSemaphore ifcSmmuSem
Definition smmu_v3.hh:124
friend class SMMUCommandExecProcess
Definition smmu_v3.hh:93
void processCommand(const SMMUCommand &cmd)
Definition smmu_v3.cc:391
SMMUSemaphore smmuIfcSem
Definition smmu_v3.hh:125
void tableWalkRecvReqRetry()
Definition smmu_v3.cc:198
SMMURegs regs
Definition smmu_v3.hh:160
SMMUv3(const SMMUv3Params &p)
Definition smmu_v3.cc:60
MemberEventWrapper<&SMMUv3::processCommands > processCommandsEvent
Definition smmu_v3.hh:175
void processCommands()
Definition smmu_v3.cc:375
SMMUAction runProcessTiming(SMMUProcess *proc, PacketPtr pkt)
Definition smmu_v3.cc:288
bool tableWalkRecvTimingResp(PacketPtr pkt)
Definition smmu_v3.cc:181
const Cycles ipaLat
Definition smmu_v3.hh:140
friend class SMMUProcess
Definition smmu_v3.hh:91
SMMUSemaphore configSem
Definition smmu_v3.hh:126
SMMUSemaphore ipaSem
Definition smmu_v3.hh:127
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:76
Bitfield< 0 > p
Copyright (c) 2024 Arm Limited 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
Packet * PacketPtr
Declaration of the Packet class.
Declaration of Statistics objects.
SMMUv3Stats(statistics::Group *parent)
Definition smmu_v3.cc:736
statistics::Distribution ptwTimeDist
Definition smmu_v3.hh:152
statistics::Scalar cdL1Fetches
Definition smmu_v3.hh:149
statistics::Scalar steL1Fetches
Definition smmu_v3.hh:147
statistics::Scalar steFetches
Definition smmu_v3.hh:148
statistics::Distribution translationTimeDist
Definition smmu_v3.hh:151
statistics::Scalar cdFetches
Definition smmu_v3.hh:150

Generated on Mon Oct 27 2025 04:13:01 for gem5 by doxygen 1.14.0