gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
amdgpu_nbio.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Advanced Micro Devices, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33#ifndef __DEV_AMDGPU_AMDGPU_NBIO__
34#define __DEV_AMDGPU_AMDGPU_NBIO__
35
36#include <unordered_map>
37
38#include "base/types.hh"
39#include "mem/packet.hh"
40
41namespace gem5
42{
43
44class AMDGPUDevice;
45
56#define AMDGPU_MM_INDEX 0x00000
57#define AMDGPU_MM_INDEX_HI 0x00018
58#define AMDGPU_MM_DATA 0x00004
59
60#define AMDGPU_PCIE_INDEX 0x00030
61#define AMDGPU_PCIE_INDEX2 0x00038
62#define AMDGPU_PCIE_DATA 0x00034
63#define AMDGPU_PCIE_DATA2 0x0003c
64
65// Message bus related to psp
66#define AMDGPU_MP0_SMN_C2PMSG_33 0x58184
67#define AMDGPU_MP0_SMN_C2PMSG_35 0x5818c
68#define AMDGPU_MP0_SMN_C2PMSG_64 0x58200
69#define AMDGPU_MP0_SMN_C2PMSG_69 0x58214
70#define AMDGPU_MP0_SMN_C2PMSG_70 0x58218
71#define AMDGPU_MP0_SMN_C2PMSG_71 0x5821c
72#define AMDGPU_MP0_SMN_C2PMSG_81 0x58244
73#define AMDGPU_MP1_SMN_C2PMSG_90 0x58a68
74
75// Device specific invalidation engines used during initialization
76#define VEGA10_INV_ENG17_ACK1 0x0a318
77#define VEGA10_INV_ENG17_ACK2 0x69c18
78#define VEGA10_INV_ENG17_SEM1 0x0a288
79#define VEGA10_INV_ENG17_SEM2 0x69b88
80
81#define MI100_INV_ENG17_ACK1 0x0a318
82#define MI100_INV_ENG17_ACK2 0x6a918
83#define MI100_INV_ENG17_ACK3 0x76918
84#define MI100_INV_ENG17_SEM1 0x0a288
85#define MI100_INV_ENG17_SEM2 0x6a888
86#define MI100_INV_ENG17_SEM3 0x76888
87
88#define MI200_INV_ENG17_ACK1 0x0a318
89#define MI200_INV_ENG17_ACK2 0x6b018
90#define MI200_INV_ENG17_SEM1 0x0a288
91#define MI200_INV_ENG17_SEM2 0x6af88
92
93#define MI300X_INV_ENG17_ACK1 0x4a298
94#define MI300X_INV_ENG17_ACK2 0x62f98
95#define MI300X_INV_ENG17_ACK3 0x8a298
96#define MI300X_INV_ENG17_ACK4 0xca298
97#define MI300X_INV_ENG17_ACK5 0x10a298
98#define MI300X_INV_ENG17_ACK6 0x14a298
99#define MI300X_INV_ENG17_ACK7 0x18a298
100#define MI300X_INV_ENG17_ACK8 0x1ca298
101#define MI300X_INV_ENG17_ACK9 0xe2f98
102#define MI300X_INV_ENG17_ACK10 0x162f98
103#define MI300X_INV_ENG17_ACK11 0x1e2f98
104#define MI300X_EPF0_STRAP0 0x34d8
105
107{
108 public:
109 AMDGPUNbio();
110
111 void setGPUDevice(AMDGPUDevice *gpu_device);
112
113 void readMMIO(PacketPtr pkt, Addr offset);
114 void writeMMIO(PacketPtr pkt, Addr offset);
115
116 bool readFrame(PacketPtr pkt, Addr offset);
117 void writeFrame(PacketPtr pkt, Addr offset);
118
119 private:
121
122 /*
123 * Driver initialization sequence helper variables.
124 */
125 uint64_t mm_index_reg = 0;
126 uint32_t pcie_index_reg = 0;
127 uint32_t pcie_index2_reg = 0;
128 std::unordered_map<uint32_t, uint32_t> triggered_reads;
129
130 /*
131 * PSP variables used in initialization.
132 */
138
139 /*
140 * Hold values of other registers not explicitly modelled by other blocks.
141 */
142 using GPURegMap = std::unordered_map<uint64_t, uint32_t>;
144};
145
146} // namespace gem5
147
148#endif // __DEV_AMDGPU_AMDGPU_NBIO__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Device model for an AMD GPU.
void readMMIO(PacketPtr pkt, Addr offset)
uint32_t pcie_index2_reg
std::unordered_map< uint32_t, uint32_t > triggered_reads
void writeMMIO(PacketPtr pkt, Addr offset)
bool readFrame(PacketPtr pkt, Addr offset)
uint64_t mm_index_reg
AMDGPUDevice * gpuDevice
uint32_t pcie_index_reg
std::unordered_map< uint64_t, uint32_t > GPURegMap
void writeFrame(PacketPtr pkt, Addr offset)
void setGPUDevice(AMDGPUDevice *gpu_device)
Bitfield< 23, 0 > offset
Definition types.hh:144
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
Packet * PacketPtr
Declaration of the Packet class.

Generated on Mon May 26 2025 09:19:09 for gem5 by doxygen 1.13.2