gem5  v21.1.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
base.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, 2015, 2017 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #include "cpu/kvm/base.hh"
39 
40 #include <linux/kvm.h>
41 #include <sys/ioctl.h>
42 #include <sys/mman.h>
43 #include <unistd.h>
44 
45 #include <cerrno>
46 #include <csignal>
47 #include <ostream>
48 
49 #include "base/compiler.hh"
50 #include "debug/Checkpoint.hh"
51 #include "debug/Drain.hh"
52 #include "debug/Kvm.hh"
53 #include "debug/KvmIO.hh"
54 #include "debug/KvmRun.hh"
55 #include "params/BaseKvmCPU.hh"
56 #include "sim/process.hh"
57 #include "sim/system.hh"
58 
59 /* Used by some KVM macros */
60 #define PAGE_SIZE pageSize
61 
62 namespace gem5
63 {
64 
65 BaseKvmCPU::BaseKvmCPU(const BaseKvmCPUParams &params)
66  : BaseCPU(params),
67  vm(*params.system->getKvmVM()),
68  _status(Idle),
69  dataPort(name() + ".dcache_port", this),
70  instPort(name() + ".icache_port", this),
71  alwaysSyncTC(params.alwaysSyncTC),
72  threadContextDirty(true),
73  kvmStateDirty(false),
74  vcpuID(vm.allocVCPUID()), vcpuFD(-1), vcpuMMapSize(0),
75  _kvmRun(NULL), mmioRing(NULL),
76  pageSize(sysconf(_SC_PAGE_SIZE)),
77  tickEvent([this]{ tick(); }, "BaseKvmCPU tick",
78  false, Event::CPU_Tick_Pri),
79  activeInstPeriod(0),
80  perfControlledByTimer(params.usePerfOverflow),
81  hostFactor(params.hostFactor), stats(this),
82  ctrInsts(0)
83 {
84  if (pageSize == -1)
85  panic("KVM: Failed to determine host page size (%i)\n",
86  errno);
87 
88  if (FullSystem)
89  thread = new SimpleThread(this, 0, params.system, params.mmu,
90  params.isa[0]);
91  else
92  thread = new SimpleThread(this, /* thread_num */ 0, params.system,
93  params.workload[0], params.mmu,
94  params.isa[0]);
95 
96  thread->setStatus(ThreadContext::Halted);
97  tc = thread->getTC();
98  threadContexts.push_back(tc);
99 }
100 
102 {
103  if (_kvmRun)
104  munmap(_kvmRun, vcpuMMapSize);
105  close(vcpuFD);
106 }
107 
108 void
110 {
111  BaseCPU::init();
112 
113  if (numThreads != 1)
114  fatal("KVM: Multithreading not supported");
115 
116  tc->initMemProxies(tc);
117 }
118 
119 void
121 {
122  const BaseKvmCPUParams &p =
123  dynamic_cast<const BaseKvmCPUParams &>(params());
124 
125  Kvm &kvm(*vm.kvm);
126 
128 
129  assert(vcpuFD == -1);
130 
131  // Tell the VM that a CPU is about to start.
132  vm.cpuStartup();
133 
134  // We can't initialize KVM CPUs in BaseKvmCPU::init() since we are
135  // not guaranteed that the parent KVM VM has initialized at that
136  // point. Initialize virtual CPUs here instead.
138 
139  // Map the KVM run structure
141  _kvmRun = (struct kvm_run *)mmap(0, vcpuMMapSize,
142  PROT_READ | PROT_WRITE, MAP_SHARED,
143  vcpuFD, 0);
144  if (_kvmRun == MAP_FAILED)
145  panic("KVM: Failed to map run data structure\n");
146 
147  // Setup a pointer to the MMIO ring buffer if coalesced MMIO is
148  // available. The offset into the KVM's communication page is
149  // provided by the coalesced MMIO capability.
150  int mmioOffset(kvm.capCoalescedMMIO());
151  if (!p.useCoalescedMMIO) {
152  inform("KVM: Coalesced MMIO disabled by config.\n");
153  } else if (mmioOffset) {
154  inform("KVM: Coalesced IO available\n");
155  mmioRing = (struct kvm_coalesced_mmio_ring *)(
156  (char *)_kvmRun + (mmioOffset * pageSize));
157  } else {
158  inform("KVM: Coalesced not supported by host OS\n");
159  }
160 
161  Event *startupEvent(
162  new EventFunctionWrapper([this]{ startupThread(); }, name(), true));
163  schedule(startupEvent, curTick());
164 }
165 
168 {
169  return (activeMMIOReqs || pendingMMIOPkts.size())
171 }
172 
173 Tick
175 {
176  if (cpu->system->isAtomicMode()) {
177  Tick delay = sendAtomic(pkt);
178  delete pkt;
179  return delay;
180  } else {
181  if (pendingMMIOPkts.empty() && sendTimingReq(pkt)) {
182  activeMMIOReqs++;
183  } else {
184  pendingMMIOPkts.push(pkt);
185  }
186  // Return value is irrelevant for timing-mode accesses.
187  return 0;
188  }
189 }
190 
191 bool
193 {
194  DPRINTF(KvmIO, "KVM: Finished timing request\n");
195 
196  delete pkt;
197  activeMMIOReqs--;
198 
199  // We can switch back into KVM when all pending and in-flight MMIO
200  // operations have completed.
201  if (!(activeMMIOReqs || pendingMMIOPkts.size())) {
202  DPRINTF(KvmIO, "KVM: Finished all outstanding timing requests\n");
203  cpu->finishMMIOPending();
204  }
205  return true;
206 }
207 
208 void
210 {
211  DPRINTF(KvmIO, "KVM: Retry for timing request\n");
212 
213  assert(pendingMMIOPkts.size());
214 
215  // Assuming that we can issue infinite requests this cycle is a bit
216  // unrealistic, but it's not worth modeling something more complex in
217  // KVM.
218  while (pendingMMIOPkts.size() && sendTimingReq(pendingMMIOPkts.front())) {
219  pendingMMIOPkts.pop();
220  activeMMIOReqs++;
221  }
222 }
223 
224 void
226 {
227  assert(_status == RunningMMIOPending);
228  assert(!tickEvent.scheduled());
229 
232 }
233 
234 void
236 {
237  // Do thread-specific initialization. We need to setup signal
238  // delivery for counters and timers from within the thread that
239  // will execute the event queue to ensure that signals are
240  // delivered to the right threads.
241  const BaseKvmCPUParams &p =
242  dynamic_cast<const BaseKvmCPUParams &>(params());
243 
244  vcpuThread = pthread_self();
245 
246  // Setup signal handlers. This has to be done after the vCPU is
247  // created since it manipulates the vCPU signal mask.
249 
250  setupCounters();
251 
252  if (p.usePerfOverflow) {
253  runTimer.reset(new PerfKvmTimer(hwCycles,
255  p.hostFactor,
256  p.hostFreq));
257  } else {
258  runTimer.reset(new PosixKvmTimer(KVM_KICK_SIGNAL, CLOCK_MONOTONIC,
259  p.hostFactor,
260  p.hostFreq));
261  }
262 }
263 
265  : statistics::Group(parent),
266  ADD_STAT(committedInsts, statistics::units::Count::get(),
267  "Number of instructions committed"),
268  ADD_STAT(numVMExits, statistics::units::Count::get(),
269  "total number of KVM exits"),
270  ADD_STAT(numVMHalfEntries, statistics::units::Count::get(),
271  "number of KVM entries to finalize pending operations"),
272  ADD_STAT(numExitSignal, statistics::units::Count::get(),
273  "exits due to signal delivery"),
274  ADD_STAT(numMMIO, statistics::units::Count::get(),
275  "number of VM exits due to memory mapped IO"),
276  ADD_STAT(numCoalescedMMIO, statistics::units::Count::get(),
277  "number of coalesced memory mapped IO requests"),
278  ADD_STAT(numIO, statistics::units::Count::get(),
279  "number of VM exits due to legacy IO"),
280  ADD_STAT(numHalt, statistics::units::Count::get(),
281  "number of VM exits due to wait for interrupt instructions"),
282  ADD_STAT(numInterrupts, statistics::units::Count::get(),
283  "number of interrupts delivered"),
284  ADD_STAT(numHypercalls, statistics::units::Count::get(), "number of hypercalls")
285 {
286 }
287 
288 void
290 {
291  if (debug::Checkpoint) {
292  DPRINTF(Checkpoint, "KVM: Serializing thread %i:\n", tid);
293  dump();
294  }
295 
296  assert(tid == 0);
297  assert(_status == Idle);
298  thread->serialize(cp);
299 }
300 
301 void
303 {
304  DPRINTF(Checkpoint, "KVM: Unserialize thread %i:\n", tid);
305 
306  assert(tid == 0);
307  assert(_status == Idle);
308  thread->unserialize(cp);
309  threadContextDirty = true;
310 }
311 
314 {
315  if (switchedOut())
316  return DrainState::Drained;
317 
318  DPRINTF(Drain, "BaseKvmCPU::drain\n");
319 
320  // The event queue won't be locked when calling drain since that's
321  // not done from an event. Lock the event queue here to make sure
322  // that scoped migrations continue to work if we need to
323  // synchronize the thread context.
324  std::lock_guard<EventQueue> lock(*this->eventQueue());
325 
326  switch (_status) {
327  case Running:
328  // The base KVM code is normally ready when it is in the
329  // Running state, but the architecture specific code might be
330  // of a different opinion. This may happen when the CPU been
331  // notified of an event that hasn't been accepted by the vCPU
332  // yet.
333  if (!archIsDrained())
334  return DrainState::Draining;
335 
336  // The state of the CPU is consistent, so we don't need to do
337  // anything special to drain it. We simply de-schedule the
338  // tick event and enter the Idle state to prevent nasty things
339  // like MMIOs from happening.
340  if (tickEvent.scheduled())
342  _status = Idle;
343 
345  case Idle:
346  // Idle, no need to drain
347  assert(!tickEvent.scheduled());
348 
349  // Sync the thread context here since we'll need it when we
350  // switch CPUs or checkpoint the CPU.
352 
353  return DrainState::Drained;
354 
356  // The CPU has just requested a service that was handled in
357  // the RunningService state, but the results have still not
358  // been reported to the CPU. Now, we /could/ probably just
359  // update the register state ourselves instead of letting KVM
360  // handle it, but that would be tricky. Instead, we enter KVM
361  // and let it do its stuff.
362  DPRINTF(Drain, "KVM CPU is waiting for service completion, "
363  "requesting drain.\n");
364  return DrainState::Draining;
365 
366  case RunningMMIOPending:
367  // We need to drain since there are in-flight timing accesses
368  DPRINTF(Drain, "KVM CPU is waiting for timing accesses to complete, "
369  "requesting drain.\n");
370  return DrainState::Draining;
371 
372  case RunningService:
373  // We need to drain since the CPU is waiting for service (e.g., MMIOs)
374  DPRINTF(Drain, "KVM CPU is waiting for service, requesting drain.\n");
375  return DrainState::Draining;
376 
377  default:
378  panic("KVM: Unhandled CPU state in drain()\n");
379  return DrainState::Drained;
380  }
381 }
382 
383 void
385 {
386  assert(!tickEvent.scheduled());
387 
388  // We might have been switched out. In that case, we don't need to
389  // do anything.
390  if (switchedOut())
391  return;
392 
393  DPRINTF(Kvm, "drainResume\n");
395 
396  // The tick event is de-scheduled as a part of the draining
397  // process. Re-schedule it if the thread context is active.
398  if (tc->status() == ThreadContext::Active) {
400  _status = Running;
401  } else {
402  _status = Idle;
403  }
404 }
405 
406 void
408 {
409  // We should have drained prior to forking, which means that the
410  // tick event shouldn't be scheduled and the CPU is idle.
411  assert(!tickEvent.scheduled());
412  assert(_status == Idle);
413 
414  if (vcpuFD != -1) {
415  if (close(vcpuFD) == -1)
416  warn("kvm CPU: notifyFork failed to close vcpuFD\n");
417 
418  if (_kvmRun)
419  munmap(_kvmRun, vcpuMMapSize);
420 
421  vcpuFD = -1;
422  _kvmRun = NULL;
423 
425  hwCycles.detach();
426  }
427 }
428 
429 void
431 {
432  DPRINTF(Kvm, "switchOut\n");
433 
435 
436  // We should have drained prior to executing a switchOut, which
437  // means that the tick event shouldn't be scheduled and the CPU is
438  // idle.
439  assert(!tickEvent.scheduled());
440  assert(_status == Idle);
441 }
442 
443 void
445 {
446  DPRINTF(Kvm, "takeOverFrom\n");
447 
449 
450  // We should have drained prior to executing a switchOut, which
451  // means that the tick event shouldn't be scheduled and the CPU is
452  // idle.
453  assert(!tickEvent.scheduled());
454  assert(_status == Idle);
455  assert(threadContexts.size() == 1);
456 
457  // Force an update of the KVM state here instead of flagging the
458  // TC as dirty. This is not ideal from a performance point of
459  // view, but it makes debugging easier as it allows meaningful KVM
460  // state to be dumped before and after a takeover.
461  updateKvmState();
462  threadContextDirty = false;
463 }
464 
465 void
467 {
468  if (!(system->bypassCaches())) {
469  fatal("The KVM-based CPUs requires the memory system to be in the "
470  "'noncaching' mode.\n");
471  }
472 }
473 
474 void
476 {
477  DPRINTF(Kvm, "wakeup()\n");
478  // This method might have been called from another
479  // context. Migrate to this SimObject's event queue when
480  // delivering the wakeup signal.
482 
483  // Kick the vCPU to get it to come out of KVM.
484  kick();
485 
487  return;
488 
489  thread->activate();
490 }
491 
492 void
494 {
495  DPRINTF(Kvm, "ActivateContext %d\n", thread_num);
496 
497  assert(thread_num == 0);
498  assert(thread);
499 
500  assert(_status == Idle);
501  assert(!tickEvent.scheduled());
502 
505 
507  _status = Running;
508 }
509 
510 
511 void
513 {
514  DPRINTF(Kvm, "SuspendContext %d\n", thread_num);
515 
516  assert(thread_num == 0);
517  assert(thread);
518 
519  if (_status == Idle)
520  return;
521 
523 
524  // The tick event may no be scheduled if the quest has requested
525  // the monitor to wait for interrupts. The normal CPU models can
526  // get their tick events descheduled by quiesce instructions, but
527  // that can't happen here.
528  if (tickEvent.scheduled())
530 
531  _status = Idle;
532 }
533 
534 void
536 {
537  // for now, these are equivalent
538  suspendContext(thread_num);
539 }
540 
541 void
543 {
544  // for now, these are equivalent
545  suspendContext(thread_num);
547 }
548 
551 {
552  assert(tn == 0);
554  return tc;
555 }
556 
557 
558 Counter
560 {
561  return ctrInsts;
562 }
563 
564 Counter
566 {
567  hack_once("Pretending totalOps is equivalent to totalInsts()\n");
568  return ctrInsts;
569 }
570 
571 void
573 {
574  inform("State dumping not implemented.");
575 }
576 
577 void
579 {
580  Tick delay(0);
581  assert(_status != Idle && _status != RunningMMIOPending);
582 
583  switch (_status) {
584  case RunningService:
585  // handleKvmExit() will determine the next state of the CPU
586  delay = handleKvmExit();
587 
588  if (tryDrain())
589  _status = Idle;
590  break;
591 
593  case Running: {
594  auto &queue = thread->comInstEventQueue;
595  const uint64_t nextInstEvent(
596  queue.empty() ? MaxTick : queue.nextTick());
597  // Enter into KVM and complete pending IO instructions if we
598  // have an instruction event pending.
599  const Tick ticksToExecute(
600  nextInstEvent > ctrInsts ?
601  curEventQueue()->nextTick() - curTick() : 0);
602 
603  if (alwaysSyncTC)
604  threadContextDirty = true;
605 
606  // We might need to update the KVM state.
607  syncKvmState();
608 
609  // Setup any pending instruction count breakpoints using
610  // PerfEvent if we are going to execute more than just an IO
611  // completion.
612  if (ticksToExecute > 0)
613  setupInstStop();
614 
615  DPRINTF(KvmRun, "Entering KVM...\n");
616  if (drainState() == DrainState::Draining) {
617  // Force an immediate exit from KVM after completing
618  // pending operations. The architecture-specific code
619  // takes care to run until it is in a state where it can
620  // safely be drained.
621  delay = kvmRunDrain();
622  } else {
623  delay = kvmRun(ticksToExecute);
624  }
625 
626  // The CPU might have been suspended before entering into
627  // KVM. Assume that the CPU was suspended /before/ entering
628  // into KVM and skip the exit handling.
629  if (_status == Idle)
630  break;
631 
632  // Entering into KVM implies that we'll have to reload the thread
633  // context from KVM if we want to access it. Flag the KVM state as
634  // dirty with respect to the cached thread context.
635  kvmStateDirty = true;
636 
637  if (alwaysSyncTC)
639 
640  // Enter into the RunningService state unless the
641  // simulation was stopped by a timer.
642  if (_kvmRun->exit_reason != KVM_EXIT_INTR) {
644  } else {
646  _status = Running;
647  }
648 
649  // Service any pending instruction events. The vCPU should
650  // have exited in time for the event using the instruction
651  // counter configured by setupInstStop().
652  queue.serviceEvents(ctrInsts);
653 
654  if (tryDrain())
655  _status = Idle;
656  } break;
657 
658  default:
659  panic("BaseKvmCPU entered tick() in an illegal state (%i)\n",
660  _status);
661  }
662 
663  // Schedule a new tick if we are still running
664  if (_status != Idle && _status != RunningMMIOPending) {
665  if (_kvmRun->exit_reason == KVM_EXIT_INTR && runTimer->expired())
667  curEventQueue()->nextTick() - curTick() + 1)));
668  else
670  }
671 }
672 
673 Tick
675 {
676  // By default, the only thing we need to drain is a pending IO
677  // operation which assumes that we are in the
678  // RunningServiceCompletion or RunningMMIOPending state.
679  assert(_status == RunningServiceCompletion ||
681 
682  // Deliver the data from the pending IO operation and immediately
683  // exit.
684  return kvmRun(0);
685 }
686 
687 uint64_t
689 {
690  return hwCycles.read();
691 }
692 
693 Tick
695 {
696  Tick ticksExecuted;
697  fatal_if(vcpuFD == -1,
698  "Trying to run a KVM CPU in a forked child process. "
699  "This is not supported.\n");
700  DPRINTF(KvmRun, "KVM: Executing for %i ticks\n", ticks);
701 
702  if (ticks == 0) {
703  // Settings ticks == 0 is a special case which causes an entry
704  // into KVM that finishes pending operations (e.g., IO) and
705  // then immediately exits.
706  DPRINTF(KvmRun, "KVM: Delivering IO without full guest entry\n");
707 
709 
710  // Send a KVM_KICK_SIGNAL to the vCPU thread (i.e., this
711  // thread). The KVM control signal is masked while executing
712  // in gem5 and gets unmasked temporarily as when entering
713  // KVM. See setSignalMask() and setupSignalHandler().
714  kick();
715 
716  // Start the vCPU. KVM will check for signals after completing
717  // pending operations (IO). Since the KVM_KICK_SIGNAL is
718  // pending, this forces an immediate exit to gem5 again. We
719  // don't bother to setup timers since this shouldn't actually
720  // execute any code (other than completing half-executed IO
721  // instructions) in the guest.
722  ioctlRun();
723 
724  // We always execute at least one cycle to prevent the
725  // BaseKvmCPU::tick() to be rescheduled on the same tick
726  // twice.
727  ticksExecuted = clockPeriod();
728  } else {
729  // This method is executed as a result of a tick event. That
730  // means that the event queue will be locked when entering the
731  // method. We temporarily unlock the event queue to allow
732  // other threads to steal control of this thread to inject
733  // interrupts. They will typically lock the queue and then
734  // force an exit from KVM by kicking the vCPU.
736 
737  if (ticks < runTimer->resolution()) {
738  DPRINTF(KvmRun, "KVM: Adjusting tick count (%i -> %i)\n",
739  ticks, runTimer->resolution());
740  ticks = runTimer->resolution();
741  }
742 
743  // Get hardware statistics after synchronizing contexts. The KVM
744  // state update might affect guest cycle counters.
745  uint64_t baseCycles(getHostCycles());
746  uint64_t baseInstrs(hwInstructions.read());
747 
748  // Arm the run timer and start the cycle timer if it isn't
749  // controlled by the overflow timer. Starting/stopping the cycle
750  // timer automatically starts the other perf timers as they are in
751  // the same counter group.
752  runTimer->arm(ticks);
754  hwCycles.start();
755 
756  ioctlRun();
757 
758  runTimer->disarm();
760  hwCycles.stop();
761 
762  // The control signal may have been delivered after we exited
763  // from KVM. It will be pending in that case since it is
764  // masked when we aren't executing in KVM. Discard it to make
765  // sure we don't deliver it immediately next time we try to
766  // enter into KVM.
768 
769  const uint64_t hostCyclesExecuted(getHostCycles() - baseCycles);
770  const uint64_t simCyclesExecuted(hostCyclesExecuted * hostFactor);
771  const uint64_t instsExecuted(hwInstructions.read() - baseInstrs);
772  ticksExecuted = runTimer->ticksFromHostCycles(hostCyclesExecuted);
773 
774  /* Update statistics */
775  baseStats.numCycles += simCyclesExecuted;;
776  stats.committedInsts += instsExecuted;
777  ctrInsts += instsExecuted;
778 
779  DPRINTF(KvmRun,
780  "KVM: Executed %i instructions in %i cycles "
781  "(%i ticks, sim cycles: %i).\n",
782  instsExecuted, hostCyclesExecuted, ticksExecuted, simCyclesExecuted);
783  }
784 
785  ++stats.numVMExits;
786 
787  return ticksExecuted + flushCoalescedMMIO();
788 }
789 
790 void
792 {
794  if (ioctl(KVM_NMI) == -1)
795  panic("KVM: Failed to deliver NMI to virtual CPU\n");
796 }
797 
798 void
799 BaseKvmCPU::kvmInterrupt(const struct kvm_interrupt &interrupt)
800 {
802  if (ioctl(KVM_INTERRUPT, (void *)&interrupt) == -1)
803  panic("KVM: Failed to deliver interrupt to virtual CPU\n");
804 }
805 
806 void
807 BaseKvmCPU::getRegisters(struct kvm_regs &regs) const
808 {
809  if (ioctl(KVM_GET_REGS, &regs) == -1)
810  panic("KVM: Failed to get guest registers\n");
811 }
812 
813 void
814 BaseKvmCPU::setRegisters(const struct kvm_regs &regs)
815 {
816  if (ioctl(KVM_SET_REGS, (void *)&regs) == -1)
817  panic("KVM: Failed to set guest registers\n");
818 }
819 
820 void
821 BaseKvmCPU::getSpecialRegisters(struct kvm_sregs &regs) const
822 {
823  if (ioctl(KVM_GET_SREGS, &regs) == -1)
824  panic("KVM: Failed to get guest special registers\n");
825 }
826 
827 void
828 BaseKvmCPU::setSpecialRegisters(const struct kvm_sregs &regs)
829 {
830  if (ioctl(KVM_SET_SREGS, (void *)&regs) == -1)
831  panic("KVM: Failed to set guest special registers\n");
832 }
833 
834 void
835 BaseKvmCPU::getFPUState(struct kvm_fpu &state) const
836 {
837  if (ioctl(KVM_GET_FPU, &state) == -1)
838  panic("KVM: Failed to get guest FPU state\n");
839 }
840 
841 void
842 BaseKvmCPU::setFPUState(const struct kvm_fpu &state)
843 {
844  if (ioctl(KVM_SET_FPU, (void *)&state) == -1)
845  panic("KVM: Failed to set guest FPU state\n");
846 }
847 
848 
849 void
850 BaseKvmCPU::setOneReg(uint64_t id, const void *addr)
851 {
852 #ifdef KVM_SET_ONE_REG
853  struct kvm_one_reg reg;
854  reg.id = id;
855  reg.addr = (uint64_t)addr;
856 
857  if (ioctl(KVM_SET_ONE_REG, &reg) == -1) {
858  panic("KVM: Failed to set register (0x%x) value (errno: %i)\n",
859  id, errno);
860  }
861 #else
862  panic("KVM_SET_ONE_REG is unsupported on this platform.\n");
863 #endif
864 }
865 
866 void
867 BaseKvmCPU::getOneReg(uint64_t id, void *addr) const
868 {
869 #ifdef KVM_GET_ONE_REG
870  struct kvm_one_reg reg;
871  reg.id = id;
872  reg.addr = (uint64_t)addr;
873 
874  if (ioctl(KVM_GET_ONE_REG, &reg) == -1) {
875  panic("KVM: Failed to get register (0x%x) value (errno: %i)\n",
876  id, errno);
877  }
878 #else
879  panic("KVM_GET_ONE_REG is unsupported on this platform.\n");
880 #endif
881 }
882 
883 std::string
885 {
886 #ifdef KVM_GET_ONE_REG
887  std::ostringstream ss;
888 
889  ss.setf(std::ios::hex, std::ios::basefield);
890  ss.setf(std::ios::showbase);
891 #define HANDLE_INTTYPE(len) \
892  case KVM_REG_SIZE_U ## len: { \
893  uint ## len ## _t value; \
894  getOneReg(id, &value); \
895  ss << value; \
896  } break
897 
898 #define HANDLE_ARRAY(len) \
899  case KVM_REG_SIZE_U ## len: { \
900  uint8_t value[len / 8]; \
901  getOneReg(id, value); \
902  ccprintf(ss, "[0x%x", value[0]); \
903  for (int i = 1; i < len / 8; ++i) \
904  ccprintf(ss, ", 0x%x", value[i]); \
905  ccprintf(ss, "]"); \
906  } break
907 
908  switch (id & KVM_REG_SIZE_MASK) {
909  HANDLE_INTTYPE(8);
910  HANDLE_INTTYPE(16);
911  HANDLE_INTTYPE(32);
912  HANDLE_INTTYPE(64);
913  HANDLE_ARRAY(128);
914  HANDLE_ARRAY(256);
915  HANDLE_ARRAY(512);
916  HANDLE_ARRAY(1024);
917  default:
918  ss << "??";
919  }
920 
921 #undef HANDLE_INTTYPE
922 #undef HANDLE_ARRAY
923 
924  return ss.str();
925 #else
926  panic("KVM_GET_ONE_REG is unsupported on this platform.\n");
927 #endif
928 }
929 
930 void
932 {
933  if (!kvmStateDirty)
934  return;
935 
936  assert(!threadContextDirty);
937 
939  kvmStateDirty = false;
940 }
941 
942 void
944 {
945  if (!threadContextDirty)
946  return;
947 
948  assert(!kvmStateDirty);
949 
950  updateKvmState();
951  threadContextDirty = false;
952 }
953 
954 Tick
956 {
957  DPRINTF(KvmRun, "handleKvmExit (exit_reason: %i)\n", _kvmRun->exit_reason);
958  assert(_status == RunningService);
959 
960  // Switch into the running state by default. Individual handlers
961  // can override this.
962  _status = Running;
963  switch (_kvmRun->exit_reason) {
964  case KVM_EXIT_UNKNOWN:
965  return handleKvmExitUnknown();
966 
967  case KVM_EXIT_EXCEPTION:
968  return handleKvmExitException();
969 
970  case KVM_EXIT_IO:
971  {
972  ++stats.numIO;
973  Tick ticks = handleKvmExitIO();
975  return ticks;
976  }
977 
978  case KVM_EXIT_HYPERCALL:
980  return handleKvmExitHypercall();
981 
982  case KVM_EXIT_HLT:
983  /* The guest has halted and is waiting for interrupts */
984  DPRINTF(Kvm, "handleKvmExitHalt\n");
985  ++stats.numHalt;
986 
987  // Suspend the thread until the next interrupt arrives
988  thread->suspend();
989 
990  // This is actually ignored since the thread is suspended.
991  return 0;
992 
993  case KVM_EXIT_MMIO:
994  {
995  /* Service memory mapped IO requests */
996  DPRINTF(KvmIO, "KVM: Handling MMIO (w: %u, addr: 0x%x, len: %u)\n",
997  _kvmRun->mmio.is_write,
998  _kvmRun->mmio.phys_addr, _kvmRun->mmio.len);
999 
1000  ++stats.numMMIO;
1001  Tick ticks = doMMIOAccess(_kvmRun->mmio.phys_addr, _kvmRun->mmio.data,
1002  _kvmRun->mmio.len, _kvmRun->mmio.is_write);
1003  // doMMIOAccess could have triggered a suspend, in which case we don't
1004  // want to overwrite the _status.
1005  if (_status != Idle)
1007  return ticks;
1008  }
1009 
1010  case KVM_EXIT_IRQ_WINDOW_OPEN:
1011  return handleKvmExitIRQWindowOpen();
1012 
1013  case KVM_EXIT_FAIL_ENTRY:
1014  return handleKvmExitFailEntry();
1015 
1016  case KVM_EXIT_INTR:
1017  /* KVM was interrupted by a signal, restart it in the next
1018  * tick. */
1019  return 0;
1020 
1021  case KVM_EXIT_INTERNAL_ERROR:
1022  panic("KVM: Internal error (suberror: %u)\n",
1023  _kvmRun->internal.suberror);
1024 
1025  default:
1026  dump();
1027  panic("KVM: Unexpected exit (exit_reason: %u)\n", _kvmRun->exit_reason);
1028  }
1029 }
1030 
1031 Tick
1033 {
1034  panic("KVM: Unhandled guest IO (dir: %i, size: %i, port: 0x%x, count: %i)\n",
1035  _kvmRun->io.direction, _kvmRun->io.size,
1036  _kvmRun->io.port, _kvmRun->io.count);
1037 }
1038 
1039 Tick
1041 {
1042  panic("KVM: Unhandled hypercall\n");
1043 }
1044 
1045 Tick
1047 {
1048  warn("KVM: Unhandled IRQ window.\n");
1049  return 0;
1050 }
1051 
1052 
1053 Tick
1055 {
1056  dump();
1057  panic("KVM: Unknown error when starting vCPU (hw reason: 0x%llx)\n",
1058  _kvmRun->hw.hardware_exit_reason);
1059 }
1060 
1061 Tick
1063 {
1064  dump();
1065  panic("KVM: Got exception when starting vCPU "
1066  "(exception: %u, error_code: %u)\n",
1067  _kvmRun->ex.exception, _kvmRun->ex.error_code);
1068 }
1069 
1070 Tick
1072 {
1073  dump();
1074  panic("KVM: Failed to enter virtualized mode (hw reason: 0x%llx)\n",
1075  _kvmRun->fail_entry.hardware_entry_failure_reason);
1076 }
1077 
1078 Tick
1079 BaseKvmCPU::doMMIOAccess(Addr paddr, void *data, int size, bool write)
1080 {
1083 
1084  RequestPtr mmio_req = std::make_shared<Request>(
1085  paddr, size, Request::UNCACHEABLE, dataRequestorId());
1086 
1087  mmio_req->setContext(tc->contextId());
1088  // Some architectures do need to massage physical addresses a bit
1089  // before they are inserted into the memory system. This enables
1090  // APIC accesses on x86 and m5ops where supported through a MMIO
1091  // interface.
1092  BaseMMU::Mode access_type(write ? BaseMMU::Write : BaseMMU::Read);
1093  Fault fault(tc->getMMUPtr()->finalizePhysical(mmio_req, tc, access_type));
1094  if (fault != NoFault)
1095  warn("Finalization of MMIO address failed: %s\n", fault->name());
1096 
1097 
1098  const MemCmd cmd(write ? MemCmd::WriteReq : MemCmd::ReadReq);
1099  PacketPtr pkt = new Packet(mmio_req, cmd);
1100  pkt->dataStatic(data);
1101 
1102  if (mmio_req->isLocalAccess()) {
1103  // Since the PC has already been advanced by KVM, set the next
1104  // PC to the current PC. KVM doesn't use that value, and that
1105  // way any gem5 op or syscall which needs to know what the next
1106  // PC is will be able to get a reasonable value.
1107  //
1108  // We won't be able to rewind the current PC to the "correct"
1109  // value without figuring out how big the current instruction
1110  // is, and that's probably not worth the effort.
1111  tc->setNPC(tc->instAddr());
1112  // We currently assume that there is no need to migrate to a
1113  // different event queue when doing local accesses. Currently, they
1114  // are only used for m5ops, so it should be a valid assumption.
1115  const Cycles ipr_delay = mmio_req->localAccessor(tc, pkt);
1116  threadContextDirty = true;
1117  delete pkt;
1118  return clockPeriod() * ipr_delay;
1119  } else {
1120  // Temporarily lock and migrate to the device event queue to
1121  // prevent races in multi-core mode.
1123 
1124  return dataPort.submitIO(pkt);
1125  }
1126 }
1127 
1128 void
1130 {
1131  std::unique_ptr<struct kvm_signal_mask> kvm_mask;
1132 
1133  if (mask) {
1134  kvm_mask.reset((struct kvm_signal_mask *)operator new(
1135  sizeof(struct kvm_signal_mask) + sizeof(*mask)));
1136  // The kernel and the user-space headers have different ideas
1137  // about the size of sigset_t. This seems like a massive hack,
1138  // but is actually what qemu does.
1139  assert(sizeof(*mask) >= 8);
1140  kvm_mask->len = 8;
1141  memcpy(kvm_mask->sigset, mask, kvm_mask->len);
1142  }
1143 
1144  if (ioctl(KVM_SET_SIGNAL_MASK, (void *)kvm_mask.get()) == -1)
1145  panic("KVM: Failed to set vCPU signal mask (errno: %i)\n",
1146  errno);
1147 }
1148 
1149 int
1150 BaseKvmCPU::ioctl(int request, long p1) const
1151 {
1152  if (vcpuFD == -1)
1153  panic("KVM: CPU ioctl called before initialization\n");
1154 
1155  return ::ioctl(vcpuFD, request, p1);
1156 }
1157 
1158 Tick
1160 {
1161  if (!mmioRing)
1162  return 0;
1163 
1164  DPRINTF(KvmIO, "KVM: Flushing the coalesced MMIO ring buffer\n");
1165 
1166  // TODO: We might need to do synchronization when we start to
1167  // support multiple CPUs
1168  Tick ticks(0);
1169  while (mmioRing->first != mmioRing->last) {
1170  struct kvm_coalesced_mmio &ent(
1171  mmioRing->coalesced_mmio[mmioRing->first]);
1172 
1173  DPRINTF(KvmIO, "KVM: Handling coalesced MMIO (addr: 0x%x, len: %u)\n",
1174  ent.phys_addr, ent.len);
1175 
1177  ticks += doMMIOAccess(ent.phys_addr, ent.data, ent.len, true);
1178 
1179  mmioRing->first = (mmioRing->first + 1) % KVM_COALESCED_MMIO_MAX;
1180  }
1181 
1182  return ticks;
1183 }
1184 
1195 static void
1196 onKickSignal(int signo, siginfo_t *si, void *data)
1197 {
1198 }
1199 
1200 void
1202 {
1203  struct sigaction sa;
1204 
1205  memset(&sa, 0, sizeof(sa));
1206  sa.sa_sigaction = onKickSignal;
1207  sa.sa_flags = SA_SIGINFO | SA_RESTART;
1208  if (sigaction(KVM_KICK_SIGNAL, &sa, NULL) == -1)
1209  panic("KVM: Failed to setup vCPU timer signal handler\n");
1210 
1211  sigset_t sigset;
1212  if (pthread_sigmask(SIG_BLOCK, NULL, &sigset) == -1)
1213  panic("KVM: Failed get signal mask\n");
1214 
1215  // Request KVM to setup the same signal mask as we're currently
1216  // running with except for the KVM control signal. We'll sometimes
1217  // need to raise the KVM_KICK_SIGNAL to cause immediate exits from
1218  // KVM after servicing IO requests. See kvmRun().
1219  sigdelset(&sigset, KVM_KICK_SIGNAL);
1220  setSignalMask(&sigset);
1221 
1222  // Mask our control signals so they aren't delivered unless we're
1223  // actually executing inside KVM.
1224  sigaddset(&sigset, KVM_KICK_SIGNAL);
1225  if (pthread_sigmask(SIG_SETMASK, &sigset, NULL) == -1)
1226  panic("KVM: Failed mask the KVM control signals\n");
1227 }
1228 
1229 bool
1231 {
1232  int discardedSignal;
1233 
1234  // Setting the timeout to zero causes sigtimedwait to return
1235  // immediately.
1236  struct timespec timeout;
1237  timeout.tv_sec = 0;
1238  timeout.tv_nsec = 0;
1239 
1240  sigset_t sigset;
1241  sigemptyset(&sigset);
1242  sigaddset(&sigset, signum);
1243 
1244  do {
1245  discardedSignal = sigtimedwait(&sigset, NULL, &timeout);
1246  } while (discardedSignal == -1 && errno == EINTR);
1247 
1248  if (discardedSignal == signum)
1249  return true;
1250  else if (discardedSignal == -1 && errno == EAGAIN)
1251  return false;
1252  else
1253  panic("Unexpected return value from sigtimedwait: %i (errno: %i)\n",
1254  discardedSignal, errno);
1255 }
1256 
1257 void
1259 {
1260  DPRINTF(Kvm, "Attaching cycle counter...\n");
1261  PerfKvmCounterConfig cfgCycles(PERF_TYPE_HARDWARE,
1262  PERF_COUNT_HW_CPU_CYCLES);
1263  cfgCycles.disabled(true)
1264  .pinned(true);
1265 
1266  // Try to exclude the host. We set both exclude_hv and
1267  // exclude_host since different architectures use slightly
1268  // different APIs in the kernel.
1269  cfgCycles.exclude_hv(true)
1270  .exclude_host(true);
1271 
1272  if (perfControlledByTimer) {
1273  // We need to configure the cycles counter to send overflows
1274  // since we are going to use it to trigger timer signals that
1275  // trap back into m5 from KVM. In practice, this means that we
1276  // need to set some non-zero sample period that gets
1277  // overridden when the timer is armed.
1278  cfgCycles.wakeupEvents(1)
1279  .samplePeriod(42);
1280  }
1281 
1282  hwCycles.attach(cfgCycles,
1283  0); // TID (0 => currentThread)
1284 
1285  setupInstCounter();
1286 }
1287 
1288 bool
1290 {
1292  return false;
1293 
1294  if (!archIsDrained()) {
1295  DPRINTF(Drain, "tryDrain: Architecture code is not ready.\n");
1296  return false;
1297  }
1298 
1299  if (_status == Idle || _status == Running) {
1300  DPRINTF(Drain,
1301  "tryDrain: CPU transitioned into the Idle state, drain done\n");
1302  signalDrainDone();
1303  return true;
1304  } else {
1305  DPRINTF(Drain, "tryDrain: CPU not ready.\n");
1306  return false;
1307  }
1308 }
1309 
1310 void
1312 {
1313  if (ioctl(KVM_RUN) == -1) {
1314  if (errno != EINTR)
1315  panic("KVM: Failed to start virtual CPU (errno: %i)\n",
1316  errno);
1317  }
1318 }
1319 
1320 void
1322 {
1323  if (thread->comInstEventQueue.empty()) {
1324  setupInstCounter(0);
1325  } else {
1327  assert(next > ctrInsts);
1328  setupInstCounter(next - ctrInsts);
1329  }
1330 }
1331 
1332 void
1334 {
1335  // No need to do anything if we aren't attaching for the first
1336  // time or the period isn't changing.
1337  if (period == activeInstPeriod && hwInstructions.attached())
1338  return;
1339 
1340  PerfKvmCounterConfig cfgInstructions(PERF_TYPE_HARDWARE,
1341  PERF_COUNT_HW_INSTRUCTIONS);
1342 
1343  // Try to exclude the host. We set both exclude_hv and
1344  // exclude_host since different architectures use slightly
1345  // different APIs in the kernel.
1346  cfgInstructions.exclude_hv(true)
1347  .exclude_host(true);
1348 
1349  if (period) {
1350  // Setup a sampling counter if that has been requested.
1351  cfgInstructions.wakeupEvents(1)
1352  .samplePeriod(period);
1353  }
1354 
1355  // We need to detach and re-attach the counter to reliably change
1356  // sampling settings. See PerfKvmCounter::period() for details.
1357  if (hwInstructions.attached())
1359  assert(hwCycles.attached());
1360  hwInstructions.attach(cfgInstructions,
1361  0, // TID (0 => currentThread)
1362  hwCycles);
1363 
1364  if (period)
1366 
1367  activeInstPeriod = period;
1368 }
1369 
1370 } // namespace gem5
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
gem5::BaseKvmCPU::stats
gem5::BaseKvmCPU::StatGroup stats
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:189
gem5::BaseKvmCPU::_status
Status _status
CPU run state.
Definition: base.hh:240
gem5::KvmVM::createVCPU
int createVCPU(long vcpuID)
Create a new vCPU within a VM.
Definition: vm.cc:560
gem5::EventQueue::ScopedRelease
Definition: eventq.hh:716
gem5::BaseMMU::Read
@ Read
Definition: mmu.hh:53
gem5::NoFault
constexpr decltype(nullptr) NoFault
Definition: types.hh:260
gem5::ThreadContext::Active
@ Active
Running.
Definition: thread_context.hh:108
gem5::BaseCPU::switchedOut
bool switchedOut() const
Determine if the CPU is switched out.
Definition: base.hh:357
gem5::Kvm::capCoalescedMMIO
int capCoalescedMMIO() const
Check if coalesced MMIO is supported and which page in the MMAP'ed structure it stores requests in.
Definition: vm.cc:136
warn
#define warn(...)
Definition: logging.hh:245
system.hh
hack_once
#define hack_once(...)
Definition: logging.hh:253
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::ThreadContext::Halted
@ Halted
Permanently shut down.
Definition: thread_context.hh:121
gem5::BaseCPU::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: base.cc:315
gem5::BaseKvmCPU::StatGroup::StatGroup
StatGroup(statistics::Group *parent)
Definition: base.cc:264
gem5::Drainable::drainState
DrainState drainState() const
Return the current drain state of an object.
Definition: drain.hh:324
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::StatGroup::numVMHalfEntries
statistics::Scalar numVMHalfEntries
Definition: base.hh:799
gem5::BaseKvmCPU::RunningServiceCompletion
@ RunningServiceCompletion
Service completion in progress.
Definition: base.hh:236
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::PerfKvmCounter::attached
bool attached() const
Check if a counter is attached.
Definition: perfevent.hh:231
gem5::BaseKvmCPU::drainResume
void drainResume() override
Resume execution after a successful drain.
Definition: base.cc:384
gem5::BaseMMU::Mode
Mode
Definition: mmu.hh:53
gem5::PerfKvmCounterConfig::pinned
PerfKvmCounterConfig & pinned(bool val)
Force the group to be on the active all the time (i.e., disallow multiplexing).
Definition: perfevent.hh:126
gem5::Request::UNCACHEABLE
@ UNCACHEABLE
The request is to an uncacheable address.
Definition: request.hh:125
gem5::BaseMMU::Write
@ Write
Definition: mmu.hh:53
gem5::ThreadContext::getMMUPtr
virtual BaseMMU * getMMUPtr()=0
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::BaseCPU::updateCycleCounters
void updateCycleCounters(CPUState state)
base method keeping track of cycle progression
Definition: base.hh:523
gem5::BaseKvmCPU::alwaysSyncTC
const bool alwaysSyncTC
Be conservative and always synchronize the thread context on KVM entry/exit.
Definition: base.hh:633
gem5::BaseCPU::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: base.cc:272
GEM5_FALLTHROUGH
#define GEM5_FALLTHROUGH
Definition: compiler.hh:61
gem5::System::bypassCaches
bool bypassCaches() const
Should caches be bypassed?
Definition: system.hh:285
gem5::BaseKvmCPU::kick
void kick() const
Force an exit from KVM.
Definition: base.hh:138
gem5::X86ISA::lock
Bitfield< 5 > lock
Definition: types.hh:82
gem5::SimpleThread::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: simple_thread.cc:124
gem5::MaxTick
const Tick MaxTick
Definition: types.hh:60
gem5::BaseKvmCPU::flushCoalescedMMIO
Tick flushCoalescedMMIO()
Service MMIO requests in the mmioRing.
Definition: base.cc:1159
gem5::ThreadContext::contextId
virtual ContextID contextId() const =0
gem5::BaseCPU::system
System * system
Definition: base.hh:376
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::X86ISA::system
Bitfield< 15 > system
Definition: misc.hh:1003
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::EventManager::schedule
void schedule(Event &event, Tick when)
Definition: eventq.hh:1019
gem5::BaseKvmCPU::suspendContext
void suspendContext(ThreadID thread_num) override
Notify the CPU that the indicated context is now suspended.
Definition: base.cc:512
gem5::ThreadContext::instAddr
virtual Addr instAddr() const =0
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::SimpleThread::activate
void activate() override
Set the status to Active.
Definition: simple_thread.cc:131
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
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::ThreadContext::status
virtual Status status() const =0
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::BaseKvmCPU::StatGroup::numVMExits
statistics::Scalar numVMExits
Definition: base.hh:798
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::PerfKvmCounter::detach
void detach()
Detach a counter from PerfEvent.
Definition: perfevent.cc:96
gem5::MemCmd
Definition: packet.hh:75
gem5::BaseCPU::numThreads
ThreadID numThreads
Number of threads we're actually simulating (<= SMT_MAX_THREADS).
Definition: base.hh:368
gem5::PerfKvmCounter::stop
void stop()
Stop counting.
Definition: perfevent.cc:117
gem5::BaseKvmCPU::handleKvmExitException
virtual Tick handleKvmExitException()
An unhandled virtualization exception occured.
Definition: base.cc:1062
gem5::BaseKvmCPU::discardPendingSignal
bool discardPendingSignal(int signum) const
Discard a (potentially) pending signal.
Definition: base.cc:1230
gem5::Packet::dataStatic
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
Definition: packet.hh:1134
gem5::BaseKvmCPU::vcpuThread
pthread_t vcpuThread
ID of the vCPU thread.
Definition: base.hh:651
gem5::ThreadState::lastSuspend
Tick lastSuspend
Last time suspend was called on this thread.
Definition: thread_state.hh:138
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::BaseCPU::baseStats
gem5::BaseCPU::BaseCPUStats baseStats
gem5::PerfKvmCounter::enableSignals
void enableSignals(pid_t tid, int signal)
Enable signal delivery to a thread on counter overflow.
Definition: perfevent.cc:147
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::Named::name
virtual std::string name() const
Definition: named.hh:47
gem5::Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:255
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::BaseKvmCPU::tickEvent
EventFunctionWrapper tickEvent
Definition: base.hh:715
gem5::ThreadContext::Suspended
@ Suspended
Temporarily inactive.
Definition: thread_context.hh:112
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:186
gem5::Event
Definition: eventq.hh:251
ADD_STAT
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition: group.hh:75
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::tc
ThreadContext * tc
ThreadContext object, provides an interface for external objects to modify this thread's state.
Definition: base.hh:158
gem5::BaseCPU::BaseCPUStats::numCycles
statistics::Scalar numCycles
Definition: base.hh:597
gem5::ThreadContext::setNPC
void setNPC(Addr val)
Definition: thread_context.hh:241
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
gem5::probing::Packet
ProbePointArg< PacketInfo > Packet
Packet probe point.
Definition: mem.hh:109
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
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::Kvm::getVCPUMMapSize
int getVCPUMMapSize() const
Get the size of the MMAPed parameter area used to communicate vCPU parameters between the kernel and ...
Definition: vm.hh:96
gem5::RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:92
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::EventQueue::nextTick
Tick nextTick() const
Definition: eventq.hh:843
gem5::MemCmd::ReadReq
@ ReadReq
Definition: packet.hh:86
process.hh
gem5::BaseKvmCPU::StatGroup::numIO
statistics::Scalar numIO
Definition: base.hh:803
gem5::PerfKvmCounter::attach
void attach(PerfKvmCounterConfig &config, pid_t tid)
Attach a counter.
Definition: perfevent.hh:207
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::EventQueue::ScopedMigration
Definition: eventq.hh:672
gem5::BaseKvmCPU::KVMCpuPort::nextIOState
Status nextIOState() const
Returns next valid state after one or more IO accesses.
Definition: base.cc:167
gem5::PerfKvmCounterConfig::wakeupEvents
PerfKvmCounterConfig & wakeupEvents(uint32_t events)
Set the number of samples that need to be triggered before reporting data as being available on the p...
Definition: perfevent.hh:101
gem5::EventQueue::empty
bool empty() const
Returns true if no events are queued.
Definition: eventq.hh:898
gem5::BaseCPU
Definition: base.hh:107
gem5::ThreadContext::initMemProxies
virtual void initMemProxies(ThreadContext *tc)=0
Initialise the physical and virtual port proxies and tie them to the data port of the CPU.
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
ss
std::stringstream ss
Definition: trace.test.cc:45
compiler.hh
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::DrainState::Drained
@ Drained
Buffers drained, ready for serialization/handover.
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::ArmISA::si
Bitfield< 6 > si
Definition: misc_types.hh:772
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
name
const std::string & name()
Definition: trace.cc:49
base.hh
gem5::BaseKvmCPU::setRegisters
void setRegisters(const struct kvm_regs &regs)
Definition: base.cc:814
gem5::ArmISA::vm
Bitfield< 0 > vm
Definition: misc_types.hh:284
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::Clocked::clockEdge
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
Definition: clocked_object.hh:177
gem5::KvmVM::kvm
Kvm * kvm
Global KVM interface.
Definition: vm.hh:417
gem5::BaseKvmCPU::updateThreadContext
virtual void updateThreadContext()=0
Update the current thread context with the KVM state.
gem5::EventManager::deschedule
void deschedule(Event &event)
Definition: eventq.hh:1028
gem5::BaseKvmCPU::getHostCycles
virtual uint64_t getHostCycles() const
Get the value of the hardware cycle counter in the guest.
Definition: base.cc:688
gem5::PerfKvmTimer
PerfEvent based timer using the host's CPU cycle counter.
Definition: timer.hh:221
gem5::BaseCPU::CPU_STATE_SLEEP
@ CPU_STATE_SLEEP
Definition: base.hh:515
gem5::X86ISA::reg
Bitfield< 5, 3 > reg
Definition: types.hh:92
gem5::KvmVM::cpuStartup
void cpuStartup()
VM CPU initialization code.
Definition: vm.cc:346
gem5::EventFunctionWrapper
Definition: eventq.hh:1115
gem5::Drainable::signalDrainDone
void signalDrainDone() const
Signal that an object is drained.
Definition: drain.hh:305
gem5::Clocked::nextCycle
Tick nextCycle() const
Based on the clock of the object, determine the start tick of the first cycle that is at least one cy...
Definition: clocked_object.hh:213
gem5::FullSystem
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:223
gem5::PerfKvmCounterConfig::exclude_host
PerfKvmCounterConfig & exclude_host(bool val)
Exclude the events from the host (i.e., only include events from the guest system).
Definition: perfevent.hh:144
gem5::SimpleThread::getTC
ThreadContext * getTC()
Returns the pointer to this SimpleThread's ThreadContext.
Definition: simple_thread.hh:169
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
gem5::ThreadState::lastActivate
Tick lastActivate
Last time activate was called on this thread.
Definition: thread_state.hh:135
gem5::BaseCPU::threadContexts
std::vector< ThreadContext * > threadContexts
Definition: base.hh:262
inform
#define inform(...)
Definition: logging.hh:246
gem5::BaseCPU::takeOverFrom
virtual void takeOverFrom(BaseCPU *cpu)
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:554
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
gem5::SimpleThread::suspend
void suspend() override
Set the status to Suspended.
Definition: simple_thread.cc:142
gem5::curEventQueue
EventQueue * curEventQueue()
Definition: eventq.hh:88
gem5::BaseKvmCPU::startupThread
void startupThread()
Thread-specific initialization.
Definition: base.cc:235
gem5::PosixKvmTimer
Timer based on standard POSIX timers.
Definition: timer.hh:187
gem5::PerfKvmCounterConfig::exclude_hv
PerfKvmCounterConfig & exclude_hv(bool val)
Exclude the hyper visor (i.e., only include events from the guest system).
Definition: perfevent.hh:159
gem5::BaseKvmCPU::vcpuMMapSize
int vcpuMMapSize
Size of MMAPed kvm_run area.
Definition: base.hh:697
gem5::PerfKvmCounter::read
uint64_t read() const
Read the current value of a counter.
Definition: perfevent.cc:138
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
gem5::MemCmd::WriteReq
@ WriteReq
Definition: packet.hh:89
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::BaseCPU::switchOut
virtual void switchOut()
Prepare for another CPU to take over execution.
Definition: base.cc:540
gem5::BaseKvmCPU::dump
virtual void dump() const
Dump the internal state to the terminal.
Definition: base.cc:572
gem5::Kvm
KVM parent interface.
Definition: vm.hh:80
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::ArmISA::id
Bitfield< 33 > id
Definition: misc_types.hh:250
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::PerfKvmCounterConfig::samplePeriod
PerfKvmCounterConfig & samplePeriod(uint64_t period)
Set the initial sample period (overflow count) of an event.
Definition: perfevent.hh:88
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::getRegisters
void getRegisters(struct kvm_regs &regs) const
Get/Set the register state of the guest vCPU.
Definition: base.cc:807
gem5::BaseCPU::dataRequestorId
RequestorID dataRequestorId() const
Reads this CPU's unique data requestor ID.
Definition: base.hh:194
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::PerfKvmCounterConfig
PerfEvent counter configuration.
Definition: perfevent.hh:54
gem5::Clocked::ticksToCycles
Cycles ticksToCycles(Tick t) const
Definition: clocked_object.hh:222
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::EventBase::CPU_Tick_Pri
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
Definition: eventq.hh:204
gem5::BaseKvmCPU::handleKvmExitIRQWindowOpen
virtual Tick handleKvmExitIRQWindowOpen()
The guest exited because an interrupt window was requested.
Definition: base.cc:1046
gem5::BaseMMU::finalizePhysical
Fault finalizePhysical(const RequestPtr &req, ThreadContext *tc, Mode mode) const
Definition: mmu.cc:86
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
fatal_if
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Definition: logging.hh:225
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::onKickSignal
static void onKickSignal(int signo, siginfo_t *si, void *data)
Dummy handler for KVM kick signals.
Definition: base.cc:1196
gem5::PerfKvmCounter::start
void start()
Start counting.
Definition: perfevent.cc:110
gem5::BaseKvmCPU::StatGroup::numHypercalls
statistics::Scalar numHypercalls
Definition: base.hh:806
gem5::SimpleThread::status
Status status() const override
Definition: simple_thread.hh:230
gem5::BaseKvmCPU::setSpecialRegisters
void setSpecialRegisters(const struct kvm_sregs &regs)
Definition: base.cc:828
gem5::BaseKvmCPU::Status
Status
Definition: base.hh:188
gem5::SimpleThread::comInstEventQueue
EventQueue comInstEventQueue
An instruction-based event queue.
Definition: simple_thread.hh:130
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::PerfKvmCounterConfig::disabled
PerfKvmCounterConfig & disabled(bool val)
Don't start the performance counter automatically when attaching it.
Definition: perfevent.hh:113
gem5::ArmISA::sa
Bitfield< 3 > sa
Definition: misc_types.hh:391
gem5::DrainState::Draining
@ Draining
Draining buffers pending serialization/handover.
gem5::BaseKvmCPU::syncKvmState
void syncKvmState()
Update the KVM if the thread context is dirty.
Definition: base.cc:943
gem5::Event::scheduled
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:465
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:242
gem5::SimpleThread::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: simple_thread.cc:116
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:177
gem5::Clocked::clockPeriod
Tick clockPeriod() const
Definition: clocked_object.hh:217
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 7 2021 14:53:43 for gem5 by doxygen 1.8.17