diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2016-09-06 10:22:38 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2016-09-06 10:22:38 +0100 |
commit | 3329de1e86e490f380e9c32e26b03df6ce8a4acd (patch) | |
tree | 1fad9bbb61bdfd5546c66906d97c459eb4d74512 /src | |
parent | 0da55e5dbc4ac5db97a28ddef008eb0f1d3cd83f (diff) | |
download | gem5-3329de1e86e490f380e9c32e26b03df6ce8a4acd.tar.xz |
dev, arm: Add a customizable NoMali GPU model
Add a customizable NoMali GPU model and an example Mali T760
configuration. Unlike the normal NoMali model (NoMaliGpu), the
NoMaliCustopmGpu model exposes all the important GPU ID registers to
Python. This makes it possible to implement custom GPU configurations
by without changing the underlying NoMali library.
Change-Id: I4fdba05844c3589893aa1a4c11dc376ec33d4e9e
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Andreas Hansson <andreas.hansson@arm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/dev/arm/NoMali.py | 66 | ||||
-rw-r--r-- | src/dev/arm/gpu_nomali.cc | 65 | ||||
-rw-r--r-- | src/dev/arm/gpu_nomali.hh | 15 |
3 files changed, 145 insertions, 1 deletions
diff --git a/src/dev/arm/NoMali.py b/src/dev/arm/NoMali.py index c4465c37a..4272f90d0 100644 --- a/src/dev/arm/NoMali.py +++ b/src/dev/arm/NoMali.py @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2015 ARM Limited +# Copyright (c) 2014-2016 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -61,3 +61,67 @@ class NoMaliGpu(PioDevice): int_gpu = Param.UInt32("Interrupt number for GPU interrupts") int_job = Param.UInt32("Interrupt number for JOB interrupts") int_mmu = Param.UInt32("Interrupt number for MMU interrupts") + +class CustomNoMaliGpu(NoMaliGpu): + """Base class for custom NoMali implementation that need to override + configuration registers. See CustomNoMaliT760 for a usage example. + + """ + + type = 'CustomNoMaliGpu' + cxx_header = "dev/arm/gpu_nomali.hh" + + gpu_id = Param.UInt32("") + l2_features = Param.UInt32("") + tiler_features = Param.UInt32("") + mem_features = Param.UInt32("") + mmu_features = Param.UInt32("") + as_present = Param.UInt32("") + js_present = Param.UInt32("") + + thread_max_threads = Param.UInt32("") + thread_max_workgroup_size = Param.UInt32("") + thread_max_barrier_size = Param.UInt32("") + thread_features = Param.UInt32("") + + texture_features = VectorParam.UInt32("") + js_features = VectorParam.UInt32("") + + shader_present = Param.UInt64("") + tiler_present = Param.UInt64("") + l2_present = Param.UInt64("") + +class CustomNoMaliT760(CustomNoMaliGpu): + """Example NoMali T760 r0p0-0 configuration using the defaults from + the NoMali library. + + """ + + gpu_id = 0x07500000 + + l2_features = 0x07130206 + tiler_features = 0x00000809 + mem_features = 0x00000001 + mmu_features = 0x00002830 + as_present = 0x000000ff + js_present = 0x00000007 + + thread_max_threads = 0x00000100 + thread_max_workgroup_size = 0x00000100 + thread_max_barrier_size = 0x00000100 + thread_features = 0x0a040400 + + texture_features = [ + 0x00fe001e, + 0x0000ffff, + 0x9f81ffff, + ] + js_features = [ + 0x0000020e, + 0x000001fe, + 0x0000007e, + ] + + shader_present = 0x0000000f + tiler_present = 0x00000001 + l2_present = 0x00000001 diff --git a/src/dev/arm/gpu_nomali.cc b/src/dev/arm/gpu_nomali.cc index da0f43ef9..a6c3e29e5 100644 --- a/src/dev/arm/gpu_nomali.cc +++ b/src/dev/arm/gpu_nomali.cc @@ -44,6 +44,8 @@ #include "dev/arm/realview.hh" #include "enums/MemoryMode.hh" #include "mem/packet_access.hh" +#include "nomali/lib/mali_midg_regmap.h" +#include "params/CustomNoMaliGpu.hh" #include "params/NoMaliGpu.hh" static const std::map<Enums::NoMaliGpuType, nomali_gpu_type_t> gpuTypeMap{ @@ -320,8 +322,71 @@ NoMaliGpu::_reset(nomali_handle_t h, void *usr) _this->onReset(); } + +CustomNoMaliGpu::CustomNoMaliGpu(const CustomNoMaliGpuParams *p) + : NoMaliGpu(p), + idRegs{ + { GPU_CONTROL_REG(GPU_ID), p->gpu_id }, + { GPU_CONTROL_REG(L2_FEATURES), p->l2_features }, + { GPU_CONTROL_REG(TILER_FEATURES), p->tiler_features }, + { GPU_CONTROL_REG(MEM_FEATURES), p->mem_features }, + { GPU_CONTROL_REG(MMU_FEATURES), p->mmu_features }, + { GPU_CONTROL_REG(AS_PRESENT), p->as_present }, + { GPU_CONTROL_REG(JS_PRESENT), p->js_present }, + + { GPU_CONTROL_REG(THREAD_MAX_THREADS), p->thread_max_threads }, + { GPU_CONTROL_REG(THREAD_MAX_WORKGROUP_SIZE), + p->thread_max_workgroup_size }, + { GPU_CONTROL_REG(THREAD_MAX_BARRIER_SIZE), + p->thread_max_barrier_size }, + { GPU_CONTROL_REG(THREAD_FEATURES), p->thread_features }, + + { GPU_CONTROL_REG(SHADER_PRESENT_LO), bits(p->shader_present, 31, 0) }, + { GPU_CONTROL_REG(SHADER_PRESENT_HI), bits(p->shader_present, 63, 32) }, + { GPU_CONTROL_REG(TILER_PRESENT_LO), bits(p->tiler_present, 31, 0) }, + { GPU_CONTROL_REG(TILER_PRESENT_HI), bits(p->tiler_present, 63, 32) }, + { GPU_CONTROL_REG(L2_PRESENT_LO), bits(p->l2_present, 31, 0) }, + { GPU_CONTROL_REG(L2_PRESENT_HI), bits(p->l2_present, 63, 32) }, + } +{ + fatal_if(p->texture_features.size() > 3, + "Too many texture feature registers specified (%i)\n", + p->texture_features.size()); + + fatal_if(p->js_features.size() > 16, + "Too many job slot feature registers specified (%i)\n", + p->js_features.size()); + + for (int i = 0; i < p->texture_features.size(); i++) + idRegs[TEXTURE_FEATURES_REG(i)] = p->texture_features[i]; + + for (int i = 0; i < p->js_features.size(); i++) + idRegs[JS_FEATURES_REG(i)] = p->js_features[i]; +} + +CustomNoMaliGpu::~CustomNoMaliGpu() +{ +} + +void +CustomNoMaliGpu::onReset() +{ + NoMaliGpu::onReset(); + + for (const auto ® : idRegs) + writeRegRaw(reg.first, reg.second); +} + + + NoMaliGpu * NoMaliGpuParams::create() { return new NoMaliGpu(this); } + +CustomNoMaliGpu * +CustomNoMaliGpuParams::create() +{ + return new CustomNoMaliGpu(this); +} diff --git a/src/dev/arm/gpu_nomali.hh b/src/dev/arm/gpu_nomali.hh index 06e0826c4..d72e920b9 100644 --- a/src/dev/arm/gpu_nomali.hh +++ b/src/dev/arm/gpu_nomali.hh @@ -46,6 +46,7 @@ #include "libnomali/nomali.h" class NoMaliGpuParams; +class CustomNoMaliGpuParams; class RealView; class NoMaliGpu : public PioDevice @@ -186,4 +187,18 @@ class NoMaliGpu : public PioDevice }; +class CustomNoMaliGpu : public NoMaliGpu +{ + public: + CustomNoMaliGpu(const CustomNoMaliGpuParams *p); + virtual ~CustomNoMaliGpu(); + + protected: + void onReset() override; + + private: + /** Map between GPU registers and their custom reset values */ + std::map<nomali_addr_t, uint32_t> idRegs; +}; + #endif // __DEV_ARM_NOMALI_GPU_HH__ |