gem5  v21.1.0.2
vm.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Google, Inc.
3  * Copyright (c) 2012, 2015 ARM Limited
4  * All rights reserved
5  *
6  * The license below extends only to copyright in the software and shall
7  * not be construed as granting a license to any other intellectual
8  * property including but not limited to intellectual property relating
9  * to a hardware implementation of the functionality of the software
10  * licensed hereunder. You may use the software subject to the license
11  * terms below provided that you ensure that this notice is replicated
12  * unmodified and in its entirety in all distributions of the software,
13  * modified or unmodified, in source code or in binary form.
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions are
17  * met: redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer;
19  * redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution;
22  * neither the name of the copyright holders nor the names of its
23  * contributors may be used to endorse or promote products derived from
24  * this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #include "cpu/kvm/vm.hh"
40 
41 #include <fcntl.h>
42 #include <linux/kvm.h>
43 #include <sys/ioctl.h>
44 #include <sys/stat.h>
45 #include <sys/types.h>
46 #include <unistd.h>
47 
48 #include <cerrno>
49 #include <memory>
50 
51 #include "cpu/kvm/base.hh"
52 #include "debug/Kvm.hh"
53 #include "mem/physical.hh"
54 #include "params/KvmVM.hh"
55 #include "sim/system.hh"
56 
57 namespace gem5
58 {
59 
60 namespace
61 {
62 
63 constexpr int ExpectedKvmApiVersion = 12;
64 static_assert(KVM_API_VERSION == ExpectedKvmApiVersion,
65  "Unsupported KVM version");
66 
67 } // anonymous namespace
68 
69 Kvm *Kvm::instance = NULL;
70 
72  : kvmFD(-1), apiVersion(-1), vcpuMMapSize(0)
73 {
74  static bool created = false;
75  if (created)
76  warn_once("Use of multiple KvmVMs is currently untested!");
77 
78  created = true;
79 
80  kvmFD = ::open("/dev/kvm", O_RDWR);
81  if (kvmFD == -1)
82  fatal("KVM: Failed to open /dev/kvm\n");
83 
84  apiVersion = ioctl(KVM_GET_API_VERSION);
85  if (apiVersion != ExpectedKvmApiVersion)
86  fatal("KVM: Incompatible API version\n");
87 
88  vcpuMMapSize = ioctl(KVM_GET_VCPU_MMAP_SIZE);
89  if (vcpuMMapSize == -1)
90  panic("KVM: Failed to get virtual CPU MMAP size\n");
91 }
92 
94 {
95  close(kvmFD);
96 }
97 
98 Kvm *
100 {
101  if (!instance)
102  instance = new Kvm();
103 
104  return instance;
105 }
106 
107 bool
109 {
110  return checkExtension(KVM_CAP_USER_MEMORY) != 0;
111 }
112 
113 bool
115 {
116  return checkExtension(KVM_CAP_SET_TSS_ADDR) != 0;
117 }
118 
119 bool
121 {
122  return checkExtension(KVM_CAP_EXT_CPUID) != 0;
123 }
124 
125 bool
127 {
128 #ifdef KVM_CAP_USER_NMI
129  return checkExtension(KVM_CAP_USER_NMI) != 0;
130 #else
131  return false;
132 #endif
133 }
134 
135 int
137 {
138  return checkExtension(KVM_CAP_COALESCED_MMIO);
139 }
140 
141 int
143 {
144 #ifdef KVM_CAP_NR_MEMSLOTS
145  return checkExtension(KVM_CAP_NR_MEMSLOTS);
146 #else
147  return 0;
148 #endif
149 }
150 
151 bool
153 {
154 #ifdef KVM_CAP_ONE_REG
155  return checkExtension(KVM_CAP_ONE_REG) != 0;
156 #else
157  return false;
158 #endif
159 }
160 
161 bool
163 {
164  return checkExtension(KVM_CAP_IRQCHIP) != 0;
165 }
166 
167 bool
169 {
170 #ifdef KVM_CAP_VCPU_EVENTS
171  return checkExtension(KVM_CAP_VCPU_EVENTS) != 0;
172 #else
173  return false;
174 #endif
175 }
176 
177 bool
179 {
180 #ifdef KVM_CAP_DEBUGREGS
181  return checkExtension(KVM_CAP_DEBUGREGS) != 0;
182 #else
183  return false;
184 #endif
185 }
186 
187 bool
189 {
190 #ifdef KVM_CAP_XCRS
191  return checkExtension(KVM_CAP_XCRS) != 0;
192 #else
193  return false;
194 #endif
195 }
196 
197 bool
199 {
200 #ifdef KVM_CAP_XSAVE
201  return checkExtension(KVM_CAP_XSAVE) != 0;
202 #else
203  return false;
204 #endif
205 }
206 
207 
208 #if defined(__i386__) || defined(__x86_64__)
209 bool
210 Kvm::getSupportedCPUID(struct kvm_cpuid2 &cpuid) const
211 {
212  if (ioctl(KVM_GET_SUPPORTED_CPUID, (void *)&cpuid) == -1) {
213  if (errno == E2BIG)
214  return false;
215  else
216  panic("KVM: Failed to get supported CPUID (errno: %i)\n", errno);
217  } else
218  return true;
219 }
220 
221 const Kvm::CPUIDVector &
222 Kvm::getSupportedCPUID() const
223 {
224  if (supportedCPUIDCache.empty()) {
225  std::unique_ptr<struct kvm_cpuid2> cpuid;
226  int i(1);
227  do {
228  cpuid.reset((struct kvm_cpuid2 *)operator new(
229  sizeof(kvm_cpuid2) + i * sizeof(kvm_cpuid_entry2)));
230 
231  cpuid->nent = i;
232  ++i;
233  } while (!getSupportedCPUID(*cpuid));
234  supportedCPUIDCache.assign(cpuid->entries,
235  cpuid->entries + cpuid->nent);
236  }
237 
238  return supportedCPUIDCache;
239 }
240 
241 bool
242 Kvm::getSupportedMSRs(struct kvm_msr_list &msrs) const
243 {
244  if (ioctl(KVM_GET_MSR_INDEX_LIST, (void *)&msrs) == -1) {
245  if (errno == E2BIG)
246  return false;
247  else
248  panic("KVM: Failed to get supported CPUID (errno: %i)\n", errno);
249  } else
250  return true;
251 }
252 
253 const Kvm::MSRIndexVector &
254 Kvm::getSupportedMSRs() const
255 {
256  if (supportedMSRCache.empty()) {
257  std::unique_ptr<struct kvm_msr_list> msrs;
258  int i(0);
259  do {
260  msrs.reset((struct kvm_msr_list *)operator new(
261  sizeof(kvm_msr_list) + i * sizeof(uint32_t)));
262 
263  msrs->nmsrs = i;
264  ++i;
265  } while (!getSupportedMSRs(*msrs));
266  supportedMSRCache.assign(msrs->indices, msrs->indices + msrs->nmsrs);
267  }
268 
269  return supportedMSRCache;
270 }
271 
272 #endif // x86-specific
273 
274 
275 int
276 Kvm::checkExtension(int extension) const
277 {
278  int ret = ioctl(KVM_CHECK_EXTENSION, extension);
279  if (ret == -1)
280  panic("KVM: ioctl failed when checking for extension\n");
281  return ret;
282 }
283 
284 int
285 Kvm::ioctl(int request, long p1) const
286 {
287  assert(kvmFD != -1);
288 
289  return ::ioctl(kvmFD, request, p1);
290 }
291 
292 int
294 {
295  int vmFD;
296 
297  vmFD = ioctl(KVM_CREATE_VM);
298  if (vmFD == -1)
299  panic("Failed to create KVM VM\n");
300 
301  return vmFD;
302 }
303 
304 
305 KvmVM::KvmVM(const KvmVMParams &params)
306  : SimObject(params),
307  kvm(new Kvm()), system(nullptr),
308  vmFD(kvm->createVM()),
309  started(false),
310  _hasKernelIRQChip(false),
311  nextVCPUID(0)
312 {
314  /* If we couldn't determine how memory slots there are, guess 32. */
315  if (!maxMemorySlot)
316  maxMemorySlot = 32;
317  /* Setup the coalesced MMIO regions */
318  for (int i = 0; i < params.coalescedMMIO.size(); ++i)
319  coalesceMMIO(params.coalescedMMIO[i]);
320 }
321 
323 {
324  if (vmFD != -1)
325  close(vmFD);
326 
327  if (kvm)
328  delete kvm;
329 }
330 
331 void
333 {
334  if (vmFD != -1) {
335  if (close(vmFD) == -1)
336  warn("kvm VM: notifyFork failed to close vmFD\n");
337 
338  vmFD = -1;
339 
340  delete kvm;
341  kvm = NULL;
342  }
343 }
344 
345 void
347 {
348  if (started)
349  return;
350  started = true;
351 
352  delayedStartup();
353 }
354 
355 void
357 {
358  assert(system); // set by the system during its construction
361 
362  DPRINTF(Kvm, "Mapping %i memory region(s)\n", memories.size());
363  for (int slot(0); slot < memories.size(); ++slot) {
364  if (!memories[slot].kvmMap) {
365  DPRINTF(Kvm, "Skipping region marked as not usable by KVM\n");
366  continue;
367  }
368 
369  const AddrRange &range(memories[slot].range);
370  void *pmem(memories[slot].pmem);
371 
372  if (pmem) {
373  DPRINTF(Kvm, "Mapping region: 0x%p -> 0x%llx [size: 0x%llx]\n",
374  pmem, range.start(), range.size());
375 
376  if (range.interleaved()) {
377  panic("Tried to map an interleaved memory range into "
378  "a KVM VM.\n");
379  }
380 
381  const MemSlot slot = allocMemSlot(range.size());
382  setupMemSlot(slot, pmem, range.start(), 0/* flags */);
383  } else {
384  DPRINTF(Kvm, "Zero-region not mapped: [0x%llx]\n", range.start());
385  hack("KVM: Zero memory handled as IO\n");
386  }
387  }
388 }
389 
390 const KvmVM::MemSlot
391 KvmVM::allocMemSlot(uint64_t size)
392 {
393  if (!size)
394  panic("Memory slots must have non-zero size.\n");
395 
397  for (pos = memorySlots.begin(); pos != memorySlots.end(); pos++) {
398  if (!pos->size) {
399  pos->size = size;
400  pos->active = false;
401  return pos->slot;
402  }
403  }
404 
405  uint32_t nextSlot = memorySlots.size();
406  if (nextSlot > maxMemorySlot)
407  panic("Out of memory slots.\n");
408 
409  MemorySlot slot;
410  slot.size = size;
411  slot.slot = nextSlot;
412  slot.active = false;
413 
414  memorySlots.push_back(slot);
415  return MemSlot(slot.slot);
416 }
417 
418 void
419 KvmVM::setupMemSlot(const KvmVM::MemSlot num, void *host_addr, Addr guest,
420  uint32_t flags)
421 {
422  MemorySlot &slot = memorySlots.at(num.num);
423  slot.active = true;
424  setUserMemoryRegion(num.num, host_addr, guest, slot.size, flags);
425 }
426 
427 void
429 {
430  MemorySlot &slot = memorySlots.at(num.num);
431  if (slot.active)
432  setUserMemoryRegion(num.num, NULL, 0, 0, 0);
433  slot.active = false;
434 }
435 
436 void
438 {
439  disableMemSlot(num.num);
440  MemorySlot &slot = memorySlots.at(num.num);
441  slot.size = 0;
442 }
443 
444 void
446  void *host_addr, Addr guest_addr,
447  uint64_t len, uint32_t flags)
448 {
449  struct kvm_userspace_memory_region m;
450 
451  memset(&m, 0, sizeof(m));
452  m.slot = slot;
453  m.flags = flags;
454  m.guest_phys_addr = (uint64_t)guest_addr;
455  m.memory_size = len;
456  m.userspace_addr = (__u64)host_addr;
457 
458  if (ioctl(KVM_SET_USER_MEMORY_REGION, (void *)&m) == -1) {
459  panic("Failed to setup KVM memory region:\n"
460  "\tHost Address: 0x%p\n"
461  "\tGuest Address: 0x%llx\n",
462  "\tSize: %ll\n",
463  "\tFlags: 0x%x\n",
464  m.userspace_addr, m.guest_phys_addr,
465  m.memory_size, m.flags);
466  }
467 }
468 
469 void
471 {
472  coalesceMMIO(range.start(), range.size());
473 }
474 
475 void
476 KvmVM::coalesceMMIO(Addr start, int size)
477 {
478  struct kvm_coalesced_mmio_zone zone;
479 
480  zone.addr = start;
481  zone.size = size;
482  zone.pad = 0;
483 
484  DPRINTF(Kvm, "KVM: Registering coalesced MMIO region [0x%x, 0x%x]\n",
485  zone.addr, zone.addr + zone.size - 1);
486  if (ioctl(KVM_REGISTER_COALESCED_MMIO, (void *)&zone) == -1)
487  panic("KVM: Failed to register coalesced MMIO region (%i)\n",
488  errno);
489 }
490 
491 void
493 {
494  if (ioctl(KVM_SET_TSS_ADDR, (unsigned long)tss_address) == -1)
495  panic("KVM: Failed to set VM TSS address\n");
496 }
497 
498 void
500 {
501  if (_hasKernelIRQChip)
502  panic("KvmVM::createIRQChip called twice.\n");
503 
504  if (ioctl(KVM_CREATE_IRQCHIP) != -1) {
505  _hasKernelIRQChip = true;
506  } else {
507  warn("KVM: Failed to create in-kernel IRQ chip (errno: %i)\n",
508  errno);
509  _hasKernelIRQChip = false;
510  }
511 }
512 
513 void
514 KvmVM::setIRQLine(uint32_t irq, bool high)
515 {
516  struct kvm_irq_level kvm_level;
517 
518  kvm_level.irq = irq;
519  kvm_level.level = high ? 1 : 0;
520 
521  if (ioctl(KVM_IRQ_LINE, &kvm_level) == -1)
522  panic("KVM: Failed to set IRQ line level (errno: %i)\n",
523  errno);
524 }
525 
526 int
527 KvmVM::createDevice(uint32_t type, uint32_t flags)
528 {
529 #if defined(KVM_CREATE_DEVICE)
530  struct kvm_create_device dev = { type, 0, flags };
531 
532  if (ioctl(KVM_CREATE_DEVICE, &dev) == -1) {
533  panic("KVM: Failed to create device (errno: %i)\n",
534  errno);
535  }
536 
537  return dev.fd;
538 #else
539  panic("Kernel headers don't support KVM_CREATE_DEVICE\n");
540 #endif
541 }
542 
543 void
545 {
546  panic_if(system != nullptr, "setSystem() can only be called once");
547  panic_if(s == nullptr, "setSystem() called with null System*");
548  system = s;
549 }
550 
551 long
553 {
554  assert(system != nullptr);
555  return dynamic_cast<BaseKvmCPU*>
556  (system->threads[ctx]->getCpuPtr())->getVCpuID();
557 }
558 
559 int
560 KvmVM::createVCPU(long vcpuID)
561 {
562  int fd;
563 
564  fd = ioctl(KVM_CREATE_VCPU, vcpuID);
565  if (fd == -1)
566  panic("KVM: Failed to create virtual CPU");
567 
568  return fd;
569 }
570 
571 long
573 {
574  return nextVCPUID++;
575 }
576 
577 #if defined(__aarch64__)
578 void
579 KvmVM::kvmArmPreferredTarget(struct kvm_vcpu_init &target) const
580 {
581  if (ioctl(KVM_ARM_PREFERRED_TARGET, &target) == -1) {
582  panic("KVM: Failed to get ARM preferred CPU target (errno: %i)\n",
583  errno);
584  }
585 }
586 #endif
587 
588 int
589 KvmVM::ioctl(int request, long p1) const
590 {
591  assert(vmFD != -1);
592 
593  return ::ioctl(vmFD, request, p1);
594 }
595 
596 } // namespace gem5
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:189
gem5::KvmVM::vmFD
int vmFD
KVM VM file descriptor.
Definition: vm.hh:535
gem5::KvmVM::MemorySlot::slot
uint32_t slot
Definition: vm.hh:553
gem5::KvmVM::createVCPU
int createVCPU(long vcpuID)
Create a new vCPU within a VM.
Definition: vm.cc:560
gem5::Kvm::capSetTSSAddress
bool capSetTSSAddress() const
Support for KvmVM::setTSSAddress()
Definition: vm.cc:114
gem5::KvmVM::freeMemSlot
void freeMemSlot(const MemSlot slot)
Free a previously allocated memory slot.
Definition: vm.cc:437
gem5::Kvm::capUserNMI
bool capUserNMI() const
Support for BaseKvmCPU::kvmNonMaskableInterrupt().
Definition: vm.cc:126
gem5::ArmISA::len
Bitfield< 18, 16 > len
Definition: misc_types.hh:444
gem5::memory::PhysicalMemory::getBackingStore
std::vector< BackingStoreEntry > getBackingStore() const
Get the pointers to the backing store for external host access.
Definition: physical.hh:227
gem5::KvmVM::setUserMemoryRegion
void setUserMemoryRegion(uint32_t slot, void *host_addr, Addr guest_addr, uint64_t len, uint32_t flags)
Setup a region of physical memory in the guest.
Definition: vm.cc:445
gem5::Kvm::instance
static Kvm * instance
Singleton instance.
Definition: vm.hh:268
gem5::AddrRange::start
Addr start() const
Get the start address of the range.
Definition: addr_range.hh:317
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
gem5::KvmVM::createIRQChip
void createIRQChip()
Create an in-kernel interrupt controller.
Definition: vm.cc:499
gem5::MipsISA::cpuid
Bitfield< 28, 21 > cpuid
Definition: dt_constants.hh:95
gem5::KvmVM::setTSSAddress
void setTSSAddress(Addr tss_address)
Setup a shared three-page memory region used by the internals of KVM.
Definition: vm.cc:492
gem5::ArmISA::fd
Bitfield< 14, 12 > fd
Definition: types.hh:150
warn_once
#define warn_once(...)
Definition: logging.hh:249
gem5::Kvm::create
Kvm * create()
Definition: vm.cc:99
gem5::KvmVM::allocVCPUID
long allocVCPUID()
Allocate a new vCPU ID within the VM.
Definition: vm.cc:572
gem5::KvmVM::disableMemSlot
void disableMemSlot(const MemSlot slot)
Disable a memory slot.
Definition: vm.cc:428
gem5::KvmVM::setSystem
void setSystem(System *s)
Initialize system pointer.
Definition: vm.cc:544
gem5::KvmVM::maxMemorySlot
uint32_t maxMemorySlot
Definition: vm.hh:557
gem5::X86ISA::system
Bitfield< 15 > system
Definition: misc.hh:1003
gem5::Kvm::capExtendedCPUID
bool capExtendedCPUID() const
Support for BaseKvmCPU::setCPUID2 and getSupportedCPUID().
Definition: vm.cc:120
std::vector
STL vector class.
Definition: stl.hh:37
gem5::KvmVM::ioctl
int ioctl(int request, long p1) const
KVM VM ioctl interface.
Definition: vm.cc:589
gem5::KvmVM::coalesceMMIO
void coalesceMMIO(Addr start, int size)
Request coalescing MMIO for a memory range.
Definition: vm.cc:476
gem5::Kvm::capUserMemory
bool capUserMemory() const
Support for KvmVM::setUserMemoryRegion()
Definition: vm.cc:108
gem5::KvmVM::KvmVM
KvmVM(const KvmVMParams &params)
Definition: vm.cc:305
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:66
gem5::Kvm::capXCRs
bool capXCRs() const
Support for getting and setting the x86 XCRs.
Definition: vm.cc:188
gem5::Kvm::capXSave
bool capXSave() const
Support for getting and setting the kvm_xsave structure.
Definition: vm.cc:198
hack
#define hack(...)
Definition: logging.hh:247
gem5::Kvm::capIRQChip
bool capIRQChip() const
Support for creating an in-kernel IRQ chip model.
Definition: vm.cc:162
gem5::ArmISA::irq
Bitfield< 1 > irq
Definition: misc_types.hh:330
gem5::Kvm::checkExtension
int checkExtension(int extension) const
Check for the presence of an extension to the KVM API.
Definition: vm.cc:276
gem5::high
high
Definition: intmath.hh:176
gem5::System
Definition: system.hh:77
gem5::Kvm::capVCPUEvents
bool capVCPUEvents() const
Support for getting and setting the kvm_vcpu_events structure.
Definition: vm.cc:168
gem5::AddrRange::interleaved
bool interleaved() const
Determine if the range is interleaved or not.
Definition: addr_range.hh:260
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:186
gem5::BaseKvmCPU
Base class for KVM based CPU models.
Definition: base.hh:87
gem5::Kvm::vcpuMMapSize
int vcpuMMapSize
Size of the MMAPed vCPU parameter area.
Definition: vm.hh:265
gem5::KvmVM::system
System * system
Definition: vm.hh:532
gem5::Kvm::Kvm
Kvm()
Definition: vm.cc:71
gem5::KvmVM::_hasKernelIRQChip
bool _hasKernelIRQChip
Do we have in-kernel IRQ-chip emulation enabled?
Definition: vm.hh:541
gem5::X86ISA::type
type
Definition: misc.hh:733
gem5::ArmISA::s
Bitfield< 4 > s
Definition: misc_types.hh:561
gem5::Kvm::kvmFD
int kvmFD
KVM VM file descriptor.
Definition: vm.hh:261
gem5::KvmVM::started
bool started
Has delayedStartup() already been called?
Definition: vm.hh:538
gem5::KvmVM::setIRQLine
void setIRQLine(uint32_t irq, bool high)
Set the status of an IRQ line using KVM_IRQ_LINE.
Definition: vm.cc:514
gem5::AddrRange::size
Addr size() const
Get the size of the address range.
Definition: addr_range.hh:300
gem5::KvmVM::delayedStartup
void delayedStartup()
Delayed initialization, executed once before the first CPU starts.
Definition: vm.cc:356
gem5::Kvm::ioctl
int ioctl(int request, long p1) const
Main VM ioctl interface.
Definition: vm.cc:285
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::KvmVM::MemSlot
Definition: vm.hh:371
gem5::KvmVM::contextIdToVCpuId
long contextIdToVCpuId(ContextID ctx) const
Get the VCPUID for a given context.
Definition: vm.cc:552
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
base.hh
vm.hh
gem5::KvmVM::kvm
Kvm * kvm
Global KVM interface.
Definition: vm.hh:417
gem5::KvmVM::cpuStartup
void cpuStartup()
VM CPU initialization code.
Definition: vm.cc:346
gem5::KvmVM::MemorySlot
Structures tracking memory slots.
Definition: vm.hh:549
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:203
gem5::ArmISA::m
Bitfield< 0 > m
Definition: misc_types.hh:394
gem5::KvmVM::allocMemSlot
const MemSlot allocMemSlot(uint64_t size)
Allocate a memory slot within the VM.
Definition: vm.cc:391
gem5::Kvm::capDebugRegs
bool capDebugRegs() const
Support for getting and setting the kvm_debugregs structure.
Definition: vm.cc:178
gem5::System::threads
Threads threads
Definition: system.hh:316
gem5::KvmVM::nextVCPUID
long nextVCPUID
Next unallocated vCPU ID.
Definition: vm.hh:544
physical.hh
gem5::ContextID
int ContextID
Globally unique thread context ID.
Definition: types.hh:246
gem5::Kvm
KVM parent interface.
Definition: vm.hh:80
gem5::KvmVM::MemorySlot::active
bool active
Definition: vm.hh:554
gem5::KvmVM::MemorySlot::size
uint64_t size
Definition: vm.hh:552
gem5::Kvm::capNumMemSlots
int capNumMemSlots() const
Attempt to determine how many memory slots are available.
Definition: vm.cc:142
gem5::System::getPhysMem
memory::PhysicalMemory & getPhysMem()
Get a pointer to access the physical memory of the system.
Definition: system.hh:348
gem5::Kvm::~Kvm
virtual ~Kvm()
Definition: vm.cc:93
gem5::AddrRange
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:71
gem5::Kvm::apiVersion
int apiVersion
KVM API version.
Definition: vm.hh:263
gem5::KvmVM::MemSlot::num
int32_t num
Definition: vm.hh:378
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::KvmVM::notifyFork
void notifyFork()
Notify a child process of a fork.
Definition: vm.cc:332
gem5::KvmVM::memorySlots
std::vector< MemorySlot > memorySlots
Definition: vm.hh:556
gem5::KvmVM::~KvmVM
virtual ~KvmVM()
Definition: vm.cc:322
gem5::Kvm::capOneReg
bool capOneReg() const
Support for reading and writing single registers.
Definition: vm.cc:152
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:177
gem5::Kvm::createVM
int createVM()
Create a KVM Virtual Machine.
Definition: vm.cc:293
gem5::KvmVM::setupMemSlot
void setupMemSlot(const MemSlot slot, void *host_addr, Addr guest_addr, uint32_t flags)
Setup a region of physical memory in the guest.
Definition: vm.cc:419
gem5::KvmVM::createDevice
int createDevice(uint32_t type, uint32_t flags=0)
Create an in-kernel device model.
Definition: vm.cc:527

Generated on Tue Sep 21 2021 12:25:00 for gem5 by doxygen 1.8.17