diff -r 7fb6aef280aa -r cc5e471c7b37 src/dev/arm/gpu_nomali.hh --- a/src/dev/arm/gpu_nomali.hh Mon Feb 01 10:11:37 2016 +0000 +++ b/src/dev/arm/gpu_nomali.hh Mon Feb 01 10:12:19 2016 +0000 @@ -54,6 +54,8 @@ NoMaliGpu(const NoMaliGpuParams *p); virtual ~NoMaliGpu(); + void init() override; + public: /* Checkpointing */ void serialize(CheckpointOut &cp) const override; void unserialize(CheckpointIn &cp) override; @@ -126,6 +128,14 @@ */ virtual void onInterrupt(nomali_int_t intno, bool set); + /** + * Reset callback from the NoMali library + * + * This method is called whenever the GPU is reset through the + * register interface or the API (reset() or nomali_reset()). + */ + virtual void onReset(); + /** @} */ private: /* Callback helpers */ @@ -145,6 +155,18 @@ */ static void _interrupt(nomali_handle_t h, void *usr, nomali_int_t intno, int set); + + /** + * Reset callback from the NoMali library. + * + * This method calls onReset() on the NoMaliGpu owning this + * device. + * + * @param h NoMali library handle. + * @param usr Pointer to an instance of the NoMaliGpu + */ + static void _reset(nomali_handle_t h, void *usr); + protected: /** Device base address */ const Addr pioAddr; diff -r 7fb6aef280aa -r cc5e471c7b37 src/dev/arm/gpu_nomali.cc --- a/src/dev/arm/gpu_nomali.cc Mon Feb 01 10:11:37 2016 +0000 +++ b/src/dev/arm/gpu_nomali.cc Mon Feb 01 10:12:19 2016 +0000 @@ -92,6 +92,13 @@ cbk_int.func.interrupt = NoMaliGpu::_interrupt; setCallback(cbk_int); + /* Setup a reset callback */ + nomali_callback_t cbk_rst; + cbk_rst.type = NOMALI_CALLBACK_RESET; + cbk_rst.usr = (void *)this; + cbk_rst.func.reset = NoMaliGpu::_reset; + setCallback(cbk_rst); + panicOnErr( nomali_get_info(nomali, &nomaliInfo), "Failed to get NoMali information struct"); @@ -102,6 +109,18 @@ nomali_destroy(nomali); } + +void +NoMaliGpu::init() +{ + PioDevice::init(); + + /* Reset the GPU here since the reset callback won't have been + * installed when the GPU was reset at instantiation time. + */ + reset(); +} + void NoMaliGpu::serialize(CheckpointOut &cp) const { @@ -268,6 +287,12 @@ } void +NoMaliGpu::onReset() +{ + DPRINTF(NoMali, "Reset\n"); +} + +void NoMaliGpu::setCallback(const nomali_callback_t &callback) { DPRINTF(NoMali, "Registering callback %i\n", @@ -286,6 +311,14 @@ _this->onInterrupt(intno, !!set); } +void +NoMaliGpu::_reset(nomali_handle_t h, void *usr) +{ + NoMaliGpu *_this(static_cast(usr)); + + _this->onReset(); +} + NoMaliGpu * NoMaliGpuParams::create() {