Go to the documentation of this file.
40 #include "debug/NoMali.hh"
43 #include "enums/MemoryMode.hh"
45 #include "nomali/lib/mali_midg_regmap.h"
46 #include "params/CustomNoMaliGpu.hh"
47 #include "params/NoMaliGpu.hh"
52 static const std::map<enums::NoMaliGpuType, nomali_gpu_type_t>
gpuTypeMap{
53 { enums::T60x, NOMALI_GPU_T60X },
54 { enums::T62x, NOMALI_GPU_T62X },
55 { enums::T760, NOMALI_GPU_T760 },
63 { NOMALI_INT_GPU,
p.int_gpu },
64 { NOMALI_INT_JOB,
p.int_job },
65 { NOMALI_INT_MMU,
p.int_mmu },
68 if (nomali_api_version() != NOMALI_API_VERSION)
69 panic(
"NoMali library API mismatch!\n");
73 memset(&cfg, 0,
sizeof(cfg));
77 fatal(
"Unrecognized GPU type: %s (%i)\n",
78 enums::NoMaliGpuTypeStrings[
p.gpu_type],
p.gpu_type);
80 cfg.type = it_gpu->second;
82 cfg.ver_maj =
p.ver_maj;
83 cfg.ver_min =
p.ver_min;
84 cfg.ver_status =
p.ver_status;
87 nomali_create(&nomali, &cfg),
88 "Failed to instantiate NoMali");
92 nomali_callback_t cbk_int;
93 cbk_int.type = NOMALI_CALLBACK_INT;
94 cbk_int.usr = (
void *)
this;
99 nomali_callback_t cbk_rst;
100 cbk_rst.type = NOMALI_CALLBACK_RESET;
101 cbk_rst.usr = (
void *)
this;
103 setCallback(cbk_rst);
106 nomali_get_info(nomali, &nomaliInfo),
107 "Failed to get NoMali information struct");
154 const unsigned size(pkt->
getSize());
157 panic(
"GPU register '0x%x' out of range!\n",
addr);
160 panic(
"Unexpected GPU register read size: %i\n", size);
162 panic(
"Unaligned GPU read: %i\n", size);
175 const unsigned size(pkt->
getSize());
178 panic(
"GPU register '0x%x' out of range!\n",
addr);
181 panic(
"Unexpected GPU register write size: %i\n", size);
183 panic(
"Unaligned GPU write: %i\n", size);
204 "Failed to reset GPU");
214 "GPU register read failed");
216 DPRINTF(NoMali,
"readReg(0x%x): 0x%x\n",
226 DPRINTF(NoMali,
"writeReg(0x%x, 0x%x)\n",
231 "GPU register write failed");
240 nomali_reg_read_raw(
nomali, &value,
reg),
241 "GPU raw register read failed");
251 nomali_reg_write_raw(
nomali,
reg, value),
252 "GPU raw register write failed");
261 "Failed to get interrupt state");
269 panic(
"%s: %s\n", msg, nomali_errstr(
err));
278 panic(
"Unhandled interrupt from NoMali: %i\n", intno);
280 DPRINTF(NoMali,
"Interrupt %i->%i: %i\n",
281 intno, it_int->second,
set);
301 DPRINTF(NoMali,
"Registering callback %i\n",
305 nomali_set_callback(
nomali, &callback),
306 "Failed to register callback");
311 nomali_int_t intno,
int set)
330 { GPU_CONTROL_REG(GPU_ID),
p.gpu_id },
331 { GPU_CONTROL_REG(L2_FEATURES),
p.l2_features },
332 { GPU_CONTROL_REG(TILER_FEATURES),
p.tiler_features },
333 { GPU_CONTROL_REG(MEM_FEATURES),
p.mem_features },
334 { GPU_CONTROL_REG(MMU_FEATURES),
p.mmu_features },
335 { GPU_CONTROL_REG(AS_PRESENT),
p.as_present },
336 { GPU_CONTROL_REG(JS_PRESENT),
p.js_present },
338 { GPU_CONTROL_REG(THREAD_MAX_THREADS),
p.thread_max_threads },
339 { GPU_CONTROL_REG(THREAD_MAX_WORKGROUP_SIZE),
340 p.thread_max_workgroup_size },
341 { GPU_CONTROL_REG(THREAD_MAX_BARRIER_SIZE),
342 p.thread_max_barrier_size },
343 { GPU_CONTROL_REG(THREAD_FEATURES),
p.thread_features },
345 { GPU_CONTROL_REG(SHADER_PRESENT_LO),
bits(
p.shader_present, 31, 0) },
346 { GPU_CONTROL_REG(SHADER_PRESENT_HI),
bits(
p.shader_present, 63, 32) },
347 { GPU_CONTROL_REG(TILER_PRESENT_LO),
bits(
p.tiler_present, 31, 0) },
348 { GPU_CONTROL_REG(TILER_PRESENT_HI),
bits(
p.tiler_present, 63, 32) },
349 { GPU_CONTROL_REG(L2_PRESENT_LO),
bits(
p.l2_present, 31, 0) },
350 { GPU_CONTROL_REG(L2_PRESENT_HI),
bits(
p.l2_present, 63, 32) },
354 "Too many texture feature registers specified (%i)\n",
355 p.texture_features.size());
358 "Too many job slot feature registers specified (%i)\n",
359 p.js_features.size());
361 for (
int i = 0;
i <
p.texture_features.size();
i++)
362 idRegs[TEXTURE_FEATURES_REG(
i)] =
p.texture_features[
i];
364 for (
int i = 0;
i <
p.js_features.size();
i++)
365 idRegs[JS_FEATURES_REG(
i)] =
p.js_features[
i];
#define fatal(...)
This implements a cprintf based fatal() function.
NoMaliGpu(const NoMaliGpuParams &p)
void writeRegRaw(nomali_addr_t reg, uint32_t value)
Wrapper around nomali_reg_write_raw().
bool intState(nomali_int_t intno)
Wrapper around nomali_int_state()
This device is the base class which all devices senstive to an address range inherit from.
static const std::map< enums::NoMaliGpuType, nomali_gpu_type_t > gpuTypeMap
AddrRange RangeSize(Addr start, Addr size)
#define UNSERIALIZE_CONTAINER(member)
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
virtual void onInterrupt(nomali_int_t intno, bool set)
Interrupt callback from the NoMali library.
uint32_t readReg(nomali_addr_t reg)
Wrapper around nomali_reg_read().
static void _reset(nomali_handle_t h, void *usr)
Reset callback from the NoMali library.
void reset()
Wrapper around nomali_reset().
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
void makeAtomicResponse()
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void setCallback(const nomali_callback_t &callback)
Wrapper around nomali_set_callback()
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
static void _interrupt(nomali_handle_t h, void *usr, nomali_int_t intno, int set)
Interrupt callback from the NoMali library.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
uint64_t Tick
Tick count type.
static void gpuPanic(nomali_error_t err, const char *msg)
Format a NoMali error into an error message and panic.
virtual void onReset()
Reset callback from the NoMali library.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
virtual void sendInt(uint32_t num)=0
Post an interrupt from a device that is connected to the GIC.
const std::map< nomali_int_t, uint32_t > interruptMap
Map between NoMali interrupt types and actual GIC interrupts.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual ~CustomNoMaliGpu()
void onReset() override
Reset callback from the NoMali library.
CustomNoMaliGpu(const CustomNoMaliGpuParams &p)
RealView *const platform
Platform, used to discover GIC.
virtual void clearInt(uint32_t num)=0
Clear an interrupt from a device that is connected to the GIC.
#define SERIALIZE_CONTAINER(member)
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
const Addr pioAddr
Device base address.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
std::ostream CheckpointOut
void setLE(T v)
Set the value in the data pointer to v as little endian.
void writeReg(nomali_addr_t reg, uint32_t value)
Wrapper around nomali_reg_write().
void serialize(CheckpointOut &cp) const override
Serialize an object.
nomali_info_t nomaliInfo
Cached information struct from the NoMali library.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
std::map< nomali_addr_t, uint32_t > idRegs
Map between GPU registers and their custom reset values.
static void panicOnErr(nomali_error_t err, const char *msg)
Panic if the NoMali returned an error, do nothing otherwise.
#define panic(...)
This implements a cprintf based panic() function.
nomali_handle_t nomali
Handle of a NoMali library instance.
uint32_t readRegRaw(nomali_addr_t reg) const
Wrapper around nomali_reg_read_raw().
Generated on Sun Jul 30 2023 01:56:54 for gem5 by doxygen 1.8.17