gem5  v21.0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
hsa_device.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * For use for simulation and test purposes only
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __DEV_HSA_HSA_DEVICE_HH__
35 #define __DEV_HSA_HSA_DEVICE_HH__
36 
37 #include "dev/dma_device.hh"
39 #include "params/HSADevice.hh"
40 
41 class HSADriver;
42 
43 class HSADevice : public DmaDevice
44 {
45  public:
46  typedef HSADeviceParams Params;
47  typedef std::function<void(const uint64_t &)> HsaSignalCallbackFunction;
48 
49  HSADevice(const Params &p) : DmaDevice(p), hsaPP(p.hsapp)
50  {
51  assert(hsaPP);
52  hsaPP->setDevice(this);
53  };
54 
56 
63  virtual void
64  submitAgentDispatchPkt(void *raw_pkt, uint32_t qID, Addr host_pkt_addr)
65  {
66  fatal("%s does not accept dispatch packets\n", name());
67  }
68 
74  virtual void
75  submitDispatchPkt(void *raw_pkt, uint32_t qID, Addr host_pkt_addr)
76  {
77  fatal("%s does not accept dispatch packets\n", name());
78  }
79 
88  virtual void
89  submitVendorPkt(void *raw_pkt, uint32_t queue_id, Addr host_pkt_addr)
90  {
91  fatal("%s does not accept vendor specific packets\n", name());
92  }
93  virtual void
95  {
96  fatal("%s does not need HSA driver\n", name());
97  }
98  virtual void
99  updateHsaSignal(Addr signal_handle, uint64_t signal_value)
100  {
101  fatal("%s does not have HSA signal update functionality.\n", name());
102  }
103  virtual uint64_t
105  {
106  fatal("%s does not have HSA signal read functionality.\n", name());
107  }
108  void dmaReadVirt(Addr host_addr, unsigned size, DmaCallback *cb,
109  void *data, Tick delay = 0);
110  void dmaWriteVirt(Addr host_addr, unsigned size, DmaCallback *cb,
111  void *data, Tick delay = 0);
112 
113  protected:
114  // Typedefing dmaRead and dmaWrite function pointer
115  typedef void (DmaDevice::*DmaFnPtr)(Addr, int, Event*, uint8_t*, Tick);
117  void dmaVirt(DmaFnPtr, Addr host_addr, unsigned size, DmaCallback *cb,
118  void *data, Tick delay = 0);
119  void translateOrDie(Addr vaddr, Addr &paddr);
120 };
121 
122 #endif // __DEV_HSA_HSA_DEVICE_HH__
HSADevice::hsaPP
HSAPacketProcessor * hsaPP
Definition: hsa_device.hh:116
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
HSADevice::HSADevice
HSADevice(const Params &p)
Definition: hsa_device.hh:49
data
const char data[]
Definition: circlebuf.test.cc:47
HSADevice::DmaFnPtr
void(DmaDevice::* DmaFnPtr)(Addr, int, Event *, uint8_t *, Tick)
Definition: hsa_device.hh:115
hsa_packet_processor.hh
HSADevice::dmaWriteVirt
void dmaWriteVirt(Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:53
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:59
HSADevice::dmaReadVirt
void dmaReadVirt(Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:46
HSADevice::functionalReadHsaSignal
virtual uint64_t functionalReadHsaSignal(Addr signal_handle)
Definition: hsa_device.hh:104
HSADevice::submitAgentDispatchPkt
virtual void submitAgentDispatchPkt(void *raw_pkt, uint32_t qID, Addr host_pkt_addr)
submitAgentDispatchPkt() accepts AQL dispatch packets from the HSA packet processor.
Definition: hsa_device.hh:64
HSAPacketProcessor::setDevice
void setDevice(HSADevice *dev)
Definition: hsa_packet_processor.cc:636
HSADevice::updateHsaSignal
virtual void updateHsaSignal(Addr signal_handle, uint64_t signal_value)
Definition: hsa_device.hh:99
HSADevice::submitVendorPkt
virtual void submitVendorPkt(void *raw_pkt, uint32_t queue_id, Addr host_pkt_addr)
submitVendorPkt() accepts vendor specific packets from the HSA packet processor.
Definition: hsa_device.hh:89
dma_device.hh
HSADevice::submitDispatchPkt
virtual void submitDispatchPkt(void *raw_pkt, uint32_t qID, Addr host_pkt_addr)
submitDispatchPkt() accepts AQL dispatch packets from the HSA packet processor.
Definition: hsa_device.hh:75
HSAPacketProcessor
Definition: hsa_packet_processor.hh:212
Event
Definition: eventq.hh:248
MipsISA::vaddr
vaddr
Definition: pra_constants.hh:275
HSADevice::translateOrDie
void translateOrDie(Addr vaddr, Addr &paddr)
HSADevices will perform DMA operations on VAs, and because page faults are not currently supported fo...
Definition: hsa_device.cc:92
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:148
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:182
HSADevice::hsaPacketProc
HSAPacketProcessor & hsaPacketProc()
Definition: hsa_device.cc:40
DmaDevice
Definition: dma_device.hh:200
DmaCallback
DMA callback class.
Definition: dma_device.hh:257
HSADevice::dmaVirt
void dmaVirt(DmaFnPtr, Addr host_addr, unsigned size, DmaCallback *cb, void *data, Tick delay=0)
Definition: hsa_device.cc:60
HSADriver
Definition: hsa_driver.hh:61
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
HSADevice::attachDriver
virtual void attachDriver(HSADriver *driver)
Definition: hsa_device.hh:94
HSADevice::Params
HSADeviceParams Params
Definition: hsa_device.hh:46
HSADevice
Definition: hsa_device.hh:43
HSADevice::HsaSignalCallbackFunction
std::function< void(const uint64_t &)> HsaSignalCallbackFunction
Definition: hsa_device.hh:47
DmaDevice::Params
DmaDeviceParams Params
Definition: dma_device.hh:206

Generated on Tue Jun 22 2021 15:28:27 for gem5 by doxygen 1.8.17