1/* |
2 * Copyright (c) 2011-2014, 2017 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 --- 43 unchanged lines hidden (view full) --- 54namespace ArmISA { 55 56const MiscReg PMU::reg_pmcr_wr_mask = 0x39; 57 58PMU::PMU(const ArmPMUParams *p) 59 : SimObject(p), BaseISADevice(), 60 reg_pmcnten(0), reg_pmcr(0), 61 reg_pmselr(0), reg_pminten(0), reg_pmovsr(0), |
62 reg_pmceid0(0),reg_pmceid1(0), |
63 clock_remainder(0), 64 counters(p->eventCounters), 65 reg_pmcr_conf(0), 66 pmuInterrupt(p->pmuInterrupt), 67 platform(p->platform) 68{ 69 DPRINTF(PMUVerbose, "Initializing the PMU.\n"); 70 --- 18 unchanged lines hidden (view full) --- 89 90void 91PMU::addEventProbe(unsigned int id, SimObject *obj, const char *probe_name) 92{ 93 DPRINTF(PMUVerbose, "PMU: Adding event type '0x%x' as probe %s:%s\n", 94 id, obj->name(), probe_name); 95 pmuEventTypes.insert(std::make_pair(id, EventType(obj, probe_name))); 96 |
97 // Flag the event as available in the corresponding PMCEID register if it 98 // is an architected event. 99 if (id < 0x20) { 100 reg_pmceid0 |= ((uint64_t)1) << id; 101 } else if (id > 0x20 && id < 0x40) { 102 reg_pmceid1 |= ((uint64_t)1) << (id - 0x20); 103 } else if (id >= 0x4000 && id < 0x4020) { 104 reg_pmceid0 |= ((uint64_t)1) << (id - 0x4000 + 32); 105 } else if (id >= 0x4020 && id < 0x4040) { 106 reg_pmceid1 |= ((uint64_t)1) << (id - 0x4020 + 32); 107 } |
108} 109 110void 111PMU::drainResume() 112{ 113 // Re-attach enabled counters after a resume in case they changed. 114 updateAllCounters(); 115} --- 40 unchanged lines hidden (view full) --- 156 case MISCREG_PMCCNTR: 157 cycleCounter.value = val; 158 return; 159 160 case MISCREG_PMSELR_EL0: 161 case MISCREG_PMSELR: 162 reg_pmselr = val; 163 return; |
164 //TODO: implement MISCREF_PMCEID{2,3} |
165 case MISCREG_PMCEID0_EL0: 166 case MISCREG_PMCEID0: 167 case MISCREG_PMCEID1_EL0: 168 case MISCREG_PMCEID1: 169 // Ignore writes 170 return; 171 172 case MISCREG_PMEVTYPER0_EL0...MISCREG_PMEVTYPER5_EL0: --- 85 unchanged lines hidden (view full) --- 258 case MISCREG_PMSWINC_EL0: 259 case MISCREG_PMSWINC: // Software Increment Register (RAZ) 260 return 0; 261 262 case MISCREG_PMSELR: 263 return reg_pmselr; 264 265 case MISCREG_PMCEID0_EL0: |
266 return reg_pmceid0; |
267 268 case MISCREG_PMCEID1_EL0: |
269 return reg_pmceid1; 270 271 //TODO: implement MISCREF_PMCEID{2,3} 272 case MISCREG_PMCEID0: // Common Event ID register 273 return reg_pmceid0 & 0xFFFFFFFF; 274 |
275 case MISCREG_PMCEID1: // Common Event ID register |
276 return reg_pmceid1 & 0xFFFFFFFF; |
277 278 case MISCREG_PMCCNTR_EL0: 279 return cycleCounter.value; 280 281 case MISCREG_PMCCNTR: 282 return cycleCounter.value & 0xFFFFFFFF; 283 284 case MISCREG_PMEVTYPER0_EL0...MISCREG_PMEVTYPER5_EL0: --- 244 unchanged lines hidden (view full) --- 529{ 530 DPRINTF(Checkpoint, "Serializing Arm PMU\n"); 531 532 SERIALIZE_SCALAR(reg_pmcr); 533 SERIALIZE_SCALAR(reg_pmcnten); 534 SERIALIZE_SCALAR(reg_pmselr); 535 SERIALIZE_SCALAR(reg_pminten); 536 SERIALIZE_SCALAR(reg_pmovsr); |
537 SERIALIZE_SCALAR(reg_pmceid0); 538 SERIALIZE_SCALAR(reg_pmceid1); |
539 SERIALIZE_SCALAR(clock_remainder); 540 541 for (size_t i = 0; i < counters.size(); ++i) 542 counters[i].serializeSection(cp, csprintf("counters.%i", i)); 543 544 cycleCounter.serializeSection(cp, "cycleCounter"); 545} 546 547void 548PMU::unserialize(CheckpointIn &cp) 549{ 550 DPRINTF(Checkpoint, "Unserializing Arm PMU\n"); 551 552 UNSERIALIZE_SCALAR(reg_pmcr); 553 UNSERIALIZE_SCALAR(reg_pmcnten); 554 UNSERIALIZE_SCALAR(reg_pmselr); 555 UNSERIALIZE_SCALAR(reg_pminten); 556 UNSERIALIZE_SCALAR(reg_pmovsr); |
557 558 // Old checkpoints used to store the entire PMCEID value in a 559 // single 64-bit entry (reg_pmceid). The register was extended in 560 // ARMv8.1, so we now need to store it as two 64-bit registers. 561 if (!UNSERIALIZE_OPT_SCALAR(reg_pmceid0)) 562 paramIn(cp, "reg_pmceid", reg_pmceid0); 563 564 if (!UNSERIALIZE_OPT_SCALAR(reg_pmceid1)) 565 reg_pmceid1 = 0; 566 |
567 UNSERIALIZE_SCALAR(clock_remainder); 568 569 for (size_t i = 0; i < counters.size(); ++i) 570 counters[i].unserializeSection(cp, csprintf("counters.%i", i)); 571 572 cycleCounter.unserializeSection(cp, "cycleCounter"); 573} 574 --- 37 unchanged lines hidden --- |