gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
pmu.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2014, 2017-2019, 2022-2023 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 #include "sim/sim_exit.hh"
50 
51 namespace gem5
52 {
53 
54 namespace ArmISA {
55 
56 const RegVal PMU::reg_pmcr_wr_mask = 0x39;
57 
58 PMU::PMU(const ArmPMUParams &p)
60  use64bitCounters(p.use64bitCounters),
61  reg_pmcnten(0), reg_pmcr(0),
62  reg_pmselr(0), reg_pminten(0), reg_pmovsr(0),
63  reg_pmceid0(0),reg_pmceid1(0),
64  clock_remainder(0),
65  maximumCounterCount(p.eventCounters),
66  cycleCounter(*this, maximumCounterCount, p.use64bitCounters),
67  cycleCounterEventId(p.cycleEventId),
68  swIncrementEvent(nullptr),
69  reg_pmcr_conf(0),
70  interrupt(nullptr),
71  exitOnPMUControl(p.exitOnPMUControl),
72  exitOnPMUInterrupt(p.exitOnPMUInterrupt)
73 {
74  DPRINTF(PMUVerbose, "Initializing the PMU.\n");
75 
76  if (maximumCounterCount > 31) {
77  fatal("The PMU can only accept 31 counters, %d counters requested.\n",
79  }
80 
81  warn_if(!p.interrupt, "ARM PMU: No interrupt specified, interrupt " \
82  "delivery disabled.\n");
83 
84  /* Setup the performance counter ID registers */
85  reg_pmcr_conf.imp = 0x41; // ARM Ltd.
86  reg_pmcr_conf.idcode = 0x00;
87  reg_pmcr_conf.n = p.eventCounters;
88 
89  // Setup the hard-coded cycle counter, which is equivalent to
90  // architected counter event type 0x11.
91  cycleCounter.eventId = 0x11;
92 }
93 
95 {
96 }
97 
98 void
100 {
101  DPRINTF(PMUVerbose, "Assigning PMU to ContextID %i.\n", tc->contextId());
102  const auto &pmu_params = static_cast<const ArmPMUParams &>(params());
103 
104  if (pmu_params.interrupt)
105  interrupt = pmu_params.interrupt->get(tc);
106 }
107 
108 void
110 {
111  auto old_event = eventMap.find(id);
112  DPRINTF(PMUVerbose, "PMU: Adding SW increment event with id '0x%x'\n", id);
113 
114  if (swIncrementEvent) {
115  fatal_if(old_event == eventMap.end() ||
116  old_event->second != swIncrementEvent,
117  "Trying to add a software increment event with multiple"
118  "IDs. This is not supported.\n");
119  return;
120  }
121 
122  fatal_if(old_event != eventMap.end(), "An event with id %d has "
123  "been previously defined\n", id);
124 
125  swIncrementEvent = std::make_shared<SWIncrementEvent>();
127  registerEvent(id);
128 }
129 
130 void
131 PMU::addEventProbe(unsigned int id, SimObject *obj, const char *probe_name)
132 {
133 
134  DPRINTF(PMUVerbose, "PMU: Adding Probe Driven event with id '0x%x'"
135  "as probe %s:%s\n",id, obj->name(), probe_name);
136 
137  std::shared_ptr<RegularEvent> event;
138  auto event_entry = eventMap.find(id);
139  if (event_entry == eventMap.end()) {
140  event = std::make_shared<RegularEvent>();
141  eventMap[id] = event;
142  } else {
143  event = std::dynamic_pointer_cast<RegularEvent>(event_entry->second);
144  fatal_if(!event, "Event with id %d is not probe driven\n", id);
145  }
146  event->addMicroarchitectureProbe(obj, probe_name);
147 
148  registerEvent(id);
149 
150 }
151 
152 void
153 PMU::registerEvent(uint32_t id)
154 {
155  // Flag the event as available in the corresponding PMCEID register if it
156  // is an architected event.
157  if (id < 0x20) {
158  reg_pmceid0 |= ((uint64_t)1) << id;
159  } else if (id > 0x20 && id < 0x40) {
160  reg_pmceid1 |= ((uint64_t)1) << (id - 0x20);
161  } else if (id >= 0x4000 && id < 0x4020) {
162  reg_pmceid0 |= ((uint64_t)1) << (id - 0x4000 + 32);
163  } else if (id >= 0x4020 && id < 0x4040) {
164  reg_pmceid1 |= ((uint64_t)1) << (id - 0x4020 + 32);
165  }
166 }
167 
168 void
170 {
171  // Re-attach enabled counters after a resume in case they changed.
173 }
174 
175 void
177 {
178 
179  // at this stage all probe configurations are done
180  // counters can be configured
181  for (uint32_t index = 0; index < maximumCounterCount-1; index++) {
182  counters.emplace_back(*this, index, use64bitCounters);
183  }
184 
185  std::shared_ptr<PMUEvent> event = getEvent(cycleCounterEventId);
186  panic_if(!event, "core cycle event is not present\n");
187  cycleCounter.enabled = true;
189 }
190 
191 void
192 PMU::setMiscReg(int misc_reg, RegVal val)
193 {
194  DPRINTF(PMUVerbose, "setMiscReg(%s, 0x%x)\n",
195  miscRegName[unflattenMiscReg(misc_reg)], val);
196 
197  switch (unflattenMiscReg(misc_reg)) {
198  case MISCREG_PMCR_EL0:
199  case MISCREG_PMCR:
201  return;
202 
204  case MISCREG_PMCNTENSET:
205  reg_pmcnten |= val;
207  return;
208 
210  case MISCREG_PMCNTENCLR:
211  reg_pmcnten &= ~val;
213  return;
214 
216  case MISCREG_PMOVSR:
218  return;
219 
220  case MISCREG_PMSWINC_EL0:
221  case MISCREG_PMSWINC:
222  if (swIncrementEvent) {
223  swIncrementEvent->write(val);
224  }
225  return;
226 
227  case MISCREG_PMCCNTR_EL0:
228  case MISCREG_PMCCNTR:
230  return;
231 
232  case MISCREG_PMSELR_EL0:
233  case MISCREG_PMSELR:
234  reg_pmselr = val;
235  return;
236  //TODO: implement MISCREF_PMCEID{2,3}
237  case MISCREG_PMCEID0_EL0:
238  case MISCREG_PMCEID0:
239  case MISCREG_PMCEID1_EL0:
240  case MISCREG_PMCEID1:
241  // Ignore writes
242  return;
243 
244  case MISCREG_PMEVTYPER0_EL0...MISCREG_PMEVTYPER5_EL0:
246  return;
247 
248  case MISCREG_PMCCFILTR:
250  DPRINTF(PMUVerbose, "Setting PMCCFILTR: 0x%x\n", val);
252  return;
253 
256  case MISCREG_PMXEVTYPER:
257  DPRINTF(PMUVerbose, "Setting counter type: "
258  "[PMSELR: 0x%x, PMSELER.sel: 0x%x, EVTYPER: 0x%x]\n",
259  reg_pmselr, reg_pmselr.sel, val);
261  return;
262 
263  case MISCREG_PMEVCNTR0_EL0...MISCREG_PMEVCNTR5_EL0:
265  return;
266 
268  case MISCREG_PMXEVCNTR:
270  return;
271 
273  case MISCREG_PMUSERENR:
274  // TODO
275  break;
276 
278  case MISCREG_PMINTENSET:
279  reg_pminten |= val;
280  return;
281 
283  case MISCREG_PMINTENCLR:
284  reg_pminten &= ~val;
285  return;
286 
288  case MISCREG_PMOVSSET:
290  return;
291 
292  default:
293  panic("Unexpected PMU register: %i\n", miscRegName[misc_reg]);
294  }
295 
296  warn("Not doing anything for write to miscreg %s\n",
297  miscRegName[misc_reg]);
298 }
299 
300 RegVal
301 PMU::readMiscReg(int misc_reg)
302 {
303  RegVal val(readMiscRegInt(misc_reg));
304  DPRINTF(PMUVerbose, "readMiscReg(%s): 0x%x\n",
305  miscRegName[unflattenMiscReg(misc_reg)], val);
306  return val;
307 }
308 
309 RegVal
310 PMU::readMiscRegInt(int misc_reg)
311 {
312  misc_reg = unflattenMiscReg(misc_reg);
313  switch (misc_reg) {
314  case MISCREG_PMCR_EL0:
315  case MISCREG_PMCR:
317 
320  case MISCREG_PMCNTENSET:
321  case MISCREG_PMCNTENCLR:
322  return reg_pmcnten;
323 
326  case MISCREG_PMOVSR: // Overflow Status Register
327  case MISCREG_PMOVSSET:
328  return reg_pmovsr;
329 
330  case MISCREG_PMSWINC_EL0:
331  case MISCREG_PMSWINC: // Software Increment Register (RAZ)
332  return 0;
333 
334  case MISCREG_PMSELR_EL0:
335  case MISCREG_PMSELR:
336  return reg_pmselr;
337 
338  case MISCREG_PMCEID0_EL0:
339  return reg_pmceid0;
340 
341  case MISCREG_PMCEID1_EL0:
342  return reg_pmceid1;
343 
344  //TODO: implement MISCREF_PMCEID{2,3}
345  case MISCREG_PMCEID0: // Common Event ID register
346  return reg_pmceid0 & 0xFFFFFFFF;
347 
348  case MISCREG_PMCEID1: // Common Event ID register
349  return reg_pmceid1 & 0xFFFFFFFF;
350 
351  case MISCREG_PMCCNTR_EL0:
352  return cycleCounter.getValue();
353 
354  case MISCREG_PMCCNTR:
355  return cycleCounter.getValue() & 0xFFFFFFFF;
356 
357  case MISCREG_PMEVTYPER0_EL0...MISCREG_PMEVTYPER5_EL0:
359 
360  case MISCREG_PMCCFILTR:
363 
366  case MISCREG_PMXEVTYPER:
368 
369  case MISCREG_PMEVCNTR0_EL0...MISCREG_PMEVCNTR5_EL0: {
370  return getCounterValue(misc_reg - MISCREG_PMEVCNTR0_EL0) &
371  0xFFFFFFFF;
372 
373  }
374 
376  case MISCREG_PMXEVCNTR:
377  return getCounterValue(reg_pmselr.sel) & 0xFFFFFFFF;
378 
380  case MISCREG_PMUSERENR:
381  // TODO
382  return 0;
383 
386  case MISCREG_PMINTENSET:
387  case MISCREG_PMINTENCLR:
388  return reg_pminten;
389 
390  default:
391  panic("Unexpected PMU register: %i\n", miscRegName[misc_reg]);
392  }
393 
394  warn("Not doing anything for read from miscreg %s\n",
395  miscRegName[misc_reg]);
396  return 0;
397 }
398 
399 void
401 {
402  DPRINTF(PMUVerbose, "Set Control Reg 0x%08x.\n", val);
403 
404  if (val.p) {
405  DPRINTF(PMUVerbose, "PMU reset all events to zero.\n");
407  }
408 
409  if (val.c) {
410  DPRINTF(PMUVerbose, "PMU reset cycle counter to zero.\n");
412  }
413 
414  // Reset the clock remainder if divide by 64-mode is toggled.
415  if (reg_pmcr.d != val.d)
416  clock_remainder = 0;
417 
418  // Optionally exit the simulation on various PMU control events.
419  // Exit on enable/disable takes precedence over exit on reset.
420  if (exitOnPMUControl) {
421  if (!reg_pmcr.e && val.e) {
422  inform("Exiting simulation: PMU enable detected");
423  exitSimLoop("performance counter enabled", 0);
424  } else if (reg_pmcr.e && !val.e) {
425  inform("Exiting simulation: PMU disable detected");
426  exitSimLoop("performance counter disabled", 0);
427  } else if (val.p) {
428  inform("Exiting simulation: PMU reset detected");
429  exitSimLoop("performance counter reset", 0);
430  }
431  }
432 
435 }
436 
437 void
439 {
440  const bool global_enable(reg_pmcr.e);
441 
442  for (int i = 0; i < counters.size(); ++i) {
443  CounterState &ctr(counters[i]);
444  const bool enable(global_enable && (reg_pmcnten & (1 << i)));
445  if (ctr.enabled != enable) {
446  ctr.enabled = enable;
447  updateCounter(ctr);
448  }
449  }
450 
451  const bool ccntr_enable(global_enable && (reg_pmcnten & (1 << PMCCNTR)));
452  if (cycleCounter.enabled != ccntr_enable) {
453  cycleCounter.enabled = ccntr_enable;
455  }
456 }
457 
458 void
460 {
461  if (userCounters.empty()) {
462  enable();
463  }
464  userCounters.insert(user);
466 }
467 
468 void
470 {
471  for (auto& counter: userCounters) {
472  counter->add(val);
473  }
474 }
475 
476 void
478 {
479  userCounters.erase(user);
480 
481  if (userCounters.empty()) {
482  disable();
483  }
484 }
485 
486 void
488 {
489  parentEvent->increment(val);
490 }
491 
492 void
494 {
495  for (auto& subEvents: microArchitectureEventSet) {
496  attachedProbePointList.emplace_back(
497  new RegularProbe(this, subEvents.first, subEvents.second));
498  }
499 }
500 
501 void
503 {
504  attachedProbePointList.clear();
505 }
506 
507 bool
509 {
510  assert(pmu.isa);
511 
512  const PMEVTYPER_t filter(this->filter);
513  const ExceptionLevel el(pmu.isa->currEL());
514  const bool secure(pmu.isa->inSecureState());
515 
516  switch (el) {
517  case EL0:
518  return secure ? filter.u : (filter.u != filter.nsu);
519 
520  case EL1:
521  return secure ? filter.p : (filter.p != filter.nsk);
522 
523  case EL2:
524  return !filter.nsh;
525 
526  case EL3:
527  return filter.p != filter.m;
528 
529  default:
530  panic("Unexpected execution level in PMU::isFiltered.\n");
531  }
532 }
533 
534 void
536 {
537  if (sourceEvent) {
538  sourceEvent->detachEvent(this);
539  sourceEvent = nullptr;
540  } else {
541  debugCounter("detaching event not currently attached"
542  " to any event\n");
543  }
544 }
545 
546 void
547 PMU::CounterState::attach(const std::shared_ptr<PMUEvent> &event)
548 {
549  if (!resetValue) {
550  value = 0;
551  resetValue = true;
552  }
553  sourceEvent = event;
554  sourceEvent->attachEvent(this);
555 }
556 
557 uint64_t
559 {
560  if (sourceEvent) {
561  sourceEvent->updateAttachedCounters();
562  } else {
563  debugCounter("attempted to get value from a counter without"
564  " an associated event\n");
565  }
566  return value;
567 }
568 
569 void
571 {
572  value = val;
573  resetValue = true;
574 
575  if (sourceEvent) {
576  sourceEvent->updateAttachedCounters();
577  } else {
578  debugCounter("attempted to set value from a counter without"
579  " an associated event\n");
580  }
581 }
582 
583 void
585 {
586  if (!ctr.enabled) {
587  DPRINTF(PMUVerbose, "updateCounter(%i): Disabling counter\n",
588  ctr.getCounterId());
589  ctr.detach();
590 
591  } else {
592  DPRINTF(PMUVerbose, "updateCounter(%i): Enable event id 0x%x\n",
593  ctr.getCounterId(), ctr.eventId);
594 
595  auto sourceEvent = eventMap.find(ctr.eventId);
596  if (sourceEvent == eventMap.end()) {
597  warn("Can't enable PMU counter of type '0x%x': "
598  "No such event type.\n", ctr.eventId);
599  } else {
600  ctr.attach(sourceEvent->second);
601  }
602  }
603 }
604 
605 
606 void
608 {
609  for (CounterState &ctr : counters)
610  ctr.setValue(0);
611 }
612 
613 void
614 PMU::setCounterValue(CounterId id, uint64_t val)
615 {
616  if (!isValidCounter(id)) {
617  warn_once("Can't change counter value: Counter %i does not exist.\n",
618  id);
619  return;
620  }
621 
622  CounterState &ctr(getCounter(id));
623  ctr.setValue(val);
624 }
625 
626 PMU::PMEVTYPER_t
627 PMU::getCounterTypeRegister(CounterId id) const
628 {
629  if (!isValidCounter(id))
630  return 0;
631 
632  const CounterState &cs(getCounter(id));
633  PMEVTYPER_t type(cs.filter);
634 
635  type.evtCount = cs.eventId;
636 
637  return type;
638 }
639 
640 void
641 PMU::setCounterTypeRegister(CounterId id, PMEVTYPER_t val)
642 {
643  DPRINTF(PMUVerbose, "Set Event [%d] = 0x%08x\n", id, val);
644  if (!isValidCounter(id)) {
645  warn_once("Can't change counter type: Counter %i does not exist.\n",
646  id);
647  return;
648  }
649 
650  CounterState &ctr(getCounter(id));
651  const EventTypeId old_event_id(ctr.eventId);
652 
653  ctr.filter = val;
654 
655  // If PMCCNTR Register, do not change event type. PMCCNTR can
656  // count processor cycles only. If we change the event type, we
657  // need to update the probes the counter is using.
658  if (id != PMCCNTR && old_event_id != val.evtCount) {
659  ctr.eventId = val.evtCount;
660  updateCounter(ctr);
661  }
662 }
663 
664 void
666 {
667  const bool int_old = reg_pmovsr != 0;
668  const bool int_new = new_val != 0;
669 
670  reg_pmovsr = new_val;
671  if (int_old && !int_new) {
672  clearInterrupt();
673  } else if (!int_old && int_new && (reg_pminten & reg_pmovsr)) {
674  raiseInterrupt();
675  }
676 }
677 
678 void
680 {
681  if (exitOnPMUInterrupt) {
682  inform("Exiting simulation: PMU interrupt detected");
683  exitSimLoop("performance counter interrupt", 0);
684  }
685  if (interrupt) {
686  DPRINTF(PMUVerbose, "Delivering PMU interrupt.\n");
687  interrupt->raise();
688  } else {
689  warn_once("Dropping PMU interrupt as no interrupt has "
690  "been specified\n");
691  }
692 }
693 
694 void
696 {
697  if (interrupt) {
698  DPRINTF(PMUVerbose, "Clearing PMU interrupt.\n");
699  interrupt->clear();
700  } else {
701  warn_once("Dropping PMU interrupt as no interrupt has "
702  "been specified\n");
703  }
704 }
705 
706 void
708 {
709  DPRINTF(Checkpoint, "Serializing Arm PMU\n");
710 
720 
721  for (size_t i = 0; i < counters.size(); ++i)
722  counters[i].serializeSection(cp, csprintf("counters.%i", i));
723 
724  cycleCounter.serializeSection(cp, "cycleCounter");
725 }
726 
727 void
729 {
730  DPRINTF(Checkpoint, "Unserializing Arm PMU\n");
731 
738 
739  // Old checkpoints used to store the entire PMCEID value in a
740  // single 64-bit entry (reg_pmceid). The register was extended in
741  // ARMv8.1, so we now need to store it as two 64-bit registers.
743  paramIn(cp, "reg_pmceid", reg_pmceid0);
744 
746  reg_pmceid1 = 0;
747 
749 
750  for (size_t i = 0; i < counters.size(); ++i)
751  counters[i].unserializeSection(cp, csprintf("counters.%i", i));
752 
753  cycleCounter.unserializeSection(cp, "cycleCounter");
754 }
755 
756 std::shared_ptr<PMU::PMUEvent>
757 PMU::getEvent(uint64_t eventId)
758 {
759  auto entry = eventMap.find(eventId);
760 
761  if (entry == eventMap.end()) {
762  warn("event %d does not exist\n", eventId);
763  return nullptr;
764  } else {
765  return entry->second;
766  }
767 }
768 
769 void
771 {
772  SERIALIZE_SCALAR(eventId);
773  SERIALIZE_SCALAR(value);
774  SERIALIZE_SCALAR(overflow64);
775 }
776 
777 void
779 {
780  UNSERIALIZE_SCALAR(eventId);
781  UNSERIALIZE_SCALAR(value);
782  UNSERIALIZE_SCALAR(overflow64);
783 }
784 
785 uint64_t
786 PMU::CounterState::add(uint64_t delta)
787 {
788  uint64_t value_until_overflow;
789  if (overflow64) {
790  value_until_overflow = UINT64_MAX - value;
791  } else {
792  value_until_overflow = UINT32_MAX - (uint32_t)value;
793  }
794 
795  if (isFiltered())
796  return value_until_overflow;
797 
798  if (resetValue) {
799  delta = 0;
800  resetValue = false;
801  } else {
802  value += delta;
803  }
804 
805  if (delta > value_until_overflow) {
806 
807  // overflow situation detected
808  // flag the overflow occurence
809  pmu.reg_pmovsr |= (1 << counterId);
810 
811  // Deliver a PMU interrupt if interrupt delivery is enabled
812  // for this counter.
813  if (pmu.reg_pminten & (1 << counterId)) {
814  pmu.raiseInterrupt();
815  }
816  return overflow64 ? UINT64_MAX : UINT32_MAX;
817  }
818  return value_until_overflow - delta + 1;
819 }
820 
821 void
823 {
824  for (auto& counter: userCounters) {
825  if (val & (0x1 << counter->getCounterId())) {
826  counter->add(1);
827  }
828  }
829 }
830 
831 } // namespace ArmISA
832 } // namespace gem5
gem5::ArmISA::PMU::p
Bitfield< 1 > p
Definition: pmu.hh:138
gem5::ArmISA::PMU::addEventProbe
void addEventProbe(unsigned int id, SimObject *obj, const char *name)
Definition: pmu.cc:131
gem5::ArmISA::MISCREG_PMSWINC
@ MISCREG_PMSWINC
Definition: misc.hh:360
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:200
gem5::ArmISA::PMU::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: pmu.cc:707
gem5::ArmISA::PMU::PMUEvent::enable
virtual void enable()=0
Enable the current event.
gem5::ArmISA::MISCREG_PMCCFILTR
@ MISCREG_PMCCFILTR
Definition: misc.hh:366
gem5::ArmISA::MISCREG_PMCEID1
@ MISCREG_PMCEID1
Definition: misc.hh:363
gem5::ArmISA::MISCREG_PMCR
@ MISCREG_PMCR
Definition: misc.hh:356
gem5::ArmISA::PMU::CounterState::isFiltered
bool isFiltered() const
Definition: pmu.cc:508
gem5::ArmISA::PMU::setCounterValue
void setCounterValue(CounterId id, uint64_t val)
Set the value of a performance counter.
Definition: pmu.cc:614
gem5::ArmISA::MISCREG_PMCCFILTR_EL0
@ MISCREG_PMCCFILTR_EL0
Definition: misc.hh:744
gem5::ArmISA::MISCREG_PMXEVTYPER_EL0
@ MISCREG_PMXEVTYPER_EL0
Definition: misc.hh:743
gem5::ArmISA::PMU::raiseInterrupt
void raiseInterrupt()
Deliver a PMU interrupt to the GIC.
Definition: pmu.cc:679
gem5::ArmISA::MISCREG_PMOVSCLR_EL0
@ MISCREG_PMOVSCLR_EL0
Definition: misc.hh:737
gem5::ArmISA::MISCREG_PMOVSR
@ MISCREG_PMOVSR
Definition: misc.hh:359
warn
#define warn(...)
Definition: logging.hh:256
gem5::RegVal
uint64_t RegVal
Definition: types.hh:173
gem5::ArmISA::MISCREG_PMCNTENCLR
@ MISCREG_PMCNTENCLR
Definition: misc.hh:358
gem5::ArmISA::PMU::setMiscReg
void setMiscReg(int misc_reg, RegVal val) override
Set a register within the PMU.
Definition: pmu.cc:192
gem5::ArmISA::PMU::maximumCounterCount
uint64_t maximumCounterCount
The number of regular event counters.
Definition: pmu.hh:607
gem5::ArmISA::PMU::RegularEvent::RegularProbe::notify
void notify(const uint64_t &val)
Definition: pmu.cc:487
gem5::ArmISA::PMU::CounterState
State of a counter within the PMU.
Definition: pmu.hh:414
UNSERIALIZE_SCALAR
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:575
gem5::ArmISA::PMU::CounterState::getCounterId
uint64_t getCounterId() const
Obtain the counter id.
Definition: pmu.hh:453
gem5::ArmISA::PMU::cycleCounter
CounterState cycleCounter
State of the cycle counter.
Definition: pmu.hh:613
gem5::ArmISA::el
Bitfield< 3, 2 > el
Definition: misc_types.hh:73
gem5::ArmISA::MISCREG_PMINTENCLR_EL1
@ MISCREG_PMINTENCLR_EL1
Definition: misc.hh:733
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
gem5::ArmISA::PMU::PMUEvent::detachEvent
void detachEvent(PMU::CounterState *user)
detach this event from a given counter
Definition: pmu.cc:477
warn_once
#define warn_once(...)
Definition: logging.hh:260
gem5::ArmISA::MISCREG_PMSELR_EL0
@ MISCREG_PMSELR_EL0
Definition: misc.hh:739
gem5::ArmISA::PMU::RegularEvent::disable
void disable() override
Disable the current event.
Definition: pmu.cc:502
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::ArmISA::PMU::exitOnPMUInterrupt
bool exitOnPMUInterrupt
Exit simloop on PMU interrupt.
Definition: pmu.hh:644
gem5::ArmISA::PMU::getCounterTypeRegister
PMEVTYPER_t getCounterTypeRegister(CounterId id) const
Get the type and filter settings of a counter (PMEVTYPER)
Definition: pmu.cc:627
gem5::MipsISA::event
Bitfield< 10, 5 > event
Definition: pra_constants.hh:300
base_gic.hh
gem5::Serializable::serializeSection
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
Definition: serialize.cc:74
gem5::ArmISA::PMU::RegularEvent::RegularProbe
Definition: pmu.hh:361
gem5::ArmISA::PMU::isFiltered
bool isFiltered(const CounterState &ctr) const
Check if a counter's settings allow it to be counted.
gem5::ArmISA::PMU::updateCounter
void updateCounter(CounterState &ctr)
Depending on counter configuration, add or remove the probes driving the counter.
Definition: pmu.cc:584
gem5::X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:776
gem5::ArmISA::PMU::getEvent
std::shared_ptr< PMUEvent > getEvent(uint64_t eventId)
Obtain the event of a given id.
Definition: pmu.cc:757
gem5::ArmISA::PMU::reg_pmceid0
uint64_t reg_pmceid0
Performance counter ID register.
Definition: pmu.hh:600
gem5::ArmISA::PMU::CounterState::eventId
EventTypeId eventId
Counter event ID.
Definition: pmu.hh:473
gem5::ArmISA::MISCREG_PMINTENSET_EL1
@ MISCREG_PMINTENSET_EL1
Definition: misc.hh:732
gem5::ArmISA::PMU::setOverflowStatus
void setOverflowStatus(RegVal new_val)
Used for writing the Overflow Flag Status Register (SET/CLR)
Definition: pmu.cc:665
gem5::ArmISA::miscRegName
const char *const miscRegName[]
Definition: misc.hh:1748
gem5::ThreadContext::contextId
virtual ContextID contextId() const =0
gem5::ArmISA::EL1
@ EL1
Definition: types.hh:274
gem5::ArmISA::PMU::CounterState::setValue
void setValue(uint64_t val)
overwrite the value of the counter
Definition: pmu.cc:570
gem5::ArmISA::PMU::CounterState::add
uint64_t add(uint64_t delta)
Add an event count to the counter and check for overflow.
Definition: pmu.cc:786
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
gem5::ArmISA::MISCREG_PMOVSSET
@ MISCREG_PMOVSSET
Definition: misc.hh:371
gem5::ArmISA::MISCREG_PMUSERENR
@ MISCREG_PMUSERENR
Definition: misc.hh:368
gem5::ArmISA::MISCREG_PMSWINC_EL0
@ MISCREG_PMSWINC_EL0
Definition: misc.hh:738
gem5::ArmISA::MISCREG_PMCCNTR_EL0
@ MISCREG_PMCCNTR_EL0
Definition: misc.hh:742
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:67
gem5::ArmISA::PMU::PMUEvent::attachEvent
void attachEvent(PMU::CounterState *user)
attach this event to a given counter
Definition: pmu.cc:459
sim_exit.hh
gem5::ArmISA::PMU::CounterState::getValue
uint64_t getValue() const
rReturn the counter value
Definition: pmu.cc:558
gem5::exitSimLoop
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
Definition: sim_events.cc:88
gem5::ArmISA::PMU::counters
std::vector< CounterState > counters
State of all general-purpose counters supported by PMU.
Definition: pmu.hh:610
gem5::ArmISA::PMU::resetEventCounts
void resetEventCounts()
Reset all event counters excluding the cycle counter to zero.
Definition: pmu.cc:607
gem5::ArmISA::PMU::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: pmu.cc:728
gem5::ArmISA::PMU::CounterState::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: pmu.cc:778
gem5::ArmISA::PMU::PMCCNTR
static const CounterId PMCCNTR
Cycle Count Register Number.
Definition: pmu.hh:189
gem5::ArmISA::PMU::getCounter
CounterState & getCounter(CounterId id)
Return the state of a counter.
Definition: pmu.hh:529
gem5::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:339
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
gem5::Named::name
virtual std::string name() const
Definition: named.hh:47
gem5::Serializable::unserializeSection
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:81
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::ArmISA::MISCREG_PMCNTENSET
@ MISCREG_PMCNTENSET
Definition: misc.hh:357
gem5::X86ISA::enable
Bitfield< 11 > enable
Definition: misc.hh:1058
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:210
gem5::ArmISA::MISCREG_PMOVSSET_EL0
@ MISCREG_PMOVSSET_EL0
Definition: misc.hh:747
gem5::ArmISA::PMU::swIncrementEvent
std::shared_ptr< SWIncrementEvent > swIncrementEvent
The event that implements the software increment.
Definition: pmu.hh:619
gem5::ArmISA::MISCREG_PMSELR
@ MISCREG_PMSELR
Definition: misc.hh:361
gem5::ArmISA::EL2
@ EL2
Definition: types.hh:275
gem5::ArmISA::PMU::clearInterrupt
void clearInterrupt()
Clear a PMU interrupt.
Definition: pmu.cc:695
isa.hh
gem5::ArmISA::PMU::CounterState::enabled
bool enabled
Is the counter enabled?
Definition: pmu.hh:479
gem5::ArmISA::PMU::CounterState::filter
PMEVTYPER_t filter
Filtering settings (evtCount is unused)
Definition: pmu.hh:476
gem5::ArmInterruptPin::clear
virtual void clear()=0
Clear a signalled interrupt.
gem5::X86ISA::type
type
Definition: misc.hh:734
gem5::ArmISA::PMU::reg_pmcr
PMCR_t reg_pmcr
Performance Monitor Control Register.
Definition: pmu.hh:583
gem5::ArmISA::MISCREG_PMXEVCNTR_EL0
@ MISCREG_PMXEVCNTR_EL0
Definition: misc.hh:745
gem5::ArmISA::PMU::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: pmu.cc:169
gem5::ArmISA::MISCREG_PMXEVTYPER_PMCCFILTR
@ MISCREG_PMXEVTYPER_PMCCFILTR
Definition: misc.hh:95
UNSERIALIZE_OPT_SCALAR
#define UNSERIALIZE_OPT_SCALAR(scalar)
Definition: serialize.hh:582
gem5::ArmISA::PMU::regProbeListeners
void regProbeListeners() override
Register probe listeners for this object.
Definition: pmu.cc:176
gem5::ArmISA::MISCREG_PMINTENSET
@ MISCREG_PMINTENSET
Definition: misc.hh:369
gem5::ArmISA::PMU::reg_pmovsr
RegVal reg_pmovsr
Performance Monitor Overflow Status Register.
Definition: pmu.hh:592
gem5::ArmISA::PMU::cycleCounterEventId
const uint64_t cycleCounterEventId
The id of the counter hardwired to the cpu cycle counter.
Definition: pmu.hh:616
gem5::ArmISA::EL3
@ EL3
Definition: types.hh:276
gem5::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:469
gem5::ArmISA::MISCREG_PMCNTENSET_EL0
@ MISCREG_PMCNTENSET_EL0
Definition: misc.hh:735
gem5::ArmISA::PMU::reg_pmselr
PMSELR_t reg_pmselr
Performance Monitor Selection Register.
Definition: pmu.hh:586
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::ArmISA::PMU::isValidCounter
bool isValidCounter(CounterId id) const
Is this a valid counter ID?
Definition: pmu.hh:518
gem5::ArmISA::PMU::CounterState::detach
void detach()
Detach the counter from its event.
Definition: pmu.cc:535
gem5::ArmISA::PMU::setCounterTypeRegister
void setCounterTypeRegister(CounterId id, PMEVTYPER_t type)
Set the type and filter settings of a performance counter (PMEVTYPER)
Definition: pmu.cc:641
gem5::ArmISA::PMU::reg_pmcnten
RegVal reg_pmcnten
Performance Monitor Count Enable Register.
Definition: pmu.hh:580
generic_timer.hh
gem5::ArmISA::PMU::getCounterValue
uint64_t getCounterValue(CounterId id) const
Get the value of a performance counter.
Definition: pmu.hh:236
gem5::ArmISA::PMU::reg_pmcr_conf
PMCR_t reg_pmcr_conf
Constant (configuration-dependent) part of the PMCR.
Definition: pmu.hh:623
gem5::ArmISA::PMU::updateAllCounters
void updateAllCounters()
Call updateCounter() for each counter in the PMU if the counter's state has changed.
Definition: pmu.cc:438
gem5::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:822
gem5::ArmISA::MISCREG_PMCEID1_EL0
@ MISCREG_PMCEID1_EL0
Definition: misc.hh:741
SERIALIZE_SCALAR
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:568
utility.hh
gem5::ArmISA::MISCREG_PMINTENCLR
@ MISCREG_PMINTENCLR
Definition: misc.hh:370
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:283
gem5::ArmISA::EL0
@ EL0
Definition: types.hh:273
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:214
gem5::ArmISA::PMU::exitOnPMUControl
const bool exitOnPMUControl
Exit simloop on PMU reset or disable.
Definition: pmu.hh:639
inform
#define inform(...)
Definition: logging.hh:257
gem5::ArmISA::MISCREG_PMXEVCNTR
@ MISCREG_PMXEVCNTR
Definition: misc.hh:367
base.hh
gem5::ArmISA::PMU::addSoftwareIncrementEvent
void addSoftwareIncrementEvent(unsigned int id)
Definition: pmu.cc:109
gem5::ArmISA::PMU::RegularEvent::enable
void enable() override
Enable the current event.
Definition: pmu.cc:493
gem5::ArmISA::PMU::CounterState::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: pmu.cc:770
gem5::ArmISA::PMU::clock_remainder
unsigned clock_remainder
Remainder part when the clock counter is divided by 64.
Definition: pmu.hh:604
gem5::ArmISA::PMU::setControlReg
void setControlReg(PMCR_t val)
PMCR write handling.
Definition: pmu.cc:400
gem5::paramIn
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
Definition: types.cc:72
gem5::ArmISA::PMU::setThreadContext
void setThreadContext(ThreadContext *tc) override
Definition: pmu.cc:99
gem5::ArmISA::PMU::reg_pmceid1
uint64_t reg_pmceid1
Definition: pmu.hh:601
gem5::ArmISA::id
Bitfield< 33 > id
Definition: misc_types.hh:305
gem5::ArmISA::MISCREG_PMEVCNTR0_EL0
@ MISCREG_PMEVCNTR0_EL0
Definition: misc.hh:812
gem5::ArmISA::PMU::reg_pmcr_wr_mask
static const RegVal reg_pmcr_wr_mask
PMCR write mask when accessed from the guest.
Definition: pmu.hh:626
pmu.hh
gem5::ArmISA::PMU::interrupt
ArmInterruptPin * interrupt
Performance monitor interrupt number.
Definition: pmu.hh:629
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::ArmInterruptPin::raise
virtual void raise()=0
Signal an interrupt.
gem5::ArmISA::MISCREG_PMXEVTYPER
@ MISCREG_PMXEVTYPER
Definition: misc.hh:365
trace.hh
gem5::ArmISA::PMU::PMUEvent::userCounters
std::set< PMU::CounterState * > userCounters
set of counters using this event
Definition: pmu.hh:344
gem5::ArmISA::PMU::readMiscRegInt
RegVal readMiscRegInt(int misc_reg)
Definition: pmu.cc:310
gem5::ArmISA::MISCREG_PMCEID0_EL0
@ MISCREG_PMCEID0_EL0
Definition: misc.hh:740
gem5::ArmISA::MISCREG_PMCEID0
@ MISCREG_PMCEID0
Definition: misc.hh:362
gem5::ArmISA::PMU::EventTypeId
unsigned int EventTypeId
Event type ID.
Definition: pmu.hh:196
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:236
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::ArmISA::PMU::eventMap
std::map< EventTypeId, std::shared_ptr< PMUEvent > > eventMap
List of event types supported by this PMU.
Definition: pmu.hh:634
gem5::ArmISA::MISCREG_PMCCNTR
@ MISCREG_PMCCNTR
Definition: misc.hh:364
gem5::ArmISA::MISCREG_PMUSERENR_EL0
@ MISCREG_PMUSERENR_EL0
Definition: misc.hh:746
gem5::ArmISA::MISCREG_PMCNTENCLR_EL0
@ MISCREG_PMCNTENCLR_EL0
Definition: misc.hh:736
gem5::ArmISA::PMU::reg_pminten
RegVal reg_pminten
Performance Monitor Interrupt Enable Register.
Definition: pmu.hh:589
gem5::ArmISA::PMU::use64bitCounters
bool use64bitCounters
Determine whether to use 64-bit or 32-bit counters.
Definition: pmu.hh:577
gem5::ArmISA::PMU::PMU
PMU(const ArmPMUParams &p)
Definition: pmu.cc:58
gem5::ArmISA::PMU::registerEvent
void registerEvent(uint32_t id)
Definition: pmu.cc:153
gem5::ArmISA::PMU::~PMU
~PMU()
Definition: pmu.cc:94
gem5::ArmISA::MISCREG_PMCR_EL0
@ MISCREG_PMCR_EL0
Definition: misc.hh:734
gem5::ArmISA::MISCREG_PMEVTYPER0_EL0
@ MISCREG_PMEVTYPER0_EL0
Definition: misc.hh:818
gem5::ArmISA::PMU::readMiscReg
RegVal readMiscReg(int misc_reg) override
Read a register within the PMU.
Definition: pmu.cc:301
gem5::ArmISA::unflattenMiscReg
int unflattenMiscReg(int reg)
Definition: misc.cc:723
gem5::ArmISA::ExceptionLevel
ExceptionLevel
Definition: types.hh:271
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:188
gem5::ArmISA::BaseISADevice
Base class for devices that use the MiscReg interfaces.
Definition: isa_device.hh:61
gem5::ArmISA::PMU::CounterState::attach
void attach(const std::shared_ptr< PMUEvent > &event)
Attach this counter to an event.
Definition: pmu.cc:547
gem5::trace::disable
void disable()
Definition: trace.cc:99

Generated on Sun Jul 30 2023 01:56:49 for gem5 by doxygen 1.8.17