gem5  v21.1.0.2
base.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 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 __CPU_KVM_BASE_HH__
39 #define __CPU_KVM_BASE_HH__
40 
41 #include <pthread.h>
42 
43 #include <csignal>
44 #include <memory>
45 #include <queue>
46 
47 #include "base/statistics.hh"
48 #include "cpu/kvm/perfevent.hh"
49 #include "cpu/kvm/timer.hh"
50 #include "cpu/kvm/vm.hh"
51 #include "cpu/base.hh"
52 #include "cpu/simple_thread.hh"
53 #include "sim/faults.hh"
54 
56 #define KVM_KICK_SIGNAL SIGRTMIN
57 
58 struct kvm_coalesced_mmio_ring;
59 struct kvm_fpu;
60 struct kvm_interrupt;
61 struct kvm_regs;
62 struct kvm_run;
63 struct kvm_sregs;
64 
65 namespace gem5
66 {
67 
68 // forward declarations
69 class ThreadContext;
70 struct BaseKvmCPUParams;
71 
87 class BaseKvmCPU : public BaseCPU
88 {
89  public:
90  BaseKvmCPU(const BaseKvmCPUParams &params);
91  virtual ~BaseKvmCPU();
92 
93  void init() override;
94  void startup() override;
95 
96  void serializeThread(CheckpointOut &cp, ThreadID tid) const override;
97  void unserializeThread(CheckpointIn &cp, ThreadID tid) override;
98 
99  DrainState drain() override;
100  void drainResume() override;
101  void notifyFork() override;
102 
103  void switchOut() override;
104  void takeOverFrom(BaseCPU *cpu) override;
105 
106  void verifyMemoryMode() const override;
107 
108  Port &getDataPort() override { return dataPort; }
109  Port &getInstPort() override { return instPort; }
110 
111  void wakeup(ThreadID tid = 0) override;
112  void activateContext(ThreadID thread_num) override;
113  void suspendContext(ThreadID thread_num) override;
114  void deallocateContext(ThreadID thread_num);
115  void haltContext(ThreadID thread_num) override;
116 
117  long getVCpuID() const { return vcpuID; }
118  ThreadContext *getContext(int tn) override;
119 
120  Counter totalInsts() const override;
121  Counter totalOps() const override;
122 
127  void finishMMIOPending();
128 
130  virtual void dump() const;
131 
138  void kick() const { pthread_kill(vcpuThread, KVM_KICK_SIGNAL); }
139 
154 
159 
161 
162  protected:
188  enum Status
189  {
237  };
238 
241 
246  void tick();
247 
261  virtual uint64_t getHostCycles() const;
262 
289  virtual Tick kvmRun(Tick ticks);
290 
302  virtual Tick kvmRunDrain();
303 
308  struct kvm_run *getKvmRunState() { return _kvmRun; };
309 
318  uint8_t *getGuestData(uint64_t offset) const {
319  return (uint8_t *)_kvmRun + offset;
320  };
321 
332 
343  void kvmInterrupt(const struct kvm_interrupt &interrupt);
344 
357  void getRegisters(struct kvm_regs &regs) const;
358  void setRegisters(const struct kvm_regs &regs);
359  void getSpecialRegisters(struct kvm_sregs &regs) const;
360  void setSpecialRegisters(const struct kvm_sregs &regs);
367  void getFPUState(struct kvm_fpu &state) const;
368  void setFPUState(const struct kvm_fpu &state);
377  void setOneReg(uint64_t id, const void *addr);
378  void setOneReg(uint64_t id, uint64_t value) { setOneReg(id, &value); }
379  void setOneReg(uint64_t id, uint32_t value) { setOneReg(id, &value); }
380  void getOneReg(uint64_t id, void *addr) const;
381  uint64_t getOneRegU64(uint64_t id) const {
382  uint64_t value;
383  getOneReg(id, &value);
384  return value;
385  }
386  uint32_t getOneRegU32(uint64_t id) const {
387  uint32_t value;
388  getOneReg(id, &value);
389  return value;
390  }
401  std::string getAndFormatOneReg(uint64_t id) const;
402 
412  virtual void updateKvmState() = 0;
413 
422  virtual void updateThreadContext() = 0;
423 
428  void syncThreadContext();
429 
439 
443  void syncKvmState();
453  virtual Tick handleKvmExit();
454 
460  virtual Tick handleKvmExitIO();
461 
467  virtual Tick handleKvmExitHypercall();
468 
479 
492  virtual Tick handleKvmExitUnknown();
493 
503  virtual Tick handleKvmExitException();
504 
513  virtual Tick handleKvmExitFailEntry();
532  virtual bool archIsDrained() const { return true; }
533 
543  Tick doMMIOAccess(Addr paddr, void *data, int size, bool write);
544 
558  void setSignalMask(const sigset_t *mask);
574  int ioctl(int request, long p1) const;
575  int ioctl(int request, void *p1) const {
576  return ioctl(request, (long)p1);
577  }
578  int ioctl(int request) const {
579  return ioctl(request, 0L);
580  }
584  virtual void ioctlRun();
585 
590  class KVMCpuPort : public RequestPort
591  {
592 
593  public:
594  KVMCpuPort(const std::string &_name, BaseKvmCPU *_cpu)
595  : RequestPort(_name, _cpu), cpu(_cpu), activeMMIOReqs(0)
596  { }
602  Tick submitIO(PacketPtr pkt);
603 
605  Status nextIOState() const;
606 
607  protected:
610 
612  std::queue<PacketPtr> pendingMMIOPkts;
613 
615  unsigned int activeMMIOReqs;
616 
617  bool recvTimingResp(PacketPtr pkt) override;
618 
619  void recvReqRetry() override;
620 
621  };
622 
625 
628 
633  const bool alwaysSyncTC;
634 
640 
646 
648  const long vcpuID;
649 
651  pthread_t vcpuThread;
652 
653  private:
662 
667  void setupSignalHandler();
668 
675  bool discardPendingSignal(int signum) const;
676 
689  void startupThread();
690 
692  bool tryDrain();
693 
695  int vcpuFD;
706  struct kvm_run *_kvmRun;
711  struct kvm_coalesced_mmio_ring *mmioRing;
713  const long pageSize;
714 
716 
727  void setupInstStop();
728 
731  void setupCounters();
732 
743  void setupInstCounter(uint64_t period = 0);
744 
747 
757 
770 
787  std::unique_ptr<BaseKvmTimer> runTimer;
788 
790  float hostFactor;
791 
792  public:
793  /* @{ */
794  struct StatGroup : public statistics::Group
795  {
796  StatGroup(statistics::Group *parent);
807  } stats;
808  /* @} */
809 
812 };
813 
814 } // namespace gem5
815 
816 #endif
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::BaseKvmCPU::stats
gem5::BaseKvmCPU::StatGroup stats
gem5::BaseKvmCPU::_status
Status _status
CPU run state.
Definition: base.hh:240
KVM_KICK_SIGNAL
#define KVM_KICK_SIGNAL
Signal to use to trigger exits from KVM.
Definition: base.hh:56
gem5::BaseKvmCPU::perfControlledByTimer
bool perfControlledByTimer
Does the runTimer control the performance counters?
Definition: base.hh:778
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::EventManager::eventQueue
EventQueue * eventQueue() const
Definition: eventq.hh:1010
gem5::X86ISA::L
Bitfield< 7, 0 > L
Definition: int.hh:59
gem5::BaseKvmCPU::StatGroup::StatGroup
StatGroup(statistics::Group *parent)
Definition: base.cc:264
gem5::BaseKvmCPU::ioctl
int ioctl(int request, long p1) const
vCPU ioctl interface.
Definition: base.cc:1150
gem5::BaseKvmCPU::~BaseKvmCPU
virtual ~BaseKvmCPU()
Definition: base.cc:101
gem5::BaseKvmCPU::ioctl
int ioctl(int request) const
Definition: base.hh:578
gem5::BaseKvmCPU::StatGroup::numVMHalfEntries
statistics::Scalar numVMHalfEntries
Definition: base.hh:799
gem5::BaseKvmCPU::RunningServiceCompletion
@ RunningServiceCompletion
Service completion in progress.
Definition: base.hh:236
gem5::BaseKvmCPU::ioctl
int ioctl(int request, void *p1) const
Definition: base.hh:575
gem5::BaseKvmCPU::deviceEventQueue
EventQueue * deviceEventQueue()
Get a pointer to the event queue owning devices.
Definition: base.hh:438
gem5::BaseKvmCPU::kvmInterrupt
void kvmInterrupt(const struct kvm_interrupt &interrupt)
Send a normal interrupt to the guest.
Definition: base.cc:799
gem5::BaseKvmCPU::syncThreadContext
void syncThreadContext()
Update a thread context if the KVM state is dirty with respect to the cached thread context.
Definition: base.cc:931
gem5::BaseKvmCPU::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: base.cc:384
gem5::PerfKvmCounter
An instance of a performance counter.
Definition: perfevent.hh:171
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::BaseKvmCPU::KVMCpuPort
KVM memory port.
Definition: base.hh:590
gem5::BaseKvmCPU::alwaysSyncTC
const bool alwaysSyncTC
Be conservative and always synchronize the thread context on KVM entry/exit.
Definition: base.hh:633
gem5::BaseKvmCPU::kick
void kick() const
Force an exit from KVM.
Definition: base.hh:138
gem5::BaseKvmCPU::getKvmRunState
struct kvm_run * getKvmRunState()
Get a pointer to the kvm_run structure containing all the input and output parameters from kvmRun().
Definition: base.hh:308
gem5::BaseKvmCPU::flushCoalescedMMIO
Tick flushCoalescedMMIO()
Service MMIO requests in the mmioRing.
Definition: base.cc:1159
gem5::BaseKvmCPU::setOneReg
void setOneReg(uint64_t id, uint64_t value)
Definition: base.hh:378
gem5::BaseKvmCPU::handleKvmExitFailEntry
virtual Tick handleKvmExitFailEntry()
KVM failed to start the virtualized CPU.
Definition: base.cc:1071
gem5::BaseKvmCPU::getAndFormatOneReg
std::string getAndFormatOneReg(uint64_t id) const
Get and format one register for printout.
Definition: base.cc:884
gem5::BaseKvmCPU::hostFactor
float hostFactor
Host factor as specified in the configuration.
Definition: base.hh:790
gem5::BaseKvmCPU::RunningService
@ RunningService
Requiring service at the beginning of the next cycle.
Definition: base.hh:219
gem5::BaseKvmCPU::suspendContext
void suspendContext(ThreadID thread_num) override
Notify the CPU that the indicated context is now suspended.
Definition: base.cc:512
gem5::BaseKvmCPU::deallocateContext
void deallocateContext(ThreadID thread_num)
Definition: base.cc:535
gem5::BaseKvmCPU::setupCounters
void setupCounters()
Setup hardware performance counters.
Definition: base.cc:1258
gem5::BaseKvmCPU::getOneReg
void getOneReg(uint64_t id, void *addr) const
Definition: base.cc:867
gem5::BaseKvmCPU::handleKvmExit
virtual Tick handleKvmExit()
Main kvmRun exit handler, calls the relevant handleKvmExit* depending on exit type.
Definition: base.cc:955
gem5::BaseKvmCPU::setFPUState
void setFPUState(const struct kvm_fpu &state)
Definition: base.cc:842
gem5::BaseKvmCPU::hwCycles
PerfKvmCounter hwCycles
Guest cycle counter.
Definition: base.hh:756
gem5::BaseKvmCPU::wakeup
void wakeup(ThreadID tid=0) override
Definition: base.cc:475
gem5::BaseKvmCPU::tryDrain
bool tryDrain()
Try to drain the CPU if a drain is pending.
Definition: base.cc:1289
gem5::BaseKvmCPU::RunningMMIOPending
@ RunningMMIOPending
Timing MMIO request in flight or stalled.
Definition: base.hh:227
faults.hh
gem5::BaseKvmCPU::KVMCpuPort::recvReqRetry
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: base.cc:209
gem5::BaseKvmCPU::doMMIOAccess
Tick doMMIOAccess(Addr paddr, void *data, int size, bool write)
Inject a memory mapped IO request into gem5.
Definition: base.cc:1079
gem5::SimpleThread
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
Definition: simple_thread.hh:94
gem5::BaseKvmCPU::serializeThread
void serializeThread(CheckpointOut &cp, ThreadID tid) const override
Serialize a single thread.
Definition: base.cc:289
gem5::BaseKvmCPU::getFPUState
void getFPUState(struct kvm_fpu &state) const
Get/Set the guest FPU/vector state.
Definition: base.cc:835
gem5::BaseKvmCPU::notifyFork
void notifyFork() override
Notify a child process of a fork.
Definition: base.cc:407
gem5::BaseKvmCPU::verifyMemoryMode
void verifyMemoryMode() const override
Verify that the system is in a memory mode supported by the CPU.
Definition: base.cc:466
gem5::BaseKvmCPU::StatGroup::committedInsts
statistics::Scalar committedInsts
Definition: base.hh:797
gem5::KvmVM
KVM VM container.
Definition: vm.hh:297
gem5::mask
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
gem5::BaseKvmCPU::kvmNonMaskableInterrupt
void kvmNonMaskableInterrupt()
Send a non-maskable interrupt to the guest.
Definition: base.cc:791
gem5::BaseKvmCPU::StatGroup::numInterrupts
statistics::Scalar numInterrupts
Definition: base.hh:805
gem5::RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:77
gem5::BaseKvmCPU::StatGroup::numVMExits
statistics::Scalar numVMExits
Definition: base.hh:798
gem5::BaseKvmCPU::getDataPort
Port & getDataPort() override
Purely virtual method that returns a reference to the data port.
Definition: base.hh:108
gem5::BaseKvmCPU::discardPendingSignal
bool discardPendingSignal(int signum) const
Discard a (potentially) pending signal.
Definition: base.cc:1230
gem5::BaseKvmCPU::handleKvmExitException
virtual Tick handleKvmExitException()
An unhandled virtualization exception occured.
Definition: base.cc:1062
gem5::BaseKvmCPU::vcpuThread
pthread_t vcpuThread
ID of the vCPU thread.
Definition: base.hh:651
gem5::BaseKvmCPU::thread
SimpleThread * thread
A cached copy of a thread's state in the form of a SimpleThread object.
Definition: base.hh:153
gem5::DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:74
gem5::BaseKvmCPU::vcpuFD
int vcpuFD
KVM vCPU file descriptor.
Definition: base.hh:695
gem5::BaseKvmCPU::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: base.cc:120
gem5::BaseKvmCPU::kvmStateDirty
bool kvmStateDirty
Is the KVM state dirty? Set to true to force an update of the KVM vCPU state upon the next call to kv...
Definition: base.hh:645
gem5::BaseKvmCPU::ioctlRun
virtual void ioctlRun()
Execute the KVM_RUN ioctl.
Definition: base.cc:1311
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:93
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::BaseKvmCPU::tickEvent
EventFunctionWrapper tickEvent
Definition: base.hh:715
gem5::BaseKvmCPU::KVMCpuPort::KVMCpuPort
KVMCpuPort(const std::string &_name, BaseKvmCPU *_cpu)
Definition: base.hh:594
gem5::BaseKvmCPU::KVMCpuPort::activeMMIOReqs
unsigned int activeMMIOReqs
Number of MMIO requests in flight.
Definition: base.hh:615
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::BaseKvmCPU::setupSignalHandler
void setupSignalHandler()
Setup a signal handler to catch the timer signal used to switch back to the monitor.
Definition: base.cc:1201
gem5::BaseKvmCPU
Base class for KVM based CPU models.
Definition: base.hh:87
gem5::BaseKvmCPU::tc
ThreadContext * tc
ThreadContext object, provides an interface for external objects to modify this thread's state.
Definition: base.hh:158
gem5::BaseKvmCPU::takeOverFrom
void takeOverFrom(BaseCPU *cpu) override
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be sw...
Definition: base.cc:444
statistics.hh
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::BaseKvmCPU::archIsDrained
virtual bool archIsDrained() const
Is the architecture specific code in a state that prevents draining?
Definition: base.hh:532
gem5::BaseKvmCPU::switchOut
void switchOut() override
Prepare for another CPU to take over execution.
Definition: base.cc:430
gem5::BaseKvmCPU::handleKvmExitUnknown
virtual Tick handleKvmExitUnknown()
An unknown architecture dependent error occurred when starting the vCPU.
Definition: base.cc:1054
gem5::BaseKvmCPU::tick
void tick()
Execute the CPU until the next event in the main event queue or until the guest needs service from ge...
Definition: base.cc:578
gem5::BaseKvmCPU::getOneRegU32
uint32_t getOneRegU32(uint64_t id) const
Definition: base.hh:386
gem5::BaseKvmCPU::StatGroup::numIO
statistics::Scalar numIO
Definition: base.hh:803
gem5::EventQueue
Queue of events sorted in time order.
Definition: eventq.hh:622
gem5::BaseKvmCPU::setOneReg
void setOneReg(uint64_t id, const void *addr)
Get/Set single register using the KVM_(SET|GET)_ONE_REG API.
Definition: base.cc:850
gem5::BaseKvmCPU::getSpecialRegisters
void getSpecialRegisters(struct kvm_sregs &regs) const
Definition: base.cc:821
gem5::BaseKvmCPU::KVMCpuPort::nextIOState
Status nextIOState() const
Returns next valid state after one or more IO accesses.
Definition: base.cc:167
gem5::BaseKvmCPU::getInstPort
Port & getInstPort() override
Purely virtual method that returns a reference to the instruction port.
Definition: base.hh:109
gem5::ArmISA::offset
Bitfield< 23, 0 > offset
Definition: types.hh:144
gem5::BaseCPU
Definition: base.hh:107
gem5::BaseKvmCPU::vm
KvmVM & vm
Definition: base.hh:160
gem5::BaseKvmCPU::unserializeThread
void unserializeThread(CheckpointIn &cp, ThreadID tid) override
Unserialize one thread.
Definition: base.cc:302
gem5::BaseKvmCPU::vcpuID
const long vcpuID
KVM internal ID of the vCPU.
Definition: base.hh:648
gem5::BaseKvmCPU::ctrInsts
Counter ctrInsts
Number of instructions executed by the CPU.
Definition: base.hh:811
gem5::BaseKvmCPU::KVMCpuPort::pendingMMIOPkts
std::queue< PacketPtr > pendingMMIOPkts
Pending MMIO packets.
Definition: base.hh:612
gem5::BaseKvmCPU::finishMMIOPending
void finishMMIOPending()
Callback from KvmCPUPort to transition the CPU out of RunningMMIOPending when all timing requests hav...
Definition: base.cc:225
gem5::BaseKvmCPU::getContext
ThreadContext * getContext(int tn) override
Given a thread num get tho thread context for it.
Definition: base.cc:550
gem5::BaseKvmCPU::KVMCpuPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
Definition: base.cc:192
gem5::BaseKvmCPU::handleKvmExitIO
virtual Tick handleKvmExitIO()
The guest performed a legacy IO request (out/inp on x86)
Definition: base.cc:1032
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::BaseKvmCPU::setSignalMask
void setSignalMask(const sigset_t *mask)
Set the signal mask used in kvmRun()
Definition: base.cc:1129
gem5::BaseKvmCPU::Idle
@ Idle
Context not scheduled in KVM.
Definition: base.hh:199
vm.hh
gem5::BaseKvmCPU::KVMCpuPort::cpu
BaseKvmCPU * cpu
KVM cpu pointer for finishMMIOPending() callback.
Definition: base.hh:609
gem5::BaseKvmCPU::setRegisters
void setRegisters(const struct kvm_regs &regs)
Definition: base.cc:814
gem5::BaseKvmCPU::Running
@ Running
Running normally.
Definition: base.hh:205
gem5::BaseKvmCPU::kvmRunDrain
virtual Tick kvmRunDrain()
Request the CPU to run until draining completes.
Definition: base.cc:674
gem5::BaseKvmCPU::updateThreadContext
virtual void updateThreadContext()=0
Update the current thread context with the KVM state.
gem5::BaseKvmCPU::getHostCycles
virtual uint64_t getHostCycles() const
Get the value of the hardware cycle counter in the guest.
Definition: base.cc:688
perfevent.hh
gem5::BaseKvmCPU::StatGroup
Definition: base.hh:794
gem5::BaseKvmCPU::setOneReg
void setOneReg(uint64_t id, uint32_t value)
Definition: base.hh:379
gem5::EventFunctionWrapper
Definition: eventq.hh:1115
gem5::BaseKvmCPU::StatGroup::numExitSignal
statistics::Scalar numExitSignal
Definition: base.hh:800
gem5::BaseKvmCPU::handleKvmExitHypercall
virtual Tick handleKvmExitHypercall()
The guest requested a monitor service using a hypercall.
Definition: base.cc:1040
simple_thread.hh
timer.hh
gem5::BaseKvmCPU::activateContext
void activateContext(ThreadID thread_num) override
Notify the CPU that the indicated context is now active.
Definition: base.cc:493
gem5::BaseKvmCPU::BaseKvmCPU
BaseKvmCPU(const BaseKvmCPUParams &params)
Definition: base.cc:65
base.hh
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::BaseKvmCPU::getOneRegU64
uint64_t getOneRegU64(uint64_t id) const
Definition: base.hh:381
gem5::BaseKvmCPU::startupThread
void startupThread()
Thread-specific initialization.
Definition: base.cc:235
gem5::BaseKvmCPU::vcpuMMapSize
int vcpuMMapSize
Size of MMAPed kvm_run area.
Definition: base.hh:697
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
gem5::BaseKvmCPU::totalInsts
Counter totalInsts() const override
Definition: base.cc:559
gem5::BaseKvmCPU::KVMCpuPort::submitIO
Tick submitIO(PacketPtr pkt)
Interface to send Atomic or Timing IO request.
Definition: base.cc:174
gem5::BaseKvmCPU::dump
virtual void dump() const
Dump the internal state to the terminal.
Definition: base.cc:572
gem5::BaseKvmCPU::StatGroup::numMMIO
statistics::Scalar numMMIO
Definition: base.hh:801
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::BaseKvmCPU::updateKvmState
virtual void updateKvmState()=0
Update the KVM state from the current thread context.
gem5::BaseKvmCPU::activeInstPeriod
uint64_t activeInstPeriod
Currently active instruction count breakpoint.
Definition: base.hh:746
gem5::BaseKvmCPU::_kvmRun
struct kvm_run * _kvmRun
Pointer to the kvm_run structure used to communicate parameters with KVM.
Definition: base.hh:706
gem5::BaseKvmCPU::mmioRing
struct kvm_coalesced_mmio_ring * mmioRing
Coalesced MMIO ring buffer.
Definition: base.hh:711
gem5::BaseKvmCPU::runTimer
std::unique_ptr< BaseKvmTimer > runTimer
Timer used to force execution into the monitor after a specified number of simulation tick equivalent...
Definition: base.hh:787
gem5::BaseKvmCPU::setupInstStop
void setupInstStop()
Setup an instruction break if there is one pending.
Definition: base.cc:1321
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::BaseKvmCPU::kvmRun
virtual Tick kvmRun(Tick ticks)
Request KVM to run the guest for a given number of ticks.
Definition: base.cc:694
gem5::BaseKvmCPU::threadContextDirty
bool threadContextDirty
Is the gem5 context dirty? Set to true to force an update of the KVM vCPU state upon the next call to...
Definition: base.hh:639
gem5::BaseKvmCPU::getVCpuID
long getVCpuID() const
Definition: base.hh:117
gem5::BaseKvmCPU::getRegisters
void getRegisters(struct kvm_regs &regs) const
Get/Set the register state of the guest vCPU.
Definition: base.cc:807
gem5::BaseKvmCPU::pageSize
const long pageSize
Cached page size of the host.
Definition: base.hh:713
gem5::BaseKvmCPU::StatGroup::numCoalescedMMIO
statistics::Scalar numCoalescedMMIO
Definition: base.hh:802
gem5::BaseKvmCPU::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: base.cc:109
gem5::BaseKvmCPU::handleKvmExitIRQWindowOpen
virtual Tick handleKvmExitIRQWindowOpen()
The guest exited because an interrupt window was requested.
Definition: base.cc:1046
gem5::BaseKvmCPU::haltContext
void haltContext(ThreadID thread_num) override
Notify the CPU that the indicated context is now halted.
Definition: base.cc:542
gem5::BaseKvmCPU::dataPort
KVMCpuPort dataPort
Port for data requests.
Definition: base.hh:624
gem5::BaseKvmCPU::getGuestData
uint8_t * getGuestData(uint64_t offset) const
Retrieve a pointer to guest data stored at the end of the kvm_run structure.
Definition: base.hh:318
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::BaseKvmCPU::StatGroup::numHalt
statistics::Scalar numHalt
Definition: base.hh:804
gem5::BaseKvmCPU::totalOps
Counter totalOps() const override
Definition: base.cc:565
gem5::BaseKvmCPU::StatGroup::numHypercalls
statistics::Scalar numHypercalls
Definition: base.hh:806
gem5::BaseKvmCPU::instPort
KVMCpuPort instPort
Unused dummy port for the instruction interface.
Definition: base.hh:627
gem5::BaseKvmCPU::setSpecialRegisters
void setSpecialRegisters(const struct kvm_sregs &regs)
Definition: base.cc:828
gem5::BaseKvmCPU::Status
Status
Definition: base.hh:188
gem5::BaseKvmCPU::setupInstCounter
void setupInstCounter(uint64_t period=0)
Setup the guest instruction counter.
Definition: base.cc:1333
gem5::BaseKvmCPU::hwInstructions
PerfKvmCounter hwInstructions
Guest instruction counter.
Definition: base.hh:769
gem5::Named::_name
const std::string _name
Definition: named.hh:41
gem5::BaseKvmCPU::syncKvmState
void syncKvmState()
Update the KVM if the thread context is dirty.
Definition: base.cc:943
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:242
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
gem5::BaseKvmCPU::drain
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: base.cc:313

Generated on Tue Sep 21 2021 12:24:57 for gem5 by doxygen 1.8.17