gem5  v20.1.0.0
pmu.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2014, 2017-2019 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #include "arch/arm/pmu.hh"
39 
40 #include "arch/arm/isa.hh"
41 #include "arch/arm/utility.hh"
42 #include "base/trace.hh"
43 #include "cpu/base.hh"
44 #include "debug/Checkpoint.hh"
45 #include "debug/PMUVerbose.hh"
46 #include "dev/arm/base_gic.hh"
47 #include "dev/arm/generic_timer.hh"
48 #include "params/ArmPMU.hh"
49 
50 namespace ArmISA {
51 
52 const RegVal PMU::reg_pmcr_wr_mask = 0x39;
53 
54 PMU::PMU(const ArmPMUParams *p)
56  reg_pmcnten(0), reg_pmcr(0),
57  reg_pmselr(0), reg_pminten(0), reg_pmovsr(0),
58  reg_pmceid0(0),reg_pmceid1(0),
59  clock_remainder(0),
60  maximumCounterCount(p->eventCounters),
61  cycleCounter(*this, maximumCounterCount),
62  cycleCounterEventId(p->cycleEventId),
63  swIncrementEvent(nullptr),
64  reg_pmcr_conf(0),
65  interrupt(nullptr)
66 {
67  DPRINTF(PMUVerbose, "Initializing the PMU.\n");
68 
69  if (maximumCounterCount > 31) {
70  fatal("The PMU can only accept 31 counters, %d counters requested.\n",
72  }
73 
74  warn_if(!p->interrupt, "ARM PMU: No interrupt specified, interrupt " \
75  "delivery disabled.\n");
76 
77  /* Setup the performance counter ID registers */
78  reg_pmcr_conf.imp = 0x41; // ARM Ltd.
79  reg_pmcr_conf.idcode = 0x00;
80  reg_pmcr_conf.n = p->eventCounters;
81 
82  // Setup the hard-coded cycle counter, which is equivalent to
83  // architected counter event type 0x11.
84  cycleCounter.eventId = 0x11;
85 }
86 
88 {
89 }
90 
91 void
93 {
94  DPRINTF(PMUVerbose, "Assigning PMU to ContextID %i.\n", tc->contextId());
95  auto pmu_params = static_cast<const ArmPMUParams *>(params());
96 
97  if (pmu_params->interrupt)
98  interrupt = pmu_params->interrupt->get(tc);
99 }
100 
101 void
103 {
104  auto old_event = eventMap.find(id);
105  DPRINTF(PMUVerbose, "PMU: Adding SW increment event with id '0x%x'\n", id);
106 
107  if (swIncrementEvent) {
108  fatal_if(old_event == eventMap.end() ||
109  old_event->second != swIncrementEvent,
110  "Trying to add a software increment event with multiple"
111  "IDs. This is not supported.\n");
112  return;
113  }
114 
115  fatal_if(old_event != eventMap.end(), "An event with id %d has "
116  "been previously defined\n", id);
117 
120  registerEvent(id);
121 }
122 
123 void
124 PMU::addEventProbe(unsigned int id, SimObject *obj, const char *probe_name)
125 {
126 
127  DPRINTF(PMUVerbose, "PMU: Adding Probe Driven event with id '0x%x'"
128  "as probe %s:%s\n",id, obj->name(), probe_name);
129 
130  RegularEvent *event = nullptr;
131  auto event_entry = eventMap.find(id);
132  if (event_entry == eventMap.end()) {
133 
134  event = new RegularEvent();
135  eventMap[id] = event;
136 
137  } else {
138  event = dynamic_cast<RegularEvent*>(event_entry->second);
139  if (!event) {
140  fatal("Event with id %d is not probe driven\n", id);
141  }
142  }
143  event->addMicroarchitectureProbe(obj, probe_name);
144 
145  registerEvent(id);
146 
147 }
148 
149 void
150 PMU::registerEvent(uint32_t id)
151 {
152  // Flag the event as available in the corresponding PMCEID register if it
153  // is an architected event.
154  if (id < 0x20) {
155  reg_pmceid0 |= ((uint64_t)1) << id;
156  } else if (id > 0x20 && id < 0x40) {
157  reg_pmceid1 |= ((uint64_t)1) << (id - 0x20);
158  } else if (id >= 0x4000 && id < 0x4020) {
159  reg_pmceid0 |= ((uint64_t)1) << (id - 0x4000 + 32);
160  } else if (id >= 0x4020 && id < 0x4040) {
161  reg_pmceid1 |= ((uint64_t)1) << (id - 0x4020 + 32);
162  }
163 }
164 
165 void
167 {
168  // Re-attach enabled counters after a resume in case they changed.
170 }
171 
172 void
174 {
175 
176  // at this stage all probe configurations are done
177  // counters can be configured
178  for (uint32_t index = 0; index < maximumCounterCount-1; index++) {
179  counters.emplace_back(*this, index);
180  }
181 
183  panic_if(!event, "core cycle event is not present\n");
184  cycleCounter.enabled = true;
186 }
187 
188 void
189 PMU::setMiscReg(int misc_reg, RegVal val)
190 {
191  DPRINTF(PMUVerbose, "setMiscReg(%s, 0x%x)\n",
192  miscRegName[unflattenMiscReg(misc_reg)], val);
193 
194  switch (unflattenMiscReg(misc_reg)) {
195  case MISCREG_PMCR_EL0:
196  case MISCREG_PMCR:
198  return;
199 
201  case MISCREG_PMCNTENSET:
202  reg_pmcnten |= val;
204  return;
205 
207  case MISCREG_PMCNTENCLR:
208  reg_pmcnten &= ~val;
210  return;
211 
213  case MISCREG_PMOVSR:
215  return;
216 
217  case MISCREG_PMSWINC_EL0:
218  case MISCREG_PMSWINC:
219  if (swIncrementEvent) {
221  }
222  return;
223 
224  case MISCREG_PMCCNTR_EL0:
225  case MISCREG_PMCCNTR:
227  return;
228 
229  case MISCREG_PMSELR_EL0:
230  case MISCREG_PMSELR:
231  reg_pmselr = val;
232  return;
233  //TODO: implement MISCREF_PMCEID{2,3}
234  case MISCREG_PMCEID0_EL0:
235  case MISCREG_PMCEID0:
236  case MISCREG_PMCEID1_EL0:
237  case MISCREG_PMCEID1:
238  // Ignore writes
239  return;
240 
241  case MISCREG_PMEVTYPER0_EL0...MISCREG_PMEVTYPER5_EL0:
243  return;
244 
245  case MISCREG_PMCCFILTR:
247  DPRINTF(PMUVerbose, "Setting PMCCFILTR: 0x%x\n", val);
249  return;
250 
253  case MISCREG_PMXEVTYPER:
254  DPRINTF(PMUVerbose, "Setting counter type: "
255  "[PMSELR: 0x%x, PMSELER.sel: 0x%x, EVTYPER: 0x%x]\n",
256  reg_pmselr, reg_pmselr.sel, val);
258  return;
259 
260  case MISCREG_PMEVCNTR0_EL0...MISCREG_PMEVCNTR5_EL0:
262  return;
263 
265  case MISCREG_PMXEVCNTR:
267  return;
268 
270  case MISCREG_PMUSERENR:
271  // TODO
272  break;
273 
275  case MISCREG_PMINTENSET:
276  reg_pminten |= val;
277  return;
278 
280  case MISCREG_PMINTENCLR:
281  reg_pminten &= ~val;
282  return;
283 
285  case MISCREG_PMOVSSET:
287  return;
288 
289  default:
290  panic("Unexpected PMU register: %i\n", miscRegName[misc_reg]);
291  }
292 
293  warn("Not doing anything for write to miscreg %s\n",
294  miscRegName[misc_reg]);
295 }
296 
297 RegVal
298 PMU::readMiscReg(int misc_reg)
299 {
300  RegVal val(readMiscRegInt(misc_reg));
301  DPRINTF(PMUVerbose, "readMiscReg(%s): 0x%x\n",
302  miscRegName[unflattenMiscReg(misc_reg)], val);
303  return val;
304 }
305 
306 RegVal
307 PMU::readMiscRegInt(int misc_reg)
308 {
309  misc_reg = unflattenMiscReg(misc_reg);
310  switch (misc_reg) {
311  case MISCREG_PMCR_EL0:
312  case MISCREG_PMCR:
314 
317  case MISCREG_PMCNTENSET:
318  case MISCREG_PMCNTENCLR:
319  return reg_pmcnten;
320 
323  case MISCREG_PMOVSR: // Overflow Status Register
324  case MISCREG_PMOVSSET:
325  return reg_pmovsr;
326 
327  case MISCREG_PMSWINC_EL0:
328  case MISCREG_PMSWINC: // Software Increment Register (RAZ)
329  return 0;
330 
331  case MISCREG_PMSELR_EL0:
332  case MISCREG_PMSELR:
333  return reg_pmselr;
334 
335  case MISCREG_PMCEID0_EL0:
336  return reg_pmceid0;
337 
338  case MISCREG_PMCEID1_EL0:
339  return reg_pmceid1;
340 
341  //TODO: implement MISCREF_PMCEID{2,3}
342  case MISCREG_PMCEID0: // Common Event ID register
343  return reg_pmceid0 & 0xFFFFFFFF;
344 
345  case MISCREG_PMCEID1: // Common Event ID register
346  return reg_pmceid1 & 0xFFFFFFFF;
347 
348  case MISCREG_PMCCNTR_EL0:
349  return cycleCounter.getValue();
350 
351  case MISCREG_PMCCNTR:
352  return cycleCounter.getValue() & 0xFFFFFFFF;
353 
354  case MISCREG_PMEVTYPER0_EL0...MISCREG_PMEVTYPER5_EL0:
356 
357  case MISCREG_PMCCFILTR:
360 
363  case MISCREG_PMXEVTYPER:
365 
366  case MISCREG_PMEVCNTR0_EL0...MISCREG_PMEVCNTR5_EL0: {
367  return getCounterValue(misc_reg - MISCREG_PMEVCNTR0_EL0) &
368  0xFFFFFFFF;
369 
370  }
371 
373  case MISCREG_PMXEVCNTR:
374  return getCounterValue(reg_pmselr.sel) & 0xFFFFFFFF;
375 
377  case MISCREG_PMUSERENR:
378  // TODO
379  return 0;
380 
383  case MISCREG_PMINTENSET:
384  case MISCREG_PMINTENCLR:
385  return reg_pminten;
386 
387  default:
388  panic("Unexpected PMU register: %i\n", miscRegName[misc_reg]);
389  }
390 
391  warn("Not doing anything for read from miscreg %s\n",
392  miscRegName[misc_reg]);
393  return 0;
394 }
395 
396 void
398 {
399  DPRINTF(PMUVerbose, "Set Control Reg 0x%08x.\n", val);
400 
401  if (val.p) {
402  DPRINTF(PMUVerbose, "PMU reset all events to zero.\n");
404  }
405 
406  if (val.c) {
407  DPRINTF(PMUVerbose, "PMU reset cycle counter to zero.\n");
409  }
410 
411  // Reset the clock remainder if divide by 64-mode is toggled.
412  if (reg_pmcr.d != val.d)
413  clock_remainder = 0;
414 
417 }
418 
419 void
421 {
422  const bool global_enable(reg_pmcr.e);
423 
424  for (int i = 0; i < counters.size(); ++i) {
425  CounterState &ctr(counters[i]);
426  const bool enable(global_enable && (reg_pmcnten & (1 << i)));
427  if (ctr.enabled != enable) {
428  ctr.enabled = enable;
429  updateCounter(ctr);
430  }
431  }
432 
433  const bool ccntr_enable(global_enable && (reg_pmcnten & (1 << PMCCNTR)));
434  if (cycleCounter.enabled != ccntr_enable) {
435  cycleCounter.enabled = ccntr_enable;
437  }
438 }
439 
440 void
442 {
443  if (userCounters.empty()) {
444  enable();
445  }
446  userCounters.insert(user);
448 }
449 
450 void
452 {
453  for (auto& counter: userCounters) {
454  counter->add(val);
455  }
456 }
457 
458 void
460 {
461  userCounters.erase(user);
462 
463  if (userCounters.empty()) {
464  disable();
465  }
466 }
467 
468 void
470 {
471  parentEvent->increment(val);
472 }
473 
474 void
476 {
477  for (auto& subEvents: microArchitectureEventSet) {
478  attachedProbePointList.emplace_back(
479  new RegularProbe(this, subEvents.first, subEvents.second));
480  }
481 }
482 
483 void
485 {
486  attachedProbePointList.clear();
487 }
488 
489 bool
491 {
492  assert(pmu.isa);
493 
494  const PMEVTYPER_t filter(this->filter);
495  const SCR scr(pmu.isa->readMiscRegNoEffect(MISCREG_SCR));
496  const CPSR cpsr(pmu.isa->readMiscRegNoEffect(MISCREG_CPSR));
497  const ExceptionLevel el(currEL(cpsr));
498  const bool secure(inSecureState(scr, cpsr));
499 
500  switch (el) {
501  case EL0:
502  return secure ? filter.u : (filter.u != filter.nsu);
503 
504  case EL1:
505  return secure ? filter.p : (filter.p != filter.nsk);
506 
507  case EL2:
508  return !filter.nsh;
509 
510  case EL3:
511  return filter.p != filter.m;
512 
513  default:
514  panic("Unexpected execution level in PMU::isFiltered.\n");
515  }
516 }
517 
518 void
520 {
521  if (sourceEvent) {
522  sourceEvent->detachEvent(this);
523  sourceEvent = nullptr;
524  } else {
525  debugCounter("detaching event not currently attached"
526  " to any event\n");
527  }
528 }
529 
530 void
532 {
533  if (!resetValue) {
534  value = 0;
535  resetValue = true;
536  }
537  sourceEvent = event;
538  sourceEvent->attachEvent(this);
539 }
540 
541 uint64_t
543 {
544  if (sourceEvent) {
545  sourceEvent->updateAttachedCounters();
546  } else {
547  debugCounter("attempted to get value from a counter without"
548  " an associated event\n");
549  }
550  return value;
551 }
552 
553 void
555 {
556  value = val;
557  resetValue = true;
558 
559  if (sourceEvent) {
560  sourceEvent->updateAttachedCounters();
561  } else {
562  debugCounter("attempted to set value from a counter without"
563  " an associated event\n");
564  }
565 }
566 
567 void
569 {
570  if (!ctr.enabled) {
571  DPRINTF(PMUVerbose, "updateCounter(%i): Disabling counter\n",
572  ctr.getCounterId());
573  ctr.detach();
574 
575  } else {
576  DPRINTF(PMUVerbose, "updateCounter(%i): Enable event id 0x%x\n",
577  ctr.getCounterId(), ctr.eventId);
578 
579  auto sourceEvent = eventMap.find(ctr.eventId);
580  if (sourceEvent == eventMap.end()) {
581  warn("Can't enable PMU counter of type '0x%x': "
582  "No such event type.\n", ctr.eventId);
583  } else {
584  ctr.attach(sourceEvent->second);
585  }
586  }
587 }
588 
589 
590 void
592 {
593  for (CounterState &ctr : counters)
594  ctr.setValue(0);
595 }
596 
597 void
598 PMU::setCounterValue(CounterId id, uint64_t val)
599 {
600  if (!isValidCounter(id)) {
601  warn_once("Can't change counter value: Counter %i does not exist.\n",
602  id);
603  return;
604  }
605 
606  CounterState &ctr(getCounter(id));
607  ctr.setValue(val);
608 }
609 
610 PMU::PMEVTYPER_t
611 PMU::getCounterTypeRegister(CounterId id) const
612 {
613  if (!isValidCounter(id))
614  return 0;
615 
616  const CounterState &cs(getCounter(id));
617  PMEVTYPER_t type(cs.filter);
618 
619  type.evtCount = cs.eventId;
620 
621  return type;
622 }
623 
624 void
625 PMU::setCounterTypeRegister(CounterId id, PMEVTYPER_t val)
626 {
627  DPRINTF(PMUVerbose, "Set Event [%d] = 0x%08x\n", id, val);
628  if (!isValidCounter(id)) {
629  warn_once("Can't change counter type: Counter %i does not exist.\n",
630  id);
631  return;
632  }
633 
634  CounterState &ctr(getCounter(id));
635  const EventTypeId old_event_id(ctr.eventId);
636 
637  ctr.filter = val;
638 
639  // If PMCCNTR Register, do not change event type. PMCCNTR can
640  // count processor cycles only. If we change the event type, we
641  // need to update the probes the counter is using.
642  if (id != PMCCNTR && old_event_id != val.evtCount) {
643  ctr.eventId = val.evtCount;
644  updateCounter(ctr);
645  }
646 }
647 
648 void
650 {
651  const bool int_old = reg_pmovsr != 0;
652  const bool int_new = new_val != 0;
653 
654  reg_pmovsr = new_val;
655  if (int_old && !int_new) {
656  clearInterrupt();
657  } else if (!int_old && int_new && (reg_pminten & reg_pmovsr)) {
658  raiseInterrupt();
659  }
660 }
661 
662 void
664 {
665  if (interrupt) {
666  DPRINTF(PMUVerbose, "Delivering PMU interrupt.\n");
667  interrupt->raise();
668  } else {
669  warn_once("Dropping PMU interrupt as no interrupt has "
670  "been specified\n");
671  }
672 }
673 
674 void
676 {
677  if (interrupt) {
678  DPRINTF(PMUVerbose, "Clearing PMU interrupt.\n");
679  interrupt->clear();
680  } else {
681  warn_once("Dropping PMU interrupt as no interrupt has "
682  "been specified\n");
683  }
684 }
685 
686 void
688 {
689  DPRINTF(Checkpoint, "Serializing Arm PMU\n");
690 
699 
700  for (size_t i = 0; i < counters.size(); ++i)
701  counters[i].serializeSection(cp, csprintf("counters.%i", i));
702 
703  cycleCounter.serializeSection(cp, "cycleCounter");
704 }
705 
706 void
708 {
709  DPRINTF(Checkpoint, "Unserializing Arm PMU\n");
710 
716 
717  // Old checkpoints used to store the entire PMCEID value in a
718  // single 64-bit entry (reg_pmceid). The register was extended in
719  // ARMv8.1, so we now need to store it as two 64-bit registers.
721  paramIn(cp, "reg_pmceid", reg_pmceid0);
722 
724  reg_pmceid1 = 0;
725 
727 
728  for (size_t i = 0; i < counters.size(); ++i)
729  counters[i].unserializeSection(cp, csprintf("counters.%i", i));
730 
731  cycleCounter.unserializeSection(cp, "cycleCounter");
732 }
733 
735 PMU::getEvent(uint64_t eventId)
736 {
737  auto entry = eventMap.find(eventId);
738 
739  if (entry == eventMap.end()) {
740  warn("event %d does not exist\n", eventId);
741  return nullptr;
742  } else {
743  return entry->second;
744  }
745 }
746 
747 void
749 {
750  SERIALIZE_SCALAR(eventId);
751  SERIALIZE_SCALAR(value);
752  SERIALIZE_SCALAR(overflow64);
753 }
754 
755 void
757 {
758  UNSERIALIZE_SCALAR(eventId);
759  UNSERIALIZE_SCALAR(value);
760  UNSERIALIZE_SCALAR(overflow64);
761 }
762 
763 uint64_t
764 PMU::CounterState::add(uint64_t delta)
765 {
766  uint64_t value_until_overflow;
767  if (overflow64) {
768  value_until_overflow = UINT64_MAX - value;
769  } else {
770  value_until_overflow = UINT32_MAX - (uint32_t)value;
771  }
772 
773  if (isFiltered())
774  return value_until_overflow;
775 
776  if (resetValue) {
777  delta = 0;
778  resetValue = false;
779  } else {
780  value += delta;
781  }
782 
783  if (delta > value_until_overflow) {
784 
785  // overflow situation detected
786  // flag the overflow occurence
787  pmu.reg_pmovsr |= (1 << counterId);
788 
789  // Deliver a PMU interrupt if interrupt delivery is enabled
790  // for this counter.
791  if (pmu.reg_pminten & (1 << counterId)) {
792  pmu.raiseInterrupt();
793  }
794  return overflow64 ? UINT64_MAX : UINT32_MAX;
795  }
796  return value_until_overflow - delta + 1;
797 }
798 
799 void
801 {
802  for (auto& counter: userCounters) {
803  if (val & (0x1 << counter->getCounterId())) {
804  counter->add(1);
805  }
806  }
807 }
808 
809 } // namespace ArmISA
810 
811 ArmISA::PMU *
812 ArmPMUParams::create()
813 {
814  return new ArmISA::PMU(this);
815 }
ArmISA::MISCREG_PMCNTENCLR
@ MISCREG_PMCNTENCLR
Definition: miscregs.hh:347
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
ArmISA::PMU::RegularEvent
Definition: pmu.hh:343
ArmISA::MISCREG_PMUSERENR_EL0
@ MISCREG_PMUSERENR_EL0
Definition: miscregs.hh:716
ArmISA::PMU::registerEvent
void registerEvent(uint32_t id)
Definition: pmu.cc:150
ArmISA::PMU::CounterState::attach
void attach(PMUEvent *event)
Attach this counter to an event.
Definition: pmu.cc:531
ArmISA::MISCREG_PMCCNTR
@ MISCREG_PMCCNTR
Definition: miscregs.hh:353
Serializable::unserializeSection
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:178
ArmISA::MISCREG_PMSELR_EL0
@ MISCREG_PMSELR_EL0
Definition: miscregs.hh:709
warn
#define warn(...)
Definition: logging.hh:239
ArmISA::PMU::regProbeListeners
void regProbeListeners() override
Register probe listeners for this object.
Definition: pmu.cc:173
ArmISA::PMU::maximumCounterCount
uint64_t maximumCounterCount
The number of regular event counters.
Definition: pmu.hh:597
ArmISA::EL2
@ EL2
Definition: types.hh:624
ArmISA::PMU::CounterState::getValue
uint64_t getValue() const
rReturn the counter value
Definition: pmu.cc:542
ArmISA::MISCREG_PMEVCNTR0_EL0
@ MISCREG_PMEVCNTR0_EL0
Definition: miscregs.hh:782
MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:44
UNSERIALIZE_SCALAR
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:797
ArmISA::BaseISADevice
Base class for devices that use the MiscReg interfaces.
Definition: isa_device.hh:58
ArmISA::PMU::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: pmu.cc:707
ArmISA::PMU::PMU
PMU(const ArmPMUParams *p)
Definition: pmu.cc:54
ArmISA::PMU::addEventProbe
void addEventProbe(unsigned int id, SimObject *obj, const char *name)
Definition: pmu.cc:124
ArmISA::PMU::getCounterValue
uint64_t getCounterValue(CounterId id) const
Get the value of a performance counter.
Definition: pmu.hh:233
ArmISA::MISCREG_PMXEVTYPER
@ MISCREG_PMXEVTYPER
Definition: miscregs.hh:354
warn_once
#define warn_once(...)
Definition: logging.hh:243
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
ArmISA::MISCREG_PMCEID1_EL0
@ MISCREG_PMCEID1_EL0
Definition: miscregs.hh:711
ArmISA::EL0
@ EL0
Definition: types.hh:622
ArmISA::PMU::getCounter
CounterState & getCounter(CounterId id)
Return the state of a counter.
Definition: pmu.hh:522
ArmInterruptPin::clear
virtual void clear()=0
Clear a signalled interrupt.
ArmISA::MISCREG_PMCEID1
@ MISCREG_PMCEID1
Definition: miscregs.hh:352
ArmISA::MISCREG_PMINTENCLR_EL1
@ MISCREG_PMINTENCLR_EL1
Definition: miscregs.hh:703
ArmISA::currEL
static ExceptionLevel currEL(const ThreadContext *tc)
Definition: utility.hh:143
base_gic.hh
type
uint8_t type
Definition: inet.hh:421
ArmInterruptPin::raise
virtual void raise()=0
Signal an interrupt.
ArmISA::MISCREG_PMOVSSET_EL0
@ MISCREG_PMOVSSET_EL0
Definition: miscregs.hh:717
ArmISA::PMU::addSoftwareIncrementEvent
void addSoftwareIncrementEvent(unsigned int id)
Definition: pmu.cc:102
ArmISA::PMU::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: pmu.cc:166
ArmISA::PMU::SWIncrementEvent::write
void write(uint64_t val)
write on the sw increment register inducing an increment of the counters with this event selected acc...
Definition: pmu.cc:800
ArmISA::inSecureState
static bool inSecureState(SCR scr, CPSR cpsr)
Definition: utility.hh:246
ArmISA::PMU::updateCounter
void updateCounter(CounterState &ctr)
Depending on counter configuration, add or remove the probes driving the counter.
Definition: pmu.cc:568
ArmISA::PMU::getCounterTypeRegister
PMEVTYPER_t getCounterTypeRegister(CounterId id) const
Get the type and filter settings of a counter (PMEVTYPER)
Definition: pmu.cc:611
ArmISA::PMU::CounterState
State of a counter within the PMU.
Definition: pmu.hh:409
ArmISA::PMU::PMUEvent::updateAttachedCounters
virtual void updateAttachedCounters()
Method called immediately before a counter access in order for the associated event to update its sta...
Definition: pmu.hh:335
ArmISA::EL3
@ EL3
Definition: types.hh:625
ArmISA::PMU::reg_pmcnten
RegVal reg_pmcnten
Performance Monitor Count Enable Register.
Definition: pmu.hh:570
ArmISA::unflattenMiscReg
int unflattenMiscReg(int reg)
Definition: miscregs.cc:1363
ArmISA::miscRegName
const char *const miscRegName[]
Definition: miscregs.hh:1159
ArmISA::PMU::eventMap
std::map< EventTypeId, PMUEvent * > eventMap
List of event types supported by this PMU.
Definition: pmu.hh:624
ArmISA::PMU::RegularEvent::RegularProbe
Definition: pmu.hh:356
Serializable::serializeSection
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
Definition: serialize.cc:171
ArmISA::PMU::resetEventCounts
void resetEventCounts()
Reset all event counters excluding the cycle counter to zero.
Definition: pmu.cc:591
ArmISA
Definition: ccregs.hh:41
ArmISA::PMU::clock_remainder
unsigned clock_remainder
Remainder part when the clock counter is divided by 64.
Definition: pmu.hh:594
Trace::disable
void disable()
Definition: trace.cc:98
ArmISA::PMU::RegularEvent::RegularProbe::notify
void notify(const uint64_t &val)
Definition: pmu.cc:469
ArmISA::PMU::PMUEvent::increment
virtual void increment(const uint64_t val)
notify an event increment of val units, all the attached counters' value is incremented by val units.
Definition: pmu.cc:451
ArmISA::PMU::isFiltered
bool isFiltered(const CounterState &ctr) const
Check if a counter's settings allow it to be counted.
ArmISA::PMU::PMUEvent::userCounters
std::set< PMU::CounterState * > userCounters
set of counters using this event
Definition: pmu.hh:340
ArmISA::PMU::CounterState::eventId
EventTypeId eventId
Counter event ID.
Definition: pmu.hh:466
ArmISA::MISCREG_PMCCNTR_EL0
@ MISCREG_PMCCNTR_EL0
Definition: miscregs.hh:712
ArmISA::MISCREG_PMINTENSET
@ MISCREG_PMINTENSET
Definition: miscregs.hh:358
ArmISA::PMU::reg_pmceid0
uint64_t reg_pmceid0
Performance counter ID register.
Definition: pmu.hh:590
ArmISA::MISCREG_PMSELR
@ MISCREG_PMSELR
Definition: miscregs.hh:350
ArmISA::PMU::setMiscReg
void setMiscReg(int misc_reg, RegVal val) override
Set a register within the PMU.
Definition: pmu.cc:189
cp
Definition: cprintf.cc:40
ArmISA::PMU::clearInterrupt
void clearInterrupt()
Clear a PMU interrupt.
Definition: pmu.cc:675
ArmISA::PMU::~PMU
~PMU()
Definition: pmu.cc:87
ArmISA::PMU
Model of an ARM PMU version 3.
Definition: pmu.hh:94
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
ArmISA::PMU::isValidCounter
bool isValidCounter(CounterId id) const
Is this a valid counter ID?
Definition: pmu.hh:511
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:234
ArmISA::ExceptionLevel
ExceptionLevel
Definition: types.hh:621
ArmISA::MISCREG_PMOVSSET
@ MISCREG_PMOVSSET
Definition: miscregs.hh:360
ArmISA::PMU::cycleCounterEventId
const uint64_t cycleCounterEventId
The id of the counter hardwired to the cpu cycle counter.
Definition: pmu.hh:606
ArmISA::MISCREG_PMCNTENCLR_EL0
@ MISCREG_PMCNTENCLR_EL0
Definition: miscregs.hh:706
MipsISA::event
Bitfield< 10, 5 > event
Definition: pra_constants.hh:297
isa.hh
ProbePoints::PMU
ProbePointArg< uint64_t > PMU
PMU probe point.
Definition: pmu.hh:55
ArmISA::MISCREG_PMCR_EL0
@ MISCREG_PMCR_EL0
Definition: miscregs.hh:704
ArmISA::PMU::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: pmu.cc:687
ArmISA::PMU::cycleCounter
CounterState cycleCounter
State of the cycle counter.
Definition: pmu.hh:603
UNSERIALIZE_OPT_SCALAR
#define UNSERIALIZE_OPT_SCALAR(scalar)
Definition: serialize.hh:804
ArmISA::el
Bitfield< 3, 2 > el
Definition: miscregs_types.hh:69
ArmISA::PMU::CounterState::add
uint64_t add(uint64_t delta)
Add an event count to the counter and check for overflow.
Definition: pmu.cc:764
ArmISA::MISCREG_PMCNTENSET
@ MISCREG_PMCNTENSET
Definition: miscregs.hh:346
ArmISA::MISCREG_PMOVSR
@ MISCREG_PMOVSR
Definition: miscregs.hh:348
ArmISA::PMU::PMUEvent
Event definition base class.
Definition: pmu.hh:292
ArmISA::PMU::RegularEvent::disable
void disable() override
Disable the current event.
Definition: pmu.cc:484
ArmISA::PMU::CounterState::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: pmu.cc:756
ThreadContext::contextId
virtual ContextID contextId() const =0
ArmISA::PMU::updateAllCounters
void updateAllCounters()
Call updateCounter() for each counter in the PMU if the counter's state has changed.
Definition: pmu.cc:420
ArmISA::PMU::setControlReg
void setControlReg(PMCR_t val)
PMCR write handling.
Definition: pmu.cc:397
ArmISA::PMU::EventTypeId
unsigned int EventTypeId
Event type ID.
Definition: pmu.hh:193
generic_timer.hh
ArmISA::PMU::CounterState::getCounterId
uint64_t getCounterId() const
Obtain the counter id.
Definition: pmu.hh:446
ArmISA::MISCREG_PMCCFILTR_EL0
@ MISCREG_PMCCFILTR_EL0
Definition: miscregs.hh:714
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
ArmISA::MISCREG_PMEVTYPER0_EL0
@ MISCREG_PMEVTYPER0_EL0
Definition: miscregs.hh:788
ArmISA::PMU::CounterState::detach
void detach()
Detach the counter from its event.
Definition: pmu.cc:519
ArmISA::EL1
@ EL1
Definition: types.hh:623
ArmISA::PMU::RegularEvent::enable
void enable() override
Enable the current event.
Definition: pmu.cc:475
SimObject::params
const Params * params() const
Definition: sim_object.hh:119
ArmISA::PMU::readMiscRegInt
RegVal readMiscRegInt(int misc_reg)
Definition: pmu.cc:307
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:790
ArmISA::MISCREG_PMINTENCLR
@ MISCREG_PMINTENCLR
Definition: miscregs.hh:359
utility.hh
ArmISA::PMU::counters
std::vector< CounterState > counters
State of all general-purpose counters supported by PMU.
Definition: pmu.hh:600
ArmISA::PMU::setCounterValue
void setCounterValue(CounterId id, uint64_t val)
Set the value of a performance counter.
Definition: pmu.cc:598
ArmISA::MISCREG_PMXEVTYPER_EL0
@ MISCREG_PMXEVTYPER_EL0
Definition: miscregs.hh:713
ArmISA::PMU::setOverflowStatus
void setOverflowStatus(RegVal new_val)
Used for writing the Overflow Flag Status Register (SET/CLR)
Definition: pmu.cc:649
ArmISA::MISCREG_PMUSERENR
@ MISCREG_PMUSERENR
Definition: miscregs.hh:357
ArmISA::MISCREG_PMOVSCLR_EL0
@ MISCREG_PMOVSCLR_EL0
Definition: miscregs.hh:707
ArmISA::PMU::PMUEvent::attachEvent
void attachEvent(PMU::CounterState *user)
attach this event to a given counter
Definition: pmu.cc:441
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:133
ArmISA::PMU::p
Bitfield< 1 > p
Definition: pmu.hh:135
warn_if
#define warn_if(cond,...)
Conditional warning macro that checks the supplied condition and only prints a warning if the conditi...
Definition: logging.hh:263
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:197
ArmISA::PMU::getEvent
PMUEvent * getEvent(uint64_t eventId)
Obtain the event of a given id.
Definition: pmu.cc:735
ArmISA::MISCREG_PMCCFILTR
@ MISCREG_PMCCFILTR
Definition: miscregs.hh:355
ArmISA::MISCREG_PMSWINC
@ MISCREG_PMSWINC
Definition: miscregs.hh:349
ArmISA::PMU::PMUEvent::detachEvent
void detachEvent(PMU::CounterState *user)
detach this event from a given counter
Definition: pmu.cc:459
ArmISA::MISCREG_CPSR
@ MISCREG_CPSR
Definition: miscregs.hh:57
ArmISA::PMU::CounterState::enabled
bool enabled
Is the counter enabled?
Definition: pmu.hh:472
ArmISA::PMU::swIncrementEvent
SWIncrementEvent * swIncrementEvent
The event that implements the software increment.
Definition: pmu.hh:609
base.hh
ArmISA::PMU::reg_pmselr
PMSELR_t reg_pmselr
Performance Monitor Selection Register.
Definition: pmu.hh:576
ArmISA::PMU::CounterState::setValue
void setValue(uint64_t val)
overwrite the value of the counter
Definition: pmu.cc:554
ArmISA::PMU::reg_pmcr
PMCR_t reg_pmcr
Performance Monitor Control Register.
Definition: pmu.hh:573
X86ISA::enable
Bitfield< 11 > enable
Definition: misc.hh:1051
ArmISA::PMU::reg_pminten
RegVal reg_pminten
Performance Monitor Interrupt Enable Register.
Definition: pmu.hh:579
ArmISA::PMU::reg_pmcr_conf
PMCR_t reg_pmcr_conf
Constant (configuration-dependent) part of the PMCR.
Definition: pmu.hh:613
ArmISA::MISCREG_PMXEVTYPER_PMCCFILTR
@ MISCREG_PMXEVTYPER_PMCCFILTR
Definition: miscregs.hh:86
paramIn
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
Definition: types.cc:69
ArmISA::PMU::PMCCNTR
static const CounterId PMCCNTR
Cycle Count Register Number.
Definition: pmu.hh:186
ArmISA::MISCREG_PMXEVCNTR_EL0
@ MISCREG_PMXEVCNTR_EL0
Definition: miscregs.hh:715
ArmISA::MISCREG_PMCEID0
@ MISCREG_PMCEID0
Definition: miscregs.hh:351
pmu.hh
ArmISA::PMU::PMUEvent::enable
virtual void enable()=0
Enable the current event.
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
ArmISA::MISCREG_PMCNTENSET_EL0
@ MISCREG_PMCNTENSET_EL0
Definition: miscregs.hh:705
ArmISA::PMU::CounterState::isFiltered
bool isFiltered() const
Definition: pmu.cc:490
ArmISA::MISCREG_PMCEID0_EL0
@ MISCREG_PMCEID0_EL0
Definition: miscregs.hh:710
trace.hh
ArmISA::PMU::setThreadContext
void setThreadContext(ThreadContext *tc) override
Definition: pmu.cc:92
ArmISA::PMU::interrupt
ArmInterruptPin * interrupt
Performance monitor interrupt number.
Definition: pmu.hh:619
ArmISA::PMU::reg_pmceid1
uint64_t reg_pmceid1
Definition: pmu.hh:591
ArmISA::MISCREG_PMSWINC_EL0
@ MISCREG_PMSWINC_EL0
Definition: miscregs.hh:708
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
ArmISA::PMU::SWIncrementEvent
Definition: pmu.hh:384
ArmISA::PMU::readMiscReg
RegVal readMiscReg(int misc_reg) override
Read a register within the PMU.
Definition: pmu.cc:298
fatal_if
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Definition: logging.hh:219
ArmISA::PMU::raiseInterrupt
void raiseInterrupt()
Deliver a PMU interrupt to the GIC.
Definition: pmu.cc:663
CheckpointIn
Definition: serialize.hh:67
ArmISA::PMU::CounterState::filter
PMEVTYPER_t filter
Filtering settings (evtCount is unused)
Definition: pmu.hh:469
ArmISA::PMU::reg_pmovsr
RegVal reg_pmovsr
Performance Monitor Overflow Status Register.
Definition: pmu.hh:582
ArmISA::MISCREG_SCR
@ MISCREG_SCR
Definition: miscregs.hh:237
ArmISA::MISCREG_PMXEVCNTR
@ MISCREG_PMXEVCNTR
Definition: miscregs.hh:356
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
ArmISA::PMU::reg_pmcr_wr_mask
static const RegVal reg_pmcr_wr_mask
PMCR write mask when accessed from the guest.
Definition: pmu.hh:616
ArmISA::PMU::CounterState::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: pmu.cc:748
RegVal
uint64_t RegVal
Definition: types.hh:168
ArmISA::MISCREG_PMCR
@ MISCREG_PMCR
Definition: miscregs.hh:345
ArmISA::id
Bitfield< 33 > id
Definition: miscregs_types.hh:247
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
ArmISA::PMU::setCounterTypeRegister
void setCounterTypeRegister(CounterId id, PMEVTYPER_t type)
Set the type and filter settings of a performance counter (PMEVTYPER)
Definition: pmu.cc:625
ArmISA::MISCREG_PMINTENSET_EL1
@ MISCREG_PMINTENSET_EL1
Definition: miscregs.hh:702
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92

Generated on Wed Sep 30 2020 14:02:01 for gem5 by doxygen 1.8.17