gem5 v23.0.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
interrupt_handler.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 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_INTERRUPT_HANDLER__
34#define __DEV_AMDGPU_INTERRUPT_HANDLER__
35
36#include <bitset>
37#include <iostream>
38#include <queue>
39#include <vector>
40
41#include "base/addr_range.hh"
42#include "base/flags.hh"
43#include "base/types.hh"
45#include "dev/dma_device.hh"
46#include "params/AMDGPUInterruptHandler.hh"
47
48namespace gem5
49{
50
57{
68};
69
71{
72 CP_EOP = 181,
73 TRAP_ID = 224
74};
75
89constexpr uint32_t INTR_COOKIE_SIZE = 32; // in bytes
90
91typedef struct
92{
93 uint32_t clientId : 8;
94 uint32_t sourceId : 8;
95 uint32_t ringId : 8;
96 uint32_t vmId : 4;
97 uint32_t reserved1 : 3;
98 uint32_t vmid_type : 1;
99 uint32_t timestamp_Lo;
100 uint32_t timestamp_Hi : 16;
101 uint32_t reserved2 : 15;
102 uint32_t timestamp_src : 1;
103 uint32_t pasid : 16;
104 uint32_t reserved3 : 15;
105 uint32_t pasid_src : 1;
111static_assert(sizeof(AMDGPUInterruptCookie) == INTR_COOKIE_SIZE);
112
116typedef struct
117{
118 uint32_t IH_Cntl;
119 uint32_t IH_Base;
120 uint32_t IH_Base_Hi;
122 uint32_t IH_Rptr;
123 uint32_t IH_Wptr;
127 uint32_t IH_Doorbell;
129
131{
132 public:
133 class DmaEvent : public Event
134 {
135 private:
137 uint32_t data;
138
139 public:
142 {
144 }
145 void process();
146 const char *description() const {
147 return "AMDGPUInterruptHandler Dma";
148 }
149
150 void setData(uint32_t _data) { data = _data; }
151 uint32_t getData() { return data; }
152 };
153
155 {
157 : saved(sender_state), _addr(addr)
158 {
159 }
162 };
163
164 AMDGPUInterruptHandler(const AMDGPUInterruptHandlerParams &p);
165
166 Tick write(PacketPtr pkt) override { return 0; }
167 Tick read(PacketPtr pkt) override { return 0; }
168 AddrRangeList getAddrRanges() const override;
169 void serialize(CheckpointOut &cp) const override;
170 void unserialize(CheckpointIn &cp) override;
171
172 void setGPUDevice(AMDGPUDevice *gpu_device) { gpuDevice = gpu_device; }
173 void prepareInterruptCookie(ContextID cntxtId, uint32_t ring_id,
174 uint32_t client_id, uint32_t source_id);
176 void submitWritePointer();
177 void intrPost();
178
182 void writeMMIO(PacketPtr pkt, Addr mmio_offset);
183
184 uint32_t getDoorbellOffset() const { return regs.IH_Doorbell; }
185 void setCntl(const uint32_t &data);
186 void setBase(const uint32_t &data);
187 void setBaseHi(const uint32_t &data);
188 void setRptr(const uint32_t &data);
189 void setWptr(const uint32_t &data);
190 void setWptrAddrLo(const uint32_t &data);
191 void setWptrAddrHi(const uint32_t &data);
192 void setDoorbellOffset(const uint32_t &data);
193 void updateRptr(const uint32_t &data);
194
195 private:
198 std::queue<AMDGPUInterruptCookie*> interruptQueue;
200};
201
202} // namespace gem5
203
204#endif // __DEV_AMDGPU_INTERRUPT_HANDLER__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
const char data[]
Device model for an AMD GPU.
DmaEvent(AMDGPUInterruptHandler *deviceIh, uint32_t data)
const char * description() const
Return a C string describing the event.
void setGPUDevice(AMDGPUDevice *gpu_device)
void prepareInterruptCookie(ContextID cntxtId, uint32_t ring_id, uint32_t client_id, uint32_t source_id)
void setCntl(const uint32_t &data)
void setRptr(const uint32_t &data)
void setWptrAddrLo(const uint32_t &data)
AMDGPUInterruptHandler::DmaEvent * dmaEvent
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void setWptrAddrHi(const uint32_t &data)
void setBase(const uint32_t &data)
void serialize(CheckpointOut &cp) const override
Serialize an object.
void setDoorbellOffset(const uint32_t &data)
void updateRptr(const uint32_t &data)
void setBaseHi(const uint32_t &data)
void setWptr(const uint32_t &data)
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
std::queue< AMDGPUInterruptCookie * > interruptQueue
void writeMMIO(PacketPtr pkt, Addr mmio_offset)
Methods for setting the values of interrupt handler MMIO registers.
static const FlagsType AutoDelete
Definition eventq.hh:110
void setFlags(Flags _flags)
Definition eventq.hh:331
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Bitfield< 0 > p
Bitfield< 3 > addr
Definition types.hh:84
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::ostream CheckpointOut
Definition serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
soc15_ih_clientid
Defines from driver code.
@ SOC15_IH_CLIENTID_SDMA3
@ SOC15_IH_CLIENTID_SDMA4
@ SOC15_IH_CLIENTID_SDMA0
@ SOC15_IH_CLIENTID_GRBM_CP
@ SOC15_IH_CLIENTID_SDMA1
@ SOC15_IH_CLIENTID_SDMA5
@ SOC15_IH_CLIENTID_SDMA2
@ SOC15_IH_CLIENTID_RLC
@ SOC15_IH_CLIENTID_SDMA6
@ SOC15_IH_CLIENTID_SDMA7
uint64_t Tick
Tick count type.
Definition types.hh:58
constexpr uint32_t INTR_COOKIE_SIZE
MSI-style interrupts.
int ContextID
Globally unique thread context ID.
Definition types.hh:239
Struct to contain all interrupt handler related registers.
SenderState(Packet::SenderState *sender_state, Addr addr)
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition packet.hh:469

Generated on Mon Jul 10 2023 15:32:02 for gem5 by doxygen 1.9.7