gem5 v24.0.0.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
94{
95 public:
96 AMDGPUNbio();
97
98 void setGPUDevice(AMDGPUDevice *gpu_device);
99
100 void readMMIO(PacketPtr pkt, Addr offset);
101 void writeMMIO(PacketPtr pkt, Addr offset);
102
103 bool readFrame(PacketPtr pkt, Addr offset);
104 void writeFrame(PacketPtr pkt, Addr offset);
105
106 private:
108
109 /*
110 * Driver initialization sequence helper variables.
111 */
112 uint64_t mm_index_reg = 0;
113 uint32_t pcie_index_reg = 0;
114 uint32_t pcie_index2_reg = 0;
115 std::unordered_map<uint32_t, uint32_t> triggered_reads;
116
117 /*
118 * PSP variables used in initialization.
119 */
125
126 /*
127 * Hold values of other registers not explicitly modelled by other blocks.
128 */
129 using GPURegMap = std::unordered_map<uint64_t, uint32_t>;
131};
132
133} // namespace gem5
134
135#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)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Bitfield< 23, 0 > offset
Definition types.hh:144
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria 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
Declaration of the Packet class.

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