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"
49 static const std::map<Enums::NoMaliGpuType, nomali_gpu_type_t>
gpuTypeMap{
50 { Enums::T60x, NOMALI_GPU_T60X },
51 { Enums::T62x, NOMALI_GPU_T62X },
52 { Enums::T760, NOMALI_GPU_T760 },
58 platform(
p->platform),
60 { NOMALI_INT_GPU,
p->int_gpu },
61 { NOMALI_INT_JOB,
p->int_job },
62 { NOMALI_INT_MMU,
p->int_mmu },
65 if (nomali_api_version() != NOMALI_API_VERSION)
66 panic(
"NoMali library API mismatch!\n");
70 memset(&cfg, 0,
sizeof(cfg));
74 fatal(
"Unrecognized GPU type: %s (%i)\n",
75 Enums::NoMaliGpuTypeStrings[
p->gpu_type],
p->gpu_type);
77 cfg.type = it_gpu->second;
79 cfg.ver_maj =
p->ver_maj;
80 cfg.ver_min =
p->ver_min;
81 cfg.ver_status =
p->ver_status;
84 nomali_create(&nomali, &cfg),
85 "Failed to instantiate NoMali");
89 nomali_callback_t cbk_int;
90 cbk_int.type = NOMALI_CALLBACK_INT;
91 cbk_int.usr = (
void *)
this;
96 nomali_callback_t cbk_rst;
97 cbk_rst.type = NOMALI_CALLBACK_RESET;
98 cbk_rst.usr = (
void *)
this;
100 setCallback(cbk_rst);
103 nomali_get_info(nomali, &nomaliInfo),
104 "Failed to get NoMali information struct");
154 panic(
"GPU register '0x%x' out of range!\n",
addr);
157 panic(
"Unexpected GPU register read size: %i\n",
size);
175 panic(
"GPU register '0x%x' out of range!\n",
addr);
178 panic(
"Unexpected GPU register write size: %i\n",
size);
180 panic(
"Unaligned GPU write: %i\n",
size);
201 "Failed to reset GPU");
211 "GPU register read failed");
213 DPRINTF(NoMali,
"readReg(0x%x): 0x%x\n",
223 DPRINTF(NoMali,
"writeReg(0x%x, 0x%x)\n",
228 "GPU register write failed");
237 nomali_reg_read_raw(
nomali, &value,
reg),
238 "GPU raw register read failed");
248 nomali_reg_write_raw(
nomali,
reg, value),
249 "GPU raw register write failed");
257 nomali_int_state(
nomali, &state, intno),
258 "Failed to get interrupt state");
266 panic(
"%s: %s\n", msg, nomali_errstr(
err));
275 panic(
"Unhandled interrupt from NoMali: %i\n", intno);
277 DPRINTF(NoMali,
"Interrupt %i->%i: %i\n",
278 intno, it_int->second, set);
298 DPRINTF(NoMali,
"Registering callback %i\n",
302 nomali_set_callback(
nomali, &callback),
303 "Failed to register callback");
308 nomali_int_t intno,
int set)
327 { GPU_CONTROL_REG(GPU_ID),
p->gpu_id },
328 { GPU_CONTROL_REG(L2_FEATURES),
p->l2_features },
329 { GPU_CONTROL_REG(TILER_FEATURES),
p->tiler_features },
330 { GPU_CONTROL_REG(MEM_FEATURES),
p->mem_features },
331 { GPU_CONTROL_REG(MMU_FEATURES),
p->mmu_features },
332 { GPU_CONTROL_REG(AS_PRESENT),
p->as_present },
333 { GPU_CONTROL_REG(JS_PRESENT),
p->js_present },
335 { GPU_CONTROL_REG(THREAD_MAX_THREADS),
p->thread_max_threads },
336 { GPU_CONTROL_REG(THREAD_MAX_WORKGROUP_SIZE),
337 p->thread_max_workgroup_size },
338 { GPU_CONTROL_REG(THREAD_MAX_BARRIER_SIZE),
339 p->thread_max_barrier_size },
340 { GPU_CONTROL_REG(THREAD_FEATURES),
p->thread_features },
342 { GPU_CONTROL_REG(SHADER_PRESENT_LO),
bits(
p->shader_present, 31, 0) },
343 { GPU_CONTROL_REG(SHADER_PRESENT_HI),
bits(
p->shader_present, 63, 32) },
344 { GPU_CONTROL_REG(TILER_PRESENT_LO),
bits(
p->tiler_present, 31, 0) },
345 { GPU_CONTROL_REG(TILER_PRESENT_HI),
bits(
p->tiler_present, 63, 32) },
346 { GPU_CONTROL_REG(L2_PRESENT_LO),
bits(
p->l2_present, 31, 0) },
347 { GPU_CONTROL_REG(L2_PRESENT_HI),
bits(
p->l2_present, 63, 32) },
351 "Too many texture feature registers specified (%i)\n",
352 p->texture_features.size());
355 "Too many job slot feature registers specified (%i)\n",
356 p->js_features.size());
358 for (
int i = 0;
i <
p->texture_features.size();
i++)
359 idRegs[TEXTURE_FEATURES_REG(
i)] =
p->texture_features[
i];
361 for (
int i = 0;
i <
p->js_features.size();
i++)
362 idRegs[JS_FEATURES_REG(
i)] =
p->js_features[
i];
381 NoMaliGpuParams::create()
387 CustomNoMaliGpuParams::create()
nomali_info_t nomaliInfo
Cached information struct from the NoMali library.
#define fatal(...)
This implements a cprintf based fatal() function.
void makeAtomicResponse()
Addr pioAddr
Address that the device listens to.
void writeRegRaw(nomali_addr_t reg, uint32_t value)
Wrapper around nomali_reg_write_raw().
virtual void onInterrupt(nomali_int_t intno, bool set)
Interrupt callback from the NoMali library.
static void panicOnErr(nomali_error_t err, const char *msg)
Panic if the NoMali returned an error, do nothing otherwise.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
#define UNSERIALIZE_CONTAINER(member)
virtual void onReset()
Reset callback from the NoMali library.
uint64_t Tick
Tick count type.
const std::map< nomali_int_t, uint32_t > interruptMap
Map between NoMali interrupt types and actual GIC interrupts.
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
void onReset() override
Reset callback from the NoMali library.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void setCallback(const nomali_callback_t &callback)
Wrapper around nomali_set_callback()
void reset()
Wrapper around nomali_reset().
CustomNoMaliGpu(const CustomNoMaliGpuParams *p)
static const std::map< Enums::NoMaliGpuType, nomali_gpu_type_t > gpuTypeMap
virtual ~CustomNoMaliGpu()
This device is the base class which all devices senstive to an address range inherit from.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
uint32_t readReg(nomali_addr_t reg)
Wrapper around nomali_reg_read().
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void writeReg(nomali_addr_t reg, uint32_t value)
Wrapper around nomali_reg_write().
AddrRange RangeSize(Addr start, Addr size)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
virtual void sendInt(uint32_t num)=0
Post an interrupt from a device that is connected to the GIC.
static void _reset(nomali_handle_t h, void *usr)
Reset callback from the NoMali library.
virtual void clearInt(uint32_t num)=0
Clear an interrupt from a device that is connected to the GIC.
std::map< nomali_addr_t, uint32_t > idRegs
Map between GPU registers and their custom reset values.
RealView *const platform
Platform, used to discover GIC.
nomali_handle_t nomali
Handle of a NoMali library instance.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
static void gpuPanic(nomali_error_t err, const char *msg) M5_ATTR_NORETURN
Format a NoMali error into an error message and panic.
NoMaliGpu(const NoMaliGpuParams *p)
const Addr pioAddr
Device base address.
#define SERIALIZE_CONTAINER(member)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
uint32_t readRegRaw(nomali_addr_t reg) const
Wrapper around nomali_reg_read_raw().
void setLE(T v)
Set the value in the data pointer to v as little endian.
std::ostream CheckpointOut
bool intState(nomali_int_t intno)
Wrapper around nomali_int_state()
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
void serialize(CheckpointOut &cp) const override
Serialize an object.
static void _interrupt(nomali_handle_t h, void *usr, nomali_int_t intno, int set)
Interrupt callback from the NoMali library.
#define panic(...)
This implements a cprintf based panic() function.
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Generated on Wed Sep 30 2020 14:02:10 for gem5 by doxygen 1.8.17