from m5.params import *
from m5.params import isNullPointer
from m5.proxy import *
+from Gic import ArmInterruptPin
class ProbeEvent(object):
def __init__(self, pmu, _eventId, obj, *listOfNames):
ARCH_EVENT_CORE_CYCLES = 0x11
class ArmPMU(SimObject):
-
type = 'ArmPMU'
cxx_class = 'ArmISA::PMU'
cxx_header = 'arch/arm/pmu.hh'
cycleEventId = Param.Int(ARCH_EVENT_CORE_CYCLES, "Cycle event id")
platform = Param.Platform(Parent.any, "Platform this device is part of.")
eventCounters = Param.Int(31, "Number of supported PMU counters")
- pmuInterrupt = Param.Int(68, "PMU GIC interrupt number")
+ interrupt = Param.ArmInterruptPin("PMU interrupt")
/*
- * Copyright (c) 2011-2014, 2017 ARM Limited
+ * Copyright (c) 2011-2014, 2017-2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
#include "debug/PMUVerbose.hh"
#include "dev/arm/base_gic.hh"
#include "dev/arm/generic_timer.hh"
-#include "dev/arm/realview.hh"
#include "params/ArmPMU.hh"
namespace ArmISA {
cycleCounterEventId(p->cycleEventId),
swIncrementEvent(nullptr),
reg_pmcr_conf(0),
- pmuInterrupt(p->pmuInterrupt),
- platform(p->platform)
+ interrupt(p->interrupt)
{
DPRINTF(PMUVerbose, "Initializing the PMU.\n");
maximumCounterCount);
}
+ warn_if(!interrupt, "ARM PMU: No interrupt specified, interrupt " \
+ "delivery disabled.\n");
+
/* Setup the performance counter ID registers */
reg_pmcr_conf.imp = 0x41; // ARM Ltd.
reg_pmcr_conf.idcode = 0x00;
{
}
+void
+PMU::setThreadContext(ThreadContext *tc)
+{
+ DPRINTF(PMUVerbose, "Assigning PMU to ContextID %i.\n", tc->contextId());
+ if (interrupt)
+ interrupt->setThreadContext(tc);
+}
+
void
PMU::addSoftwareIncrementEvent(unsigned int id)
{
void
PMU::raiseInterrupt()
{
- RealView *rv(dynamic_cast<RealView *>(platform));
- if (!rv || !rv->gic) {
- warn_once("ARM PMU: GIC missing, can't raise interrupt.\n");
- return;
+ if (interrupt) {
+ DPRINTF(PMUVerbose, "Delivering PMU interrupt.\n");
+ interrupt->raise();
+ } else {
+ warn_once("Dropping PMU interrupt as no interrupt has "
+ "been specified\n");
}
-
- DPRINTF(PMUVerbose, "Delivering PMU interrupt.\n");
- rv->gic->sendInt(pmuInterrupt);
}
void
/*
- * Copyright (c) 2011-2014, 2017 ARM Limited
+ * Copyright (c) 2011-2014, 2017-2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
class ArmPMUParams;
class Platform;
class ThreadContext;
+class ArmInterruptPin;
namespace ArmISA {
void regProbeListeners() override;
public: // ISA Device interface
+ void setThreadContext(ThreadContext *tc) override;
+
/**
* Set a register within the PMU.
*
static const MiscReg reg_pmcr_wr_mask;
/** Performance monitor interrupt number */
- const unsigned int pmuInterrupt;
- /** Platform this device belongs to */
- Platform *const platform;
+ ArmInterruptPin *const interrupt;
/**
* List of event types supported by this PMU.