gem5  v22.1.0.0
generic_timer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, 2015, 2017-2018,2020,2022 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 <cstdint>
42 #include <vector>
43 
44 #include "arch/arm/isa_device.hh"
45 #include "arch/arm/system.hh"
46 #include "base/addr_range.hh"
47 #include "base/bitunion.hh"
48 #include "base/types.hh"
49 #include "dev/arm/base_gic.hh"
51 #include "sim/drain.hh"
52 #include "sim/eventq.hh"
53 #include "sim/serialize.hh"
54 #include "sim/sim_object.hh"
55 
64 
65 namespace gem5
66 {
67 
68 class Checkpoint;
69 struct SystemCounterParams;
70 struct GenericTimerParams;
71 struct GenericTimerFrameParams;
72 struct GenericTimerMemParams;
73 
77 {
78  public:
81  virtual void notify(void) = 0;
82 };
83 
86 class SystemCounter : public SimObject
87 {
88  protected:
90  bool _enabled;
92  uint32_t _freq;
94  uint64_t _value;
96  uint64_t _increment;
106 
109 
111  static constexpr size_t MAX_FREQ_ENTRIES = 1004;
112 
113  public:
114  SystemCounter(const SystemCounterParams &p);
115 
118  static void validateCounterRef(SystemCounter *sys_cnt);
119 
121  bool enabled() const { return _enabled; }
123  uint32_t freq() const { return _freq; }
125  uint64_t value();
127  uint64_t increment() const { return _increment; }
131  size_t activeFreqEntry() const { return _activeFreqEntry; }
133  Tick period() const { return _period; }
134 
136  void enable();
138  void disable();
139 
143  void freqUpdateSchedule(size_t new_freq_entry);
144 
146  void setValue(uint64_t new_value);
147 
149  void registerListener(SystemCounterListener *listener);
150 
152  Tick whenValue(uint64_t target_val);
153  Tick whenValue(uint64_t cur_val, uint64_t target_val) const;
154 
155  void serialize(CheckpointOut &cp) const override;
156  void unserialize(CheckpointIn &cp) override;
157 
158  private:
159  // Disable copying
161 
166  void freqUpdateCallback();
167 
169  void updateValue(void);
170 
172  void updateTick(void);
173 
175  void notifyListeners(void) const;
176 };
177 
180  public Serializable
181 {
182  protected:
184  BitUnion32(ArchTimerCtrl)
185  Bitfield<0> enable;
186  Bitfield<1> imask;
187  Bitfield<2> istatus;
188  EndBitUnion(ArchTimerCtrl)
189 
190 
191  const std::string _name;
192 
195 
197 
199 
201  ArchTimerCtrl _control;
203  uint64_t _counterLimit;
205  uint64_t _offset;
206 
211  void updateCounter();
212 
214  void counterLimitReached();
216 
217  virtual bool scheduleEvents() { return true; }
218 
219  public:
220  ArchTimer(const std::string &name,
221  SimObject &parent,
222  SystemCounter &sysctr,
223  ArmInterruptPin *interrupt);
224 
226  std::string name() const { return _name; }
227 
229  uint64_t compareValue() const { return _counterLimit; }
231  void setCompareValue(uint64_t val);
232 
234  uint32_t timerValue() const { return _counterLimit - value(); }
236  void setTimerValue(uint32_t val);
237 
239  uint32_t control() const { return _control; }
240  void setControl(uint32_t val);
241 
242  uint64_t offset() const { return _offset; }
243  void setOffset(uint64_t val);
244 
246  uint64_t value() const;
247  Tick whenValue(uint64_t target_val) {
248  return _systemCounter.whenValue(value(), target_val);
249  }
250 
251  void notify(void) override;
252 
253  // Serializable
254  void serialize(CheckpointOut &cp) const override;
255  void unserialize(CheckpointIn &cp) override;
256 
257  // Drainable
258  DrainState drain() override;
259  void drainResume() override;
260 
261  private:
262  // Disable copying
264 };
265 
266 class ArchTimerKvm : public ArchTimer
267 {
268  private:
270 
271  public:
272  ArchTimerKvm(const std::string &name,
273  ArmSystem &system,
274  SimObject &parent,
275  SystemCounter &sysctr,
276  ArmInterruptPin *interrupt)
277  : ArchTimer(name, parent, sysctr, interrupt), system(system) {}
278 
279  protected:
280  // For ArchTimer's in a GenericTimerISA with Kvm execution about
281  // to begin, skip rescheduling the event.
282  // Otherwise, we should reschedule the event (if necessary).
283  bool scheduleEvents() override;
284 };
285 
286 class GenericTimer : public SimObject
287 {
288  public:
290 
291  GenericTimer(const Params &p);
292 
293  void serialize(CheckpointOut &cp) const override;
294  void unserialize(CheckpointIn &cp) override;
295 
296  public:
297  void setMiscReg(int misc_reg, unsigned cpu, RegVal val);
298  RegVal readMiscReg(int misc_reg, unsigned cpu);
299 
300  protected:
302  {
303  public:
304  CoreTimers(GenericTimer &_parent, ArmSystem &system, unsigned cpu,
305  ArmInterruptPin *irq_el3_phys,
306  ArmInterruptPin *irq_el1_phys,
307  ArmInterruptPin *irq_el1_virt,
308  ArmInterruptPin *irq_el2_ns_phys,
309  ArmInterruptPin *irq_el2_ns_virt,
310  ArmInterruptPin *irq_el2_s_phys,
311  ArmInterruptPin *irq_el2_s_virt);
312 
315 
317  uint32_t cntfrq;
318 
320  ArmISA::CNTKCTL cntkctl;
321 
323  ArmISA::CNTHCTL cnthctl;
324 
327 
335 
343 
344  // Event Stream. Events are generated based on a configurable
345  // transitionBit over the counter value. transitionTo indicates
346  // the transition direction (0->1 or 1->0)
347  struct EventStream
348  {
350  uint8_t transitionTo;
351  uint8_t transitionBit;
352 
353  uint64_t
354  eventTargetValue(uint64_t val) const
355  {
356  uint64_t bit_val = bits(val, transitionBit);
357  uint64_t ret_val = mbits(val, 63, transitionBit);
358  uint64_t incr_val = 1 << transitionBit;
359  if (bit_val == transitionTo)
360  incr_val *= 2;
361  return ret_val + incr_val;
362  }
363  };
364 
369  void eventStreamCallback() const;
370  void schedNextEvent(EventStream &ev_stream, ArchTimer &timer);
371 
372  void notify(void) override;
373 
374  void serialize(CheckpointOut &cp) const override;
375  void unserialize(CheckpointIn &cp) override;
376 
377  private:
378  // Disable copying
380  };
381 
382  CoreTimers &getTimers(int cpu_id);
383  void createTimers(unsigned cpus);
384 
387 
390 
391  protected: // Configuration
394 
395  void handleStream(CoreTimers::EventStream *ev_stream,
396  ArchTimer *timer, RegVal old_cnt_ctl, RegVal cnt_ctl);
397 };
398 
400 {
401  public:
402  GenericTimerISA(GenericTimer &_parent, unsigned _cpu)
403  : parent(_parent), cpu(_cpu) {}
404 
405  void setMiscReg(int misc_reg, RegVal val) override;
406  RegVal readMiscReg(int misc_reg) override;
407 
408  protected:
410  unsigned cpu;
411 };
412 
414 {
415  public:
416  GenericTimerFrame(const GenericTimerFrameParams &p);
417 
418  void serialize(CheckpointOut &cp) const override;
419  void unserialize(CheckpointIn &cp) override;
420 
422  bool hasVirtualTimer() const;
423 
426  uint64_t getVirtOffset() const;
427 
430  void setVirtOffset(uint64_t new_offset);
431 
433  bool hasEl0View() const;
434 
436  uint8_t getAccessBits() const;
437 
439  void setAccessBits(uint8_t data);
440 
442  bool hasNonSecureAccess() const;
443 
446  void setNonSecureAccess();
447 
449  bool hasReadableVoff() const;
450 
451  protected:
452  AddrRangeList getAddrRanges() const override;
453  Tick read(PacketPtr pkt) override;
454  Tick write(PacketPtr pkt) override;
455 
456  private:
458  uint64_t timerRead(Addr addr, size_t size, bool is_sec, bool to_el0) const;
459  void timerWrite(Addr addr, size_t size, uint64_t data, bool is_sec,
460  bool to_el0);
463 
464  static const Addr TIMER_CNTPCT_LO = 0x00;
465  static const Addr TIMER_CNTPCT_HI = 0x04;
466  static const Addr TIMER_CNTVCT_LO = 0x08;
467  static const Addr TIMER_CNTVCT_HI = 0x0c;
468  static const Addr TIMER_CNTFRQ = 0x10;
469  static const Addr TIMER_CNTEL0ACR = 0x14;
470  static const Addr TIMER_CNTVOFF_LO = 0x18;
471  static const Addr TIMER_CNTVOFF_HI = 0x1c;
472  static const Addr TIMER_CNTP_CVAL_LO = 0x20;
473  static const Addr TIMER_CNTP_CVAL_HI = 0x24;
474  static const Addr TIMER_CNTP_TVAL = 0x28;
475  static const Addr TIMER_CNTP_CTL = 0x2c;
476  static const Addr TIMER_CNTV_CVAL_LO = 0x30;
477  static const Addr TIMER_CNTV_CVAL_HI = 0x34;
478  static const Addr TIMER_CNTV_TVAL = 0x38;
479  static const Addr TIMER_CNTV_CTL = 0x3c;
480 
483 
486 
490 
492  BitUnion8(AccessBits)
493  Bitfield<5> rwpt;
494  Bitfield<4> rwvt;
495  Bitfield<3> rvoff;
496  Bitfield<2> rfrq;
497  Bitfield<1> rvct;
498  Bitfield<0> rpct;
499  EndBitUnion(AccessBits)
500  AccessBits accessBits;
501 
502  // Reports access properties of the CNTEL0Base register frame elements
503  BitUnion16(AccessBitsEl0)
504  Bitfield<9> pten;
505  Bitfield<8> vten;
506  Bitfield<1> vcten;
507  Bitfield<0> pcten;
508  EndBitUnion(AccessBitsEl0)
509  AccessBitsEl0 accessBitsEl0;
510 
513 
515 };
516 
518 {
519  public:
520  GenericTimerMem(const GenericTimerMemParams &p);
521 
524  static void validateFrameRange(const AddrRange &range);
525 
529  static bool validateAccessPerm(ArmSystem &sys, bool is_sec);
530 
531  protected:
532  AddrRangeList getAddrRanges() const override;
533  Tick read(PacketPtr pkt) override;
534  Tick write(PacketPtr pkt) override;
535 
536  private:
538  uint64_t counterCtrlRead(Addr addr, size_t size, bool is_sec) const;
539  void counterCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec);
541 
542  BitUnion32(CNTCR)
543  Bitfield<17,8> fcreq;
544  Bitfield<2> scen;
545  Bitfield<1> hdbg;
546  Bitfield<0> en;
547  EndBitUnion(CNTCR)
548 
549  BitUnion32(CNTSR)
550  Bitfield<31,8> fcack;
551  EndBitUnion(CNTSR)
552 
553  static const Addr COUNTER_CTRL_CNTCR = 0x00;
554  static const Addr COUNTER_CTRL_CNTSR = 0x04;
555  static const Addr COUNTER_CTRL_CNTCV_LO = 0x08;
556  static const Addr COUNTER_CTRL_CNTCV_HI = 0x0c;
557  static const Addr COUNTER_CTRL_CNTSCR = 0x10;
558  static const Addr COUNTER_CTRL_CNTID = 0x1c;
559  static const Addr COUNTER_CTRL_CNTFID = 0x20;
560 
562  uint64_t counterStatusRead(Addr addr, size_t size) const;
563  void counterStatusWrite(Addr addr, size_t size, uint64_t data);
565 
566  static const Addr COUNTER_STATUS_CNTCV_LO = 0x00;
567  static const Addr COUNTER_STATUS_CNTCV_HI = 0x04;
568 
570  uint64_t timerCtrlRead(Addr addr, size_t size, bool is_sec) const;
571  void timerCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec);
573 
575  uint32_t cnttidr;
576 
577  static const Addr TIMER_CTRL_CNTFRQ = 0x00;
578  static const Addr TIMER_CTRL_CNTNSAR = 0x04;
579  static const Addr TIMER_CTRL_CNTTIDR = 0x08;
580  static const Addr TIMER_CTRL_CNTACR = 0x40;
581  static const Addr TIMER_CTRL_CNTVOFF_LO = 0x80;
582  static const Addr TIMER_CTRL_CNTVOFF_HI = 0x84;
583 
586 
589 
591  static constexpr size_t MAX_TIMER_FRAMES = 8;
592 
595 
597 };
598 
599 } // namespace gem5
600 
601 #endif // __DEV_ARM_GENERIC_TIMER_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Base class for ARM GIC implementations.
const char data[]
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:82
ArchTimerKvm(const std::string &name, ArmSystem &system, SimObject &parent, SystemCounter &sysctr, ArmInterruptPin *interrupt)
bool scheduleEvents() override
Per-CPU architected timer.
EventFunctionWrapper _counterLimitReachedEvent
void setTimerValue(uint32_t val)
Sets the TimerValue view of the timer.
uint32_t timerValue() const
Returns the TimerValue view of the timer.
Bitfield< 1 > imask
virtual bool scheduleEvents()
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
EndBitUnion(ArchTimerCtrl) const std SimObject & _parent
Name of this timer.
std::string name() const
Returns the timer name.
void drainResume() override
Resume execution after a successful drain.
uint64_t compareValue() const
Returns the CompareValue view of the timer.
Bitfield< 2 > istatus
uint64_t _offset
Offset relative to the physical timer (CNTVOFF)
void notify(void) override
Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled p...
void setCompareValue(uint64_t val)
Sets the CompareValue view of the timer.
ArchTimer(const std::string &name, SimObject &parent, SystemCounter &sysctr, ArmInterruptPin *interrupt)
ArchTimerCtrl _control
Value of the control register ({CNTP/CNTHP/CNTV}_CTL).
void setOffset(uint64_t val)
void serialize(CheckpointOut &cp) const override
Serialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint64_t value() const
Returns the value of the counter which this timer relies on.
void setControl(uint32_t val)
uint32_t control() const
Sets the control register.
void updateCounter()
Timer settings or the offset has changed, re-evaluate trigger condition and raise interrupt if necess...
ArchTimer(const ArchTimer &t)
BitUnion32(ArchTimerCtrl) Bitfield< 0 > enable
Control register.
SystemCounter & _systemCounter
void counterLimitReached()
Called when the upcounter reaches the programmed value.
uint64_t offset() const
ArmInterruptPin *const _interrupt
uint64_t _counterLimit
Programmed limit value for the upcounter ({CNTP/CNTHP/CNTV}_CVAL).
Tick whenValue(uint64_t target_val)
Base class for devices that use the MiscReg interfaces.
Definition: isa_device.hh:62
Generic representation of an Arm interrupt pin.
Definition: base_gic.hh:200
Interface for objects that might require draining before checkpointing.
Definition: drain.hh:235
GenericTimerFrame(const GenericTimerFrameParams &p)
static const Addr TIMER_CNTP_CTL
void serialize(CheckpointOut &cp) const override
Serialize an object.
static const Addr TIMER_CNTV_TVAL
bool nonSecureAccess
Reports whether non-secure accesses are allowed to this frame.
bool hasVirtualTimer() const
Indicates if this frame implements a virtual timer.
uint64_t timerRead(Addr addr, size_t size, bool is_sec, bool to_el0) const
CNTBase/CNTEL0Base (Memory-mapped timer frame)
bool hasEl0View() const
Indicates if this frame implements a second EL0 view.
static const Addr TIMER_CNTP_CVAL_HI
void unserialize(CheckpointIn &cp) override
Unserialize an object.
BitUnion8(AccessBits) Bitfield< 5 > rwpt
Reports access properties of the CNTBase register frame elements.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
static const Addr TIMER_CNTV_CVAL_LO
static const Addr TIMER_CNTVCT_LO
uint8_t getAccessBits() const
Returns the access bits for this frame.
static const Addr TIMER_CNTFRQ
SystemCounter & systemCounter
System counter reference.
bool hasNonSecureAccess() const
Indicates if non-secure accesses are allowed to this frame.
ArchTimer physTimer
Physical and virtual timers.
BitUnion16(AccessBitsEl0) Bitfield< 9 > pten
static const Addr TIMER_CNTP_CVAL_LO
void setAccessBits(uint8_t data)
Updates the access bits after a write to CNTCTLBase.CNTACR.
static const Addr TIMER_CNTV_CVAL_HI
void setVirtOffset(uint64_t new_offset)
Sets the virtual offset for this frame's virtual timer after a write to CNTVOFF.
const AddrRange timerRange
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
static const Addr TIMER_CNTP_TVAL
static const Addr TIMER_CNTVOFF_HI
static const Addr TIMER_CNTVCT_HI
AddrRangeList addrRanges
All MMIO ranges GenericTimerFrame responds to.
bool hasReadableVoff() const
Indicates if CNTVOFF is readable for this frame.
static const Addr TIMER_CNTPCT_LO
static const Addr TIMER_CNTVOFF_LO
static const Addr TIMER_CNTPCT_HI
EndBitUnion(AccessBits) AccessBits accessBits
uint64_t getVirtOffset() const
Returns the virtual offset for this frame if a virtual timer is implemented.
static const Addr TIMER_CNTEL0ACR
EndBitUnion(AccessBitsEl0) AccessBitsEl0 accessBitsEl0
void setNonSecureAccess()
Allows non-secure accesses after an enabling write to CNTCTLBase.CNTNSAR.
static const Addr TIMER_CNTV_CTL
void timerWrite(Addr addr, size_t size, uint64_t data, bool is_sec, bool to_el0)
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
RegVal readMiscReg(int misc_reg) override
Read a system register belonging to this device.
GenericTimer & parent
GenericTimerISA(GenericTimer &_parent, unsigned _cpu)
void setMiscReg(int misc_reg, RegVal val) override
Write to a system register belonging to this device.
void counterCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec)
static const Addr COUNTER_CTRL_CNTID
BitUnion32(CNTCR) Bitfield< 17
uint64_t counterCtrlRead(Addr addr, size_t size, bool is_sec) const
CNTControlBase (System counter control frame)
const AddrRange timerCtrlRange
static const Addr TIMER_CTRL_CNTTIDR
static const Addr COUNTER_CTRL_CNTCV_HI
static const Addr COUNTER_CTRL_CNTFID
EndBitUnion(CNTCR) BitUnion32(CNTSR) Bitfield< 31
GenericTimerMem(const GenericTimerMemParams &p)
static const Addr COUNTER_CTRL_CNTCV_LO
void counterStatusWrite(Addr addr, size_t size, uint64_t data)
std::vector< GenericTimerFrame * > frames
Timer frame references.
static const Addr TIMER_CTRL_CNTFRQ
static const Addr COUNTER_STATUS_CNTCV_HI
static const Addr COUNTER_CTRL_CNTSCR
const AddrRange counterStatusRange
static const Addr TIMER_CTRL_CNTACR
uint64_t timerCtrlRead(Addr addr, size_t size, bool is_sec) const
CNTCTLBase (Memory-mapped timer global control frame)
const AddrRange counterCtrlRange
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
static const Addr TIMER_CTRL_CNTVOFF_LO
static void validateFrameRange(const AddrRange &range)
Validates a Generic Timer register frame address range.
uint64_t counterStatusRead(Addr addr, size_t size) const
CNTReadBase (System counter status frame)
static const Addr COUNTER_STATUS_CNTCV_LO
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
void timerCtrlWrite(Addr addr, size_t size, uint64_t data, bool is_sec)
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
uint32_t cnttidr
ID register for reporting features of implemented timer frames.
static const Addr COUNTER_CTRL_CNTSR
SystemCounter & systemCounter
System counter reference.
const AddrRangeList addrRanges
All MMIO ranges GenericTimerMem responds to.
static constexpr size_t MAX_TIMER_FRAMES
Maximum architectural number of memory-mapped timer frames.
static const Addr TIMER_CTRL_CNTNSAR
static bool validateAccessPerm(ArmSystem &sys, bool is_sec)
Validates an MMIO access permissions.
static const Addr TIMER_CTRL_CNTVOFF_HI
ThreadContext * threadContext
Thread (HW) context associated to this PE implementation.
ArmInterruptPin const * irqPhysNsEL2
GenericTimer & parent
Generic Timer parent reference.
ArmInterruptPin const * irqVirtSEL2
void notify(void) override
Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled p...
void serialize(CheckpointOut &cp) const override
Serialize an object.
void schedNextEvent(EventStream &ev_stream, ArchTimer &timer)
ArmInterruptPin const * irqVirtEL1
uint32_t cntfrq
System counter frequency as visible from this core.
ArmInterruptPin const * irqPhysEL3
ArmInterruptPin const * irqPhysSEL2
CoreTimers(const CoreTimers &c)
ArmInterruptPin const * irqVirtNsEL2
void unserialize(CheckpointIn &cp) override
Unserialize an object.
CoreTimers(GenericTimer &_parent, ArmSystem &system, unsigned cpu, ArmInterruptPin *irq_el3_phys, ArmInterruptPin *irq_el1_phys, ArmInterruptPin *irq_el1_virt, ArmInterruptPin *irq_el2_ns_phys, ArmInterruptPin *irq_el2_ns_virt, ArmInterruptPin *irq_el2_s_phys, ArmInterruptPin *irq_el2_s_virt)
ArmInterruptPin const * irqPhysEL1
ArmISA::CNTHCTL cnthctl
Hypervisor control register.
ArmISA::CNTKCTL cntkctl
Kernel control register.
std::vector< std::unique_ptr< CoreTimers > > timers
Per-CPU physical architected timers.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void setMiscReg(int misc_reg, unsigned cpu, RegVal val)
CoreTimers & getTimers(int cpu_id)
RegVal readMiscReg(int misc_reg, unsigned cpu)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void createTimers(unsigned cpus)
PARAMS(GenericTimer)
SystemCounter & systemCounter
System counter reference.
void handleStream(CoreTimers::EventStream *ev_stream, ArchTimer *timer, RegVal old_cnt_ctl, RegVal cnt_ctl)
ArmSystem & system
ARM system containing this timer.
GenericTimer(const Params &p)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
This device is the base class which all devices senstive to an address range inherit from.
Definition: io_device.hh:103
System * sys
Definition: io_device.hh:105
Basic support for object serialization.
Definition: serialize.hh:170
Abstract superclass for simulation objects.
Definition: sim_object.hh:148
SimObjectParams Params
Definition: sim_object.hh:170
Abstract class for elements whose events depend on the counting speed of the System Counter.
virtual void notify(void)=0
Called from the SystemCounter when a change in counting speed occurred Events should be rescheduled p...
Global system counter.
void updateValue(void)
Updates the counter value.
uint32_t _freq
Counter frequency (as specified by CNTFRQ).
std::vector< uint32_t > _freqTable
Frequency modes table with all possible frequencies for the counter.
bool enabled() const
Indicates if the counter is enabled.
std::vector< SystemCounterListener * > _listeners
Listeners to changes in counting speed.
void setValue(uint64_t new_value)
Sets the value explicitly from writes to CNTCR.CNTCV.
Tick _period
Cached copy of the counter period (inverse of the frequency).
std::vector< uint32_t > & freqTable()
Returns a reference to the frequency modes table.
Tick whenValue(uint64_t target_val)
Returns the tick at which a certain counter value is reached.
SystemCounter(const SystemCounterParams &p)
EventFunctionWrapper _freqUpdateEvent
Frequency update event handling.
size_t activeFreqEntry() const
Returns the currently active frequency table entry.
static constexpr size_t MAX_FREQ_ENTRIES
Maximum architectural number of frequency table entries.
static void validateCounterRef(SystemCounter *sys_cnt)
Validates a System Counter reference.
void updateTick(void)
Updates the update tick, normalizes to the lower cycle start tick.
uint64_t value()
Updates and returns the counter value.
Tick period() const
Returns the counter period.
void disable()
Disables the counter after a CNTCR.EN == 0.
void notifyListeners(void) const
Notifies counting speed changes to listeners.
SystemCounter(const SystemCounter &c)
void serialize(CheckpointOut &cp) const override
Serialize an object.
void enable()
Enables the counter after a CNTCR.EN == 1.
uint64_t _value
Counter value (as specified in CNTCV).
uint64_t increment() const
Returns the value increment.
uint32_t freq() const
Returns the counter frequency.
void freqUpdateCallback()
Callback for the frequency update.
Tick _updateTick
Counter cycle start Tick when the counter status affecting its value has been updated.
uint64_t _increment
Value increment in each counter cycle.
size_t _activeFreqEntry
Currently selected entry in the table, its contents should match _freq.
void registerListener(SystemCounterListener *listener)
Called from System Counter Listeners to register.
void freqUpdateSchedule(size_t new_freq_entry)
Schedules a counter frequency update after a CNTCR.FCREQ == 1 This complies with frequency transition...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool _enabled
Indicates if the counter is enabled.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:76
constexpr T mbits(T val, unsigned first, unsigned last)
Mask off the given bits in place like bits() but without shifting.
Definition: bitfield.hh:103
DrainState
Object drain/handover states.
Definition: drain.hh:75
Bitfield< 2 > c
Definition: pagetable.hh:63
Bitfield< 51 > t
Definition: pagetable.hh:56
Bitfield< 54 > p
Definition: pagetable.hh:70
Bitfield< 11 > enable
Definition: misc.hh:1058
Bitfield< 63 > val
Definition: misc.hh:776
Bitfield< 3 > addr
Definition: types.hh:84
Bitfield< 15, 8 > vector
Definition: intmessage.hh:48
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::ostream CheckpointOut
Definition: serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t Tick
Tick count type.
Definition: types.hh:58
uint64_t RegVal
Definition: types.hh:173
Overload hash function for BasicBlockRange type.
Definition: misc.hh:2826
EndBitUnion(PciCommandRegister) union PCIConfig
Definition: pcireg.h:65
uint64_t eventTargetValue(uint64_t val) const

Generated on Wed Dec 21 2022 10:22:32 for gem5 by doxygen 1.9.1