gem5  v20.1.0.0
generic_timer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, 2015, 2017-2018,2020 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 #ifndef __DEV_ARM_GENERIC_TIMER_HH__
39 #define __DEV_ARM_GENERIC_TIMER_HH__
40 
41 #include "arch/arm/isa_device.hh"
42 #include "arch/arm/system.hh"
43 #include "dev/arm/base_gic.hh"
45 #include "sim/core.hh"
46 #include "sim/sim_object.hh"
47 
56 
57 class Checkpoint;
58 class SystemCounterParams;
59 class GenericTimerParams;
60 class GenericTimerFrameParams;
61 class GenericTimerMemParams;
62 
66 {
67  public:
70  virtual void notify(void) = 0;
71 };
72 
75 class SystemCounter : public SimObject
76 {
77  protected:
79  bool _enabled;
81  uint32_t _freq;
83  uint64_t _value;
85  uint64_t _increment;
95 
98 
100  static constexpr size_t MAX_FREQ_ENTRIES = 1004;
101 
102  public:
103  SystemCounter(SystemCounterParams *const p);
104 
107  static void validateCounterRef(SystemCounter *sys_cnt);
108 
110  bool enabled() const { return _enabled; }
112  uint32_t freq() const { return _freq; }
114  uint64_t value();
116  uint64_t increment() const { return _increment; }
120  size_t activeFreqEntry() const { return _activeFreqEntry; }
122  Tick period() const { return _period; }
123 
125  void enable();
127  void disable();
128 
132  void freqUpdateSchedule(size_t new_freq_entry);
133 
135  void setValue(uint64_t new_value);
136 
138  void registerListener(SystemCounterListener *listener);
139 
141  Tick whenValue(uint64_t target_val);
142  Tick whenValue(uint64_t cur_val, uint64_t target_val) const;
143 
144  void serialize(CheckpointOut &cp) const override;
145  void unserialize(CheckpointIn &cp) override;
146 
147  private:
148  // Disable copying
149  SystemCounter(const SystemCounter &c);
150 
155  void freqUpdateCallback();
156 
158  void updateValue(void);
159 
161  void updateTick(void);
162 
164  void notifyListeners(void) const;
165 };
166 
169 {
170  protected:
172  BitUnion32(ArchTimerCtrl)
173  Bitfield<0> enable;
174  Bitfield<1> imask;
175  Bitfield<2> istatus;
176  EndBitUnion(ArchTimerCtrl)
177 
178 
179  const std::string _name;
180 
183 
185 
187 
189  ArchTimerCtrl _control;
191  uint64_t _counterLimit;
193  uint64_t _offset;
194 
199  void updateCounter();
200 
202  void counterLimitReached();
204 
205  virtual bool scheduleEvents() { return true; }
206 
207  public:
208  ArchTimer(const std::string &name,
209  SimObject &parent,
210  SystemCounter &sysctr,
211  ArmInterruptPin *interrupt);
212 
214  std::string name() const { return _name; }
215 
217  uint64_t compareValue() const { return _counterLimit; }
219  void setCompareValue(uint64_t val);
220 
222  uint32_t timerValue() const { return _counterLimit - value(); }
224  void setTimerValue(uint32_t val);
225 
227  uint32_t control() const { return _control; }
228  void setControl(uint32_t val);
229 
230  uint64_t offset() const { return _offset; }
231  void setOffset(uint64_t val);
232 
234  uint64_t value() const;
235  Tick whenValue(uint64_t target_val) {
236  return _systemCounter.whenValue(value(), target_val);
237  }
238 
239  void notify(void) override;
240 
241  // Serializable
242  void serialize(CheckpointOut &cp) const override;
243  void unserialize(CheckpointIn &cp) override;
244 
245  // Drainable
246  DrainState drain() override;
247  void drainResume() override;
248 
249  private:
250  // Disable copying
251  ArchTimer(const ArchTimer &t);
252 };
253 
254 class ArchTimerKvm : public ArchTimer
255 {
256  private:
258 
259  public:
260  ArchTimerKvm(const std::string &name,
261  ArmSystem &system,
262  SimObject &parent,
263  SystemCounter &sysctr,
264  ArmInterruptPin *interrupt)
265  : ArchTimer(name, parent, sysctr, interrupt), system(system) {}
266 
267  protected:
268  // For ArchTimer's in a GenericTimerISA with Kvm execution about
269  // to begin, skip rescheduling the event.
270  // Otherwise, we should reschedule the event (if necessary).
271  bool scheduleEvents() override {
272  return !system.validKvmEnvironment();
273  }
274 };
275 
276 class GenericTimer : public SimObject
277 {
278  public:
279  const GenericTimerParams * params() const;
280 
281  GenericTimer(GenericTimerParams *const p);
282 
283  void serialize(CheckpointOut &cp) const override;
284  void unserialize(CheckpointIn &cp) override;
285 
286  public:
287  void setMiscReg(int misc_reg, unsigned cpu, RegVal val);
288  RegVal readMiscReg(int misc_reg, unsigned cpu);
289 
290  protected:
292  {
293  public:
294  CoreTimers(GenericTimer &_parent, ArmSystem &system, unsigned cpu,
295  ArmInterruptPin *_irqPhysS, ArmInterruptPin *_irqPhysNS,
296  ArmInterruptPin *_irqVirt, ArmInterruptPin *_irqHyp);
297 
300 
302  uint32_t cntfrq;
303 
305  ArmISA::CNTKCTL cntkctl;
306 
308  ArmISA::CNTHCTL cnthctl;
309 
312 
317 
322 
323  // Event Stream. Events are generated based on a configurable
324  // transitionBit over the counter value. transitionTo indicates
325  // the transition direction (0->1 or 1->0)
326  struct EventStream
327  {
329  uint8_t transitionTo;
330  uint8_t transitionBit;
331 
332  uint64_t
333  eventTargetValue(uint64_t val) const
334  {
335  uint64_t bit_val = bits(val, transitionBit);
336  uint64_t ret_val = mbits(val, 63, transitionBit);
337  uint64_t incr_val = 1 << transitionBit;
338  if (bit_val == transitionTo)
339  incr_val *= 2;
340  return ret_val + incr_val;
341  }
342  };
343 
348  void eventStreamCallback() const;
349  void schedNextEvent(EventStream &ev_stream, ArchTimer &timer);
350 
351  void notify(void) override;
352 
353  void serialize(CheckpointOut &cp) const override;
354  void unserialize(CheckpointIn &cp) override;
355 
356  private:
357  // Disable copying
358  CoreTimers(const CoreTimers &c);
359  };
360 
361  CoreTimers &getTimers(int cpu_id);
362  void createTimers(unsigned cpus);
363 
366 
369 
370  protected: // Configuration
373 
374  void handleStream(CoreTimers::EventStream *ev_stream,
375  ArchTimer *timer, RegVal old_cnt_ctl, RegVal cnt_ctl);
376 };
377 
379 {
380  public:
381  GenericTimerISA(GenericTimer &_parent, unsigned _cpu)
382  : parent(_parent), cpu(_cpu) {}
383 
384  void setMiscReg(int misc_reg, RegVal val) override;
385  RegVal readMiscReg(int misc_reg) override;
386 
387  protected:
389  unsigned cpu;
390 };
391 
393 {
394  public:
395  GenericTimerFrame(GenericTimerFrameParams *const p);
396 
397  void serialize(CheckpointOut &cp) const override;
398  void unserialize(CheckpointIn &cp) override;
399 
401  bool hasVirtualTimer() const;
402 
405  uint64_t getVirtOffset() const;
406 
409  void setVirtOffset(uint64_t new_offset);
410 
412  bool hasEl0View() const;
413 
415  uint8_t getAccessBits() const;
416 
418  void setAccessBits(uint8_t data);
419 
421  bool hasNonSecureAccess() const;
422 
425  void setNonSecureAccess();
426 
428  bool hasReadableVoff() const;
429 
430  protected:
431  AddrRangeList getAddrRanges() const override;
432  Tick read(PacketPtr pkt) override;
433  Tick write(PacketPtr pkt) override;
434 
435  private:
437  uint64_t timerRead(Addr addr, size_t size, bool is_sec, bool to_el0) const;
438  void timerWrite(Addr addr, size_t size, uint64_t data, bool is_sec,
439  bool to_el0);
442 
443  static const Addr TIMER_CNTPCT_LO = 0x00;
444  static const Addr TIMER_CNTPCT_HI = 0x04;
445  static const Addr TIMER_CNTVCT_LO = 0x08;
446  static const Addr TIMER_CNTVCT_HI = 0x0c;
447  static const Addr TIMER_CNTFRQ = 0x10;
448  static const Addr TIMER_CNTEL0ACR = 0x14;
449  static const Addr TIMER_CNTVOFF_LO = 0x18;
450  static const Addr TIMER_CNTVOFF_HI = 0x1c;
451  static const Addr TIMER_CNTP_CVAL_LO = 0x20;
452  static const Addr TIMER_CNTP_CVAL_HI = 0x24;
453  static const Addr TIMER_CNTP_TVAL = 0x28;
454  static const Addr TIMER_CNTP_CTL = 0x2c;
455  static const Addr TIMER_CNTV_CVAL_LO = 0x30;
456  static const Addr TIMER_CNTV_CVAL_HI = 0x34;
457  static const Addr TIMER_CNTV_TVAL = 0x38;
458  static const Addr TIMER_CNTV_CTL = 0x3c;
459 
462 
465 
469 
471  BitUnion8(AccessBits)
472  Bitfield<5> rwpt;
473  Bitfield<4> rwvt;
474  Bitfield<3> rvoff;
475  Bitfield<2> rfrq;
476  Bitfield<1> rvct;
477  Bitfield<0> rpct;
478  EndBitUnion(AccessBits)
479  AccessBits accessBits;
480 
481  // Reports access properties of the CNTEL0Base register frame elements
482  BitUnion16(AccessBitsEl0)
483  Bitfield<9> pten;
484  Bitfield<8> vten;
485  Bitfield<1> vcten;
486  Bitfield<0> pcten;
487  EndBitUnion(AccessBitsEl0)
488  AccessBitsEl0 accessBitsEl0;
489 
492 
494 };
495 
497 {
498  public:
499  GenericTimerMem(GenericTimerMemParams *const p);
500 
503  static void validateFrameRange(const AddrRange &range);
504 
508  static bool validateAccessPerm(ArmSystem &sys, bool is_sec);
509 
510  protected:
511  AddrRangeList getAddrRanges() const override;
512  Tick read(PacketPtr pkt) override;
513  Tick write(PacketPtr pkt) override;
514 
515  private:
517  uint64_t counterCtrlRead(Addr addr, size_t size, bool is_sec) const;
518  void counterCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec);
520 
521  BitUnion32(CNTCR)
522  Bitfield<17,8> fcreq;
523  Bitfield<2> scen;
524  Bitfield<1> hdbg;
525  Bitfield<0> en;
526  EndBitUnion(CNTCR)
527 
528  BitUnion32(CNTSR)
529  Bitfield<31,8> fcack;
530  EndBitUnion(CNTSR)
531 
532  static const Addr COUNTER_CTRL_CNTCR = 0x00;
533  static const Addr COUNTER_CTRL_CNTSR = 0x04;
534  static const Addr COUNTER_CTRL_CNTCV_LO = 0x08;
535  static const Addr COUNTER_CTRL_CNTCV_HI = 0x0c;
536  static const Addr COUNTER_CTRL_CNTSCR = 0x10;
537  static const Addr COUNTER_CTRL_CNTID = 0x1c;
538  static const Addr COUNTER_CTRL_CNTFID = 0x20;
539 
541  uint64_t counterStatusRead(Addr addr, size_t size) const;
542  void counterStatusWrite(Addr addr, size_t size, uint64_t data);
544 
545  static const Addr COUNTER_STATUS_CNTCV_LO = 0x00;
546  static const Addr COUNTER_STATUS_CNTCV_HI = 0x04;
547 
549  uint64_t timerCtrlRead(Addr addr, size_t size, bool is_sec) const;
550  void timerCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec);
552 
554  uint32_t cnttidr;
555 
556  static const Addr TIMER_CTRL_CNTFRQ = 0x00;
557  static const Addr TIMER_CTRL_CNTNSAR = 0x04;
558  static const Addr TIMER_CTRL_CNTTIDR = 0x08;
559  static const Addr TIMER_CTRL_CNTACR = 0x40;
560  static const Addr TIMER_CTRL_CNTVOFF_LO = 0x80;
561  static const Addr TIMER_CTRL_CNTVOFF_HI = 0x84;
562 
565 
568 
570  static constexpr size_t MAX_TIMER_FRAMES = 8;
571 
574 
576 };
577 
578 #endif // __DEV_ARM_GENERIC_TIMER_HH__
GenericTimerMem::TIMER_CTRL_CNTVOFF_LO
static const Addr TIMER_CTRL_CNTVOFF_LO
Definition: generic_timer.hh:560
GenericTimerMem::getAddrRanges
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
Definition: generic_timer.cc:1291
isa_device.hh
GenericTimer::CoreTimers::irqVirt
const ArmInterruptPin * irqVirt
Definition: generic_timer.hh:315
generic_timer_miscregs_types.hh
SystemCounter
Global system counter.
Definition: generic_timer.hh:75
ArchTimer::setTimerValue
void setTimerValue(uint32_t val)
Sets the TimerValue view of the timer.
Definition: generic_timer.cc:309
ArchTimer::name
std::string name() const
Returns the timer name.
Definition: generic_timer.hh:214
GenericTimerMem::hdbg
Bitfield< 1 > hdbg
Definition: generic_timer.hh:524
GenericTimer::CoreTimers::EventStream::eventTargetValue
uint64_t eventTargetValue(uint64_t val) const
Definition: generic_timer.hh:333
SystemCounter::_increment
uint64_t _increment
Value increment in each counter cycle.
Definition: generic_timer.hh:85
GenericTimer::CoreTimers::EventStream::transitionBit
uint8_t transitionBit
Definition: generic_timer.hh:330
GenericTimerISA
Definition: generic_timer.hh:378
GenericTimer::handleStream
void handleStream(CoreTimers::EventStream *ev_stream, ArchTimer *timer, RegVal old_cnt_ctl, RegVal cnt_ctl)
Definition: generic_timer.cc:488
GenericTimerMem::timerCtrlWrite
void timerCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec)
Definition: generic_timer.cc:1533
GenericTimer::CoreTimers::cntkctl
ArmISA::CNTKCTL cntkctl
Kernel control register.
Definition: generic_timer.hh:305
ArchTimerKvm::ArchTimerKvm
ArchTimerKvm(const std::string &name, ArmSystem &system, SimObject &parent, SystemCounter &sysctr, ArmInterruptPin *interrupt)
Definition: generic_timer.hh:260
GenericTimerFrame::rfrq
Bitfield< 2 > rfrq
Definition: generic_timer.hh:475
GenericTimer::system
ArmSystem & system
ARM system containing this timer.
Definition: generic_timer.hh:372
SystemCounter::whenValue
Tick whenValue(uint64_t target_val)
Returns the tick at which a certain counter value is reached.
Definition: generic_timer.cc:149
SystemCounter::_listeners
std::vector< SystemCounterListener * > _listeners
Listeners to changes in counting speed.
Definition: generic_timer.hh:97
ArchTimer::BitUnion32
BitUnion32(ArchTimerCtrl) Bitfield< 0 > enable
Control register.
GenericTimerFrame::timerRange
const AddrRange timerRange
Definition: generic_timer.hh:440
data
const char data[]
Definition: circlebuf.test.cc:42
GenericTimerMem::cnttidr
uint32_t cnttidr
ID register for reporting features of implemented timer frames.
Definition: generic_timer.hh:554
GenericTimerMem::counterStatusRange
const AddrRange counterStatusRange
Definition: generic_timer.hh:543
GenericTimerMem::en
Bitfield< 0 > en
Definition: generic_timer.hh:525
GenericTimerFrame::physTimer
ArchTimer physTimer
Physical and virtual timers.
Definition: generic_timer.hh:467
ArchTimer::_parent
EndBitUnion(ArchTimerCtrl) const std SimObject & _parent
Name of this timer.
Definition: generic_timer.hh:176
GenericTimerISA::readMiscReg
RegVal readMiscReg(int misc_reg) override
Read a system register belonging to this device.
Definition: generic_timer.cc:869
ArmISA::BaseISADevice
Base class for devices that use the MiscReg interfaces.
Definition: isa_device.hh:58
GenericTimerMem::COUNTER_CTRL_CNTID
static const Addr COUNTER_CTRL_CNTID
Definition: generic_timer.hh:537
SystemCounter::disable
void disable()
Disables the counter after a CNTCR.EN == 0.
Definition: generic_timer.cc:94
ArchTimer::ArchTimer
ArchTimer(const std::string &name, SimObject &parent, SystemCounter &sysctr, ArmInterruptPin *interrupt)
Definition: generic_timer.cc:248
GenericTimer::CoreTimers::physEvStream
EventStream physEvStream
Definition: generic_timer.hh:344
GenericTimer::CoreTimers::hyp
ArchTimerKvm hyp
Definition: generic_timer.hh:321
GenericTimerFrame::virtTimer
ArchTimer virtTimer
Definition: generic_timer.hh:468
GenericTimerFrame::TIMER_CNTP_TVAL
static const Addr TIMER_CNTP_TVAL
Definition: generic_timer.hh:453
GenericTimerFrame::BitUnion16
BitUnion16(AccessBitsEl0) Bitfield< 9 > pten
GenericTimerMem::COUNTER_CTRL_CNTCV_LO
static const Addr COUNTER_CTRL_CNTCV_LO
Definition: generic_timer.hh:534
Serializable
Basic support for object serialization.
Definition: serialize.hh:172
GenericTimerFrame::hasReadableVoff
bool hasReadableVoff() const
Indicates if CNTVOFF is readable for this frame.
Definition: generic_timer.cc:967
GenericTimerFrame::setVirtOffset
void setVirtOffset(uint64_t new_offset)
Sets the virtual offset for this frame's virtual timer after a write to CNTVOFF.
Definition: generic_timer.cc:931
ArchTimer::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: generic_timer.cc:362
GenericTimerFrame::systemCounter
SystemCounter & systemCounter
System counter reference.
Definition: generic_timer.hh:464
SystemCounter::_freq
uint32_t _freq
Counter frequency (as specified by CNTFRQ).
Definition: generic_timer.hh:81
ArchTimer::imask
Bitfield< 1 > imask
Definition: generic_timer.hh:174
base_gic.hh
SystemCounter::_nextFreqEntry
size_t _nextFreqEntry
Definition: generic_timer.hh:153
GenericTimer::CoreTimers::eventStreamCallback
void eventStreamCallback() const
Definition: generic_timer.cc:776
ArchTimer
Per-CPU architected timer.
Definition: generic_timer.hh:168
GenericTimerMem::counterStatusWrite
void counterStatusWrite(Addr addr, size_t size, uint64_t data)
Definition: generic_timer.cc:1475
GenericTimerFrame::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: generic_timer.cc:913
SystemCounter::freq
uint32_t freq() const
Returns the counter frequency.
Definition: generic_timer.hh:112
GenericTimer::CoreTimers::physS
ArchTimerKvm physS
Definition: generic_timer.hh:318
GenericTimerFrame::hasEl0View
bool hasEl0View() const
Indicates if this frame implements a second EL0 view.
Definition: generic_timer.cc:937
GenericTimerMem::scen
Bitfield< 2 > scen
Definition: generic_timer.hh:523
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
SystemCounter::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: generic_timer.cc:226
SystemCounter::validateCounterRef
static void validateCounterRef(SystemCounter *sys_cnt)
Validates a System Counter reference.
Definition: generic_timer.cc:79
ArchTimer::_control
ArchTimerCtrl _control
Value of the control register ({CNTP/CNTHP/CNTV}_CTL).
Definition: generic_timer.hh:189
GenericTimerFrame::timerRead
uint64_t timerRead(Addr addr, size_t size, bool is_sec, bool to_el0) const
CNTBase/CNTEL0Base (Memory-mapped timer frame)
Definition: generic_timer.cc:1040
ArchTimer::updateCounter
void updateCounter()
Timer settings or the offset has changed, re-evaluate trigger condition and raise interrupt if necess...
Definition: generic_timer.cc:279
GenericTimerFrame::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: generic_timer.cc:1010
GenericTimerFrame::TIMER_CNTEL0ACR
static const Addr TIMER_CNTEL0ACR
Definition: generic_timer.hh:448
ArchTimer::timerValue
uint32_t timerValue() const
Returns the TimerValue view of the timer.
Definition: generic_timer.hh:222
std::vector< uint32_t >
GenericTimer
Definition: generic_timer.hh:276
SystemCounter::activeFreqEntry
size_t activeFreqEntry() const
Returns the currently active frequency table entry.
Definition: generic_timer.hh:120
GenericTimerFrame::vten
Bitfield< 8 > vten
Definition: generic_timer.hh:484
GenericTimer::CoreTimers::irqPhysS
const ArmInterruptPin * irqPhysS
Definition: generic_timer.hh:313
System::validKvmEnvironment
bool validKvmEnvironment() const
Verify gem5 configuration will support KVM emulation.
Definition: system.cc:368
mbits
T mbits(T val, int first, int last)
Mask off the given bits in place like bits() but without shifting.
Definition: bitfield.hh:104
ArchTimerKvm::scheduleEvents
bool scheduleEvents() override
Definition: generic_timer.hh:271
GenericTimerMem::COUNTER_STATUS_CNTCV_HI
static const Addr COUNTER_STATUS_CNTCV_HI
Definition: generic_timer.hh:546
GenericTimerMem::COUNTER_STATUS_CNTCV_LO
static const Addr COUNTER_STATUS_CNTCV_LO
Definition: generic_timer.hh:545
ArchTimer::setOffset
void setOffset(uint64_t val)
Definition: generic_timer.cc:343
system.hh
GenericTimer::CoreTimers::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: generic_timer.cc:829
SystemCounter::_updateTick
Tick _updateTick
Counter cycle start Tick when the counter status affecting its value has been updated.
Definition: generic_timer.hh:94
GenericTimerMem::timerCtrlRange
const AddrRange timerCtrlRange
Definition: generic_timer.hh:551
SystemCounter::updateTick
void updateTick(void)
Updates the update tick, normalizes to the lower cycle start tick.
Definition: generic_timer.cc:155
GenericTimerFrame::EndBitUnion
EndBitUnion(AccessBits) AccessBits accessBits
ArchTimer::notify
void notify(void) override
Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled p...
Definition: generic_timer.cc:356
GenericTimerMem::counterCtrlRange
const AddrRange counterCtrlRange
Definition: generic_timer.hh:519
GenericTimerFrame::addrRanges
AddrRangeList addrRanges
All MMIO ranges GenericTimerFrame responds to.
Definition: generic_timer.hh:461
GenericTimer::CoreTimers::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: generic_timer.cc:798
GenericTimerMem::validateAccessPerm
static bool validateAccessPerm(ArmSystem &sys, bool is_sec)
Validates an MMIO access permissions.
Definition: generic_timer.cc:1285
GenericTimerFrame::TIMER_CNTPCT_LO
static const Addr TIMER_CNTPCT_LO
Definition: generic_timer.hh:443
GenericTimer::CoreTimers::schedNextEvent
void schedNextEvent(EventStream &ev_stream, ArchTimer &timer)
Definition: generic_timer.cc:783
SystemCounter::_period
Tick _period
Cached copy of the counter period (inverse of the frequency).
Definition: generic_timer.hh:91
EventFunctionWrapper
Definition: eventq.hh:1101
PioDevice::sys
System * sys
Definition: io_device.hh:102
GenericTimer::CoreTimers::cnthctl
ArmISA::CNTHCTL cnthctl
Hypervisor control register.
Definition: generic_timer.hh:308
SystemCounter::_freqTable
std::vector< uint32_t > _freqTable
Frequency modes table with all possible frequencies for the counter.
Definition: generic_timer.hh:87
GenericTimer::CoreTimers::physEventStreamCallback
void physEventStreamCallback()
Definition: generic_timer.cc:762
GenericTimerFrame::timerWrite
void timerWrite(Addr addr, size_t size, uint64_t data, bool is_sec, bool to_el0)
Definition: generic_timer.cc:1152
DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:71
ArchTimer::setCompareValue
void setCompareValue(uint64_t val)
Sets the CompareValue view of the timer.
Definition: generic_timer.cc:302
GenericTimerMem::TIMER_CTRL_CNTNSAR
static const Addr TIMER_CTRL_CNTNSAR
Definition: generic_timer.hh:557
SystemCounter::freqUpdateCallback
void freqUpdateCallback()
Callback for the frequency update.
Definition: generic_timer.cc:179
SystemCounter::enable
void enable()
Enables the counter after a CNTCR.EN == 1.
Definition: generic_timer.cc:86
cp
Definition: cprintf.cc:40
PioDevice
This device is the base class which all devices senstive to an address range inherit from.
Definition: io_device.hh:99
GenericTimerFrame::TIMER_CNTVOFF_HI
static const Addr TIMER_CNTVOFF_HI
Definition: generic_timer.hh:450
GenericTimerMem::MAX_TIMER_FRAMES
static constexpr size_t MAX_TIMER_FRAMES
Maximum architectural number of memory-mapped timer frames.
Definition: generic_timer.hh:570
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
GenericTimerFrame::hasVirtualTimer
bool hasVirtualTimer() const
Indicates if this frame implements a virtual timer.
Drainable
Interface for objects that might require draining before checkpointing.
Definition: drain.hh:230
ArchTimer::drain
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: generic_timer.cc:384
GenericTimerFrame::TIMER_CNTP_CVAL_HI
static const Addr TIMER_CNTP_CVAL_HI
Definition: generic_timer.hh:452
AddrRange
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:68
GenericTimerMem::counterStatusRead
uint64_t counterStatusRead(Addr addr, size_t size) const
CNTReadBase (System counter status frame)
Definition: generic_timer.cc:1462
GenericTimer::params
const GenericTimerParams * params() const
Definition: generic_timer.cc:410
SystemCounter::increment
uint64_t increment() const
Returns the value increment.
Definition: generic_timer.hh:116
sim_object.hh
GenericTimer::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: generic_timer.cc:427
GenericTimer::CoreTimers::parent
GenericTimer & parent
Generic Timer parent reference.
Definition: generic_timer.hh:299
GenericTimerMem::frames
std::vector< GenericTimerFrame * > frames
Timer frame references.
Definition: generic_timer.hh:573
GenericTimerMem::COUNTER_CTRL_CNTCV_HI
static const Addr COUNTER_CTRL_CNTCV_HI
Definition: generic_timer.hh:535
GenericTimerFrame::TIMER_CNTP_CVAL_LO
static const Addr TIMER_CNTP_CVAL_LO
Definition: generic_timer.hh:451
ArchTimer::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: generic_timer.cc:370
GenericTimerFrame::TIMER_CNTP_CTL
static const Addr TIMER_CNTP_CTL
Definition: generic_timer.hh:454
GenericTimerFrame::TIMER_CNTV_TVAL
static const Addr TIMER_CNTV_TVAL
Definition: generic_timer.hh:457
ArchTimer::compareValue
uint64_t compareValue() const
Returns the CompareValue view of the timer.
Definition: generic_timer.hh:217
SystemCounter::_freqUpdateEvent
EventFunctionWrapper _freqUpdateEvent
Frequency update event handling.
Definition: generic_timer.hh:152
SystemCounter::registerListener
void registerListener(SystemCounterListener *listener)
Called from System Counter Listeners to register.
Definition: generic_timer.cc:193
ArchTimerKvm::system
ArmSystem & system
Definition: generic_timer.hh:257
GenericTimerMem::counterCtrlWrite
void counterCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec)
Definition: generic_timer.cc:1388
GenericTimer::CoreTimers::notify
void notify(void) override
Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled p...
Definition: generic_timer.cc:791
GenericTimerFrame::getAddrRanges
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
Definition: generic_timer.cc:973
SystemCounter::SystemCounter
SystemCounter(SystemCounterParams *const p)
Definition: generic_timer.cc:55
GenericTimerMem::GenericTimerMem
GenericTimerMem(GenericTimerMemParams *const p)
Definition: generic_timer.cc:1247
GenericTimerFrame::TIMER_CNTFRQ
static const Addr TIMER_CNTFRQ
Definition: generic_timer.hh:447
GenericTimer::readMiscReg
RegVal readMiscReg(int misc_reg, unsigned cpu)
Definition: generic_timer.cc:640
GenericTimer::CoreTimers::irqPhysNS
const ArmInterruptPin * irqPhysNS
Definition: generic_timer.hh:314
GenericTimerMem::validateFrameRange
static void validateFrameRange(const AddrRange &range)
Validates a Generic Timer register frame address range.
Definition: generic_timer.cc:1276
GenericTimerISA::cpu
unsigned cpu
Definition: generic_timer.hh:389
GenericTimerFrame::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: generic_timer.cc:901
GenericTimer::CoreTimers::EventStream::event
EventFunctionWrapper event
Definition: generic_timer.hh:328
GenericTimer::getTimers
CoreTimers & getTimers(int cpu_id)
Definition: generic_timer.cc:458
ArchTimer::value
uint64_t value() const
Returns the value of the counter which this timer relies on.
Definition: generic_timer.cc:350
GenericTimerMem::counterCtrlRead
uint64_t counterCtrlRead(Addr addr, size_t size, bool is_sec) const
CNTControlBase (System counter control frame)
Definition: generic_timer.cc:1350
GenericTimerFrame::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: generic_timer.cc:979
GenericTimerISA::parent
GenericTimer & parent
Definition: generic_timer.hh:388
GenericTimerMem::system
ArmSystem & system
Definition: generic_timer.hh:575
GenericTimerFrame::BitUnion8
BitUnion8(AccessBits) Bitfield< 5 > rwpt
Reports access properties of the CNTBase register frame elements.
GenericTimerFrame
Definition: generic_timer.hh:392
SystemCounter::MAX_FREQ_ENTRIES
static constexpr size_t MAX_FREQ_ENTRIES
Maximum architectural number of frequency table entries.
Definition: generic_timer.hh:100
SystemCounter::value
uint64_t value()
Updates and returns the counter value.
Definition: generic_timer.cc:102
SystemCounter::notifyListeners
void notifyListeners(void) const
Notifies counting speed changes to listeners.
Definition: generic_timer.cc:199
SystemCounter::enabled
bool enabled() const
Indicates if the counter is enabled.
Definition: generic_timer.hh:110
ArchTimer::_systemCounter
SystemCounter & _systemCounter
Definition: generic_timer.hh:184
GenericTimerFrame::rvoff
Bitfield< 3 > rvoff
Definition: generic_timer.hh:474
GenericTimerFrame::TIMER_CNTVCT_HI
static const Addr TIMER_CNTVCT_HI
Definition: generic_timer.hh:446
ArchTimerKvm
Definition: generic_timer.hh:254
ArchTimer::control
uint32_t control() const
Sets the control register.
Definition: generic_timer.hh:227
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
GenericTimerFrame::TIMER_CNTV_CVAL_HI
static const Addr TIMER_CNTV_CVAL_HI
Definition: generic_timer.hh:456
SystemCounterListener
Abstract class for elements whose events depend on the counting speed of the System Counter.
Definition: generic_timer.hh:65
core.hh
GenericTimerMem::COUNTER_CTRL_CNTSR
static const Addr COUNTER_CTRL_CNTSR
Definition: generic_timer.hh:533
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
GenericTimerFrame::system
ArmSystem & system
Definition: generic_timer.hh:493
SystemCounter::_enabled
bool _enabled
Indicates if the counter is enabled.
Definition: generic_timer.hh:79
SystemCounter::setValue
void setValue(uint64_t new_value)
Sets the value explicitly from writes to CNTCR.CNTCV.
Definition: generic_timer.cc:121
GenericTimerFrame::timerEl0Range
AddrRange timerEl0Range
Definition: generic_timer.hh:441
GenericTimer::CoreTimers::irqHyp
const ArmInterruptPin * irqHyp
Definition: generic_timer.hh:316
ArchTimer::istatus
Bitfield< 2 > istatus
Definition: generic_timer.hh:175
GenericTimerFrame::getAccessBits
uint8_t getAccessBits() const
Returns the access bits for this frame.
Definition: generic_timer.cc:943
ArchTimer::counterLimitReached
void counterLimitReached()
Called when the upcounter reaches the programmed value.
Definition: generic_timer.cc:261
SystemCounter::_activeFreqEntry
size_t _activeFreqEntry
Currently selected entry in the table, its contents should match _freq.
Definition: generic_timer.hh:89
SystemCounter::updateValue
void updateValue(void)
Updates the counter value.
Definition: generic_timer.cc:110
ArmSystem
Definition: system.hh:59
GenericTimerMem::COUNTER_CTRL_CNTSCR
static const Addr COUNTER_CTRL_CNTSCR
Definition: generic_timer.hh:536
GenericTimer::CoreTimers::EventStream
Definition: generic_timer.hh:326
GenericTimerFrame::TIMER_CNTVCT_LO
static const Addr TIMER_CNTVCT_LO
Definition: generic_timer.hh:445
ArchTimer::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: generic_timer.cc:393
GenericTimer::CoreTimers::physNS
ArchTimerKvm physNS
Definition: generic_timer.hh:319
ArchTimer::_interrupt
ArmInterruptPin *const _interrupt
Definition: generic_timer.hh:186
ArchTimer::scheduleEvents
virtual bool scheduleEvents()
Definition: generic_timer.hh:205
GenericTimer::CoreTimers::virtEvStream
EventStream virtEvStream
Definition: generic_timer.hh:345
GenericTimerMem::EndBitUnion
EndBitUnion(CNTCR) BitUnion32(CNTSR) Bitfield< 31
ArchTimer::setControl
void setControl(uint32_t val)
Definition: generic_timer.cc:315
std
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:587
GenericTimer::GenericTimer
GenericTimer(GenericTimerParams *const p)
Definition: generic_timer.cc:398
X86ISA::vector
Bitfield< 15, 8 > vector
Definition: intmessage.hh:44
GenericTimerFrame::nonSecureAccess
bool nonSecureAccess
Reports whether non-secure accesses are allowed to this frame.
Definition: generic_timer.hh:491
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
GenericTimerFrame::rwvt
Bitfield< 4 > rwvt
Definition: generic_timer.hh:473
GenericTimer::CoreTimers::cntfrq
uint32_t cntfrq
System counter frequency as visible from this core.
Definition: generic_timer.hh:302
X86ISA::enable
Bitfield< 11 > enable
Definition: misc.hh:1051
GenericTimerFrame::TIMER_CNTVOFF_LO
static const Addr TIMER_CNTVOFF_LO
Definition: generic_timer.hh:449
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
GenericTimerMem::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: generic_timer.cc:1297
GenericTimer::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: generic_timer.cc:416
ArmInterruptPin
Generic representation of an Arm interrupt pin.
Definition: base_gic.hh:176
addr
ip6_addr_t addr
Definition: inet.hh:423
GenericTimerISA::GenericTimerISA
GenericTimerISA(GenericTimer &_parent, unsigned _cpu)
Definition: generic_timer.hh:381
GenericTimerFrame::hasNonSecureAccess
bool hasNonSecureAccess() const
Indicates if non-secure accesses are allowed to this frame.
Definition: generic_timer.cc:955
GenericTimerISA::setMiscReg
void setMiscReg(int misc_reg, RegVal val) override
Write to a system register belonging to this device.
Definition: generic_timer.cc:862
SystemCounter::_value
uint64_t _value
Counter value (as specified in CNTCV).
Definition: generic_timer.hh:83
GenericTimerFrame::vcten
Bitfield< 1 > vcten
Definition: generic_timer.hh:485
SystemCounter::period
Tick period() const
Returns the counter period.
Definition: generic_timer.hh:122
GenericTimer::CoreTimers::threadContext
ThreadContext * threadContext
Thread (HW) context associated to this PE implementation.
Definition: generic_timer.hh:311
SystemCounterListener::notify
virtual void notify(void)=0
Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled p...
GenericTimer::CoreTimers::EventStream::transitionTo
uint8_t transitionTo
Definition: generic_timer.hh:329
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
GenericTimerMem::TIMER_CTRL_CNTTIDR
static const Addr TIMER_CTRL_CNTTIDR
Definition: generic_timer.hh:558
GenericTimer::CoreTimers
Definition: generic_timer.hh:291
GenericTimer::CoreTimers::CoreTimers
CoreTimers(GenericTimer &_parent, ArmSystem &system, unsigned cpu, ArmInterruptPin *_irqPhysS, ArmInterruptPin *_irqPhysNS, ArmInterruptPin *_irqVirt, ArmInterruptPin *_irqHyp)
Definition: generic_timer.cc:725
ArmISA::c
Bitfield< 29 > c
Definition: miscregs_types.hh:50
ArchTimer::_offset
uint64_t _offset
Offset relative to the physical timer (CNTVOFF)
Definition: generic_timer.hh:193
GenericTimerMem::fcreq
fcreq
Definition: generic_timer.hh:522
GenericTimerMem::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: generic_timer.cc:1324
SystemCounter::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: generic_timer.cc:206
GenericTimerMem
Definition: generic_timer.hh:496
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< AddrRange >
GenericTimerMem::BitUnion32
BitUnion32(CNTCR) Bitfield< 17
GenericTimerMem::fcack
fcack
Definition: generic_timer.hh:529
GenericTimer::CoreTimers::virt
ArchTimerKvm virt
Definition: generic_timer.hh:320
ArchTimer::_counterLimitReachedEvent
EventFunctionWrapper _counterLimitReachedEvent
Definition: generic_timer.hh:203
GenericTimer::systemCounter
SystemCounter & systemCounter
System counter reference.
Definition: generic_timer.hh:365
GenericTimerFrame::getVirtOffset
uint64_t getVirtOffset() const
Returns the virtual offset for this frame if a virtual timer is implemented.
Definition: generic_timer.cc:925
CheckpointIn
Definition: serialize.hh:67
GenericTimerMem::TIMER_CTRL_CNTACR
static const Addr TIMER_CTRL_CNTACR
Definition: generic_timer.hh:559
ArchTimer::offset
uint64_t offset() const
Definition: generic_timer.hh:230
GenericTimerFrame::pcten
Bitfield< 0 > pcten
Definition: generic_timer.hh:486
GenericTimerFrame::setNonSecureAccess
void setNonSecureAccess()
Allows non-secure accesses after an enabling write to CNTCTLBase.CNTNSAR.
Definition: generic_timer.cc:961
ArchTimer::_counterLimit
uint64_t _counterLimit
Programmed limit value for the upcounter ({CNTP/CNTHP/CNTV}_CVAL).
Definition: generic_timer.hh:191
GenericTimer::CoreTimers::virtEventStreamCallback
void virtEventStreamCallback()
Definition: generic_timer.cc:769
GenericTimer::createTimers
void createTimers(unsigned cpus)
Definition: generic_timer.cc:467
GenericTimerFrame::GenericTimerFrame
GenericTimerFrame(GenericTimerFrameParams *const p)
Definition: generic_timer.cc:876
EndBitUnion
EndBitUnion(UserDescFlags) struct UserDesc32
Definition: process.cc:149
ArchTimer::whenValue
Tick whenValue(uint64_t target_val)
Definition: generic_timer.hh:235
GenericTimerMem::TIMER_CTRL_CNTVOFF_HI
static const Addr TIMER_CTRL_CNTVOFF_HI
Definition: generic_timer.hh:561
GenericTimer::setMiscReg
void setMiscReg(int misc_reg, unsigned cpu, RegVal val)
Definition: generic_timer.cc:514
GenericTimerFrame::setAccessBits
void setAccessBits(uint8_t data)
Updates the access bits after a write to CNTCTLBase.CNTACR.
Definition: generic_timer.cc:949
RegVal
uint64_t RegVal
Definition: types.hh:168
GenericTimerMem::timerCtrlRead
uint64_t timerCtrlRead(Addr addr, size_t size, bool is_sec) const
CNTCTLBase (Memory-mapped timer global control frame)
Definition: generic_timer.cc:1489
GenericTimerFrame::TIMER_CNTV_CTL
static const Addr TIMER_CNTV_CTL
Definition: generic_timer.hh:458
GenericTimerMem::TIMER_CTRL_CNTFRQ
static const Addr TIMER_CTRL_CNTFRQ
Definition: generic_timer.hh:556
SystemCounter::freqUpdateSchedule
void freqUpdateSchedule(size_t new_freq_entry)
Schedules a counter frequency update after a CNTCR.FCREQ == 1 This complies with frequency transition...
Definition: generic_timer.cc:161
GenericTimerFrame::rpct
Bitfield< 0 > rpct
Definition: generic_timer.hh:477
SystemCounter::freqTable
std::vector< uint32_t > & freqTable()
Returns a reference to the frequency modes table.
Definition: generic_timer.hh:118
GenericTimerFrame::TIMER_CNTV_CVAL_LO
static const Addr TIMER_CNTV_CVAL_LO
Definition: generic_timer.hh:455
GenericTimerFrame::rvct
Bitfield< 1 > rvct
Definition: generic_timer.hh:476
GenericTimerMem::addrRanges
const AddrRangeList addrRanges
All MMIO ranges GenericTimerMem responds to.
Definition: generic_timer.hh:564
GenericTimer::timers
std::vector< std::unique_ptr< CoreTimers > > timers
Per-CPU physical architected timers.
Definition: generic_timer.hh:368
GenericTimerMem::systemCounter
SystemCounter & systemCounter
System counter reference.
Definition: generic_timer.hh:567
bits
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:75
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92
GenericTimerFrame::TIMER_CNTPCT_HI
static const Addr TIMER_CNTPCT_HI
Definition: generic_timer.hh:444
GenericTimerMem::COUNTER_CTRL_CNTFID
static const Addr COUNTER_CTRL_CNTFID
Definition: generic_timer.hh:538

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