gem5  v20.1.0.0
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 "params/KvmVM.hh"
54 #include "sim/system.hh"
55 
56 #define EXPECTED_KVM_API_VERSION 12
57 
58 #if EXPECTED_KVM_API_VERSION != KVM_API_VERSION
59 #error Unsupported KVM version
60 #endif
61 
62 Kvm *Kvm::instance = NULL;
63 
65  : kvmFD(-1), apiVersion(-1), vcpuMMapSize(0)
66 {
67  kvmFD = ::open("/dev/kvm", O_RDWR);
68  if (kvmFD == -1)
69  fatal("KVM: Failed to open /dev/kvm\n");
70 
71  apiVersion = ioctl(KVM_GET_API_VERSION);
73  fatal("KVM: Incompatible API version\n");
74 
75  vcpuMMapSize = ioctl(KVM_GET_VCPU_MMAP_SIZE);
76  if (vcpuMMapSize == -1)
77  panic("KVM: Failed to get virtual CPU MMAP size\n");
78 }
79 
81 {
82  close(kvmFD);
83 }
84 
85 Kvm *
87 {
88  if (!instance)
89  instance = new Kvm();
90 
91  return instance;
92 }
93 
94 bool
96 {
97  return checkExtension(KVM_CAP_USER_MEMORY) != 0;
98 }
99 
100 bool
102 {
103  return checkExtension(KVM_CAP_SET_TSS_ADDR) != 0;
104 }
105 
106 bool
108 {
109  return checkExtension(KVM_CAP_EXT_CPUID) != 0;
110 }
111 
112 bool
114 {
115 #ifdef KVM_CAP_USER_NMI
116  return checkExtension(KVM_CAP_USER_NMI) != 0;
117 #else
118  return false;
119 #endif
120 }
121 
122 int
124 {
125  return checkExtension(KVM_CAP_COALESCED_MMIO);
126 }
127 
128 int
130 {
131 #ifdef KVM_CAP_NR_MEMSLOTS
132  return checkExtension(KVM_CAP_NR_MEMSLOTS);
133 #else
134  return 0;
135 #endif
136 }
137 
138 bool
140 {
141 #ifdef KVM_CAP_ONE_REG
142  return checkExtension(KVM_CAP_ONE_REG) != 0;
143 #else
144  return false;
145 #endif
146 }
147 
148 bool
150 {
151  return checkExtension(KVM_CAP_IRQCHIP) != 0;
152 }
153 
154 bool
156 {
157 #ifdef KVM_CAP_VCPU_EVENTS
158  return checkExtension(KVM_CAP_VCPU_EVENTS) != 0;
159 #else
160  return false;
161 #endif
162 }
163 
164 bool
166 {
167 #ifdef KVM_CAP_DEBUGREGS
168  return checkExtension(KVM_CAP_DEBUGREGS) != 0;
169 #else
170  return false;
171 #endif
172 }
173 
174 bool
176 {
177 #ifdef KVM_CAP_XCRS
178  return checkExtension(KVM_CAP_XCRS) != 0;
179 #else
180  return false;
181 #endif
182 }
183 
184 bool
186 {
187 #ifdef KVM_CAP_XSAVE
188  return checkExtension(KVM_CAP_XSAVE) != 0;
189 #else
190  return false;
191 #endif
192 }
193 
194 
195 #if defined(__i386__) || defined(__x86_64__)
196 bool
197 Kvm::getSupportedCPUID(struct kvm_cpuid2 &cpuid) const
198 {
199  if (ioctl(KVM_GET_SUPPORTED_CPUID, (void *)&cpuid) == -1) {
200  if (errno == E2BIG)
201  return false;
202  else
203  panic("KVM: Failed to get supported CPUID (errno: %i)\n", errno);
204  } else
205  return true;
206 }
207 
208 const Kvm::CPUIDVector &
209 Kvm::getSupportedCPUID() const
210 {
211  if (supportedCPUIDCache.empty()) {
212  std::unique_ptr<struct kvm_cpuid2> cpuid;
213  int i(1);
214  do {
215  cpuid.reset((struct kvm_cpuid2 *)operator new(
216  sizeof(kvm_cpuid2) + i * sizeof(kvm_cpuid_entry2)));
217 
218  cpuid->nent = i;
219  ++i;
220  } while (!getSupportedCPUID(*cpuid));
221  supportedCPUIDCache.assign(cpuid->entries,
222  cpuid->entries + cpuid->nent);
223  }
224 
225  return supportedCPUIDCache;
226 }
227 
228 bool
229 Kvm::getSupportedMSRs(struct kvm_msr_list &msrs) const
230 {
231  if (ioctl(KVM_GET_MSR_INDEX_LIST, (void *)&msrs) == -1) {
232  if (errno == E2BIG)
233  return false;
234  else
235  panic("KVM: Failed to get supported CPUID (errno: %i)\n", errno);
236  } else
237  return true;
238 }
239 
240 const Kvm::MSRIndexVector &
241 Kvm::getSupportedMSRs() const
242 {
243  if (supportedMSRCache.empty()) {
244  std::unique_ptr<struct kvm_msr_list> msrs;
245  int i(0);
246  do {
247  msrs.reset((struct kvm_msr_list *)operator new(
248  sizeof(kvm_msr_list) + i * sizeof(uint32_t)));
249 
250  msrs->nmsrs = i;
251  ++i;
252  } while (!getSupportedMSRs(*msrs));
253  supportedMSRCache.assign(msrs->indices, msrs->indices + msrs->nmsrs);
254  }
255 
256  return supportedMSRCache;
257 }
258 
259 #endif // x86-specific
260 
261 
262 int
263 Kvm::checkExtension(int extension) const
264 {
265  int ret = ioctl(KVM_CHECK_EXTENSION, extension);
266  if (ret == -1)
267  panic("KVM: ioctl failed when checking for extension\n");
268  return ret;
269 }
270 
271 int
272 Kvm::ioctl(int request, long p1) const
273 {
274  assert(kvmFD != -1);
275 
276  return ::ioctl(kvmFD, request, p1);
277 }
278 
279 int
281 {
282  int vmFD;
283 
284  vmFD = ioctl(KVM_CREATE_VM);
285  if (vmFD == -1)
286  panic("Failed to create KVM VM\n");
287 
288  return vmFD;
289 }
290 
291 
292 KvmVM::KvmVM(KvmVMParams *params)
293  : SimObject(params),
294  kvm(new Kvm()), system(nullptr),
295  vmFD(kvm->createVM()),
296  started(false),
297  _hasKernelIRQChip(false),
298  nextVCPUID(0)
299 {
301  /* If we couldn't determine how memory slots there are, guess 32. */
302  if (!maxMemorySlot)
303  maxMemorySlot = 32;
304  /* Setup the coalesced MMIO regions */
305  for (int i = 0; i < params->coalescedMMIO.size(); ++i)
306  coalesceMMIO(params->coalescedMMIO[i]);
307 }
308 
310 {
311  if (vmFD != -1)
312  close(vmFD);
313 
314  if (kvm)
315  delete kvm;
316 }
317 
318 void
320 {
321  if (vmFD != -1) {
322  if (close(vmFD) == -1)
323  warn("kvm VM: notifyFork failed to close vmFD\n");
324 
325  vmFD = -1;
326 
327  delete kvm;
328  kvm = NULL;
329  }
330 }
331 
332 void
334 {
335  if (started)
336  return;
337  started = true;
338 
339  delayedStartup();
340 }
341 
342 void
344 {
345  assert(system); // set by the system during its construction
346  const std::vector<BackingStoreEntry> &memories(
348 
349  DPRINTF(Kvm, "Mapping %i memory region(s)\n", memories.size());
350  for (int slot(0); slot < memories.size(); ++slot) {
351  if (!memories[slot].kvmMap) {
352  DPRINTF(Kvm, "Skipping region marked as not usable by KVM\n");
353  continue;
354  }
355 
356  const AddrRange &range(memories[slot].range);
357  void *pmem(memories[slot].pmem);
358 
359  if (pmem) {
360  DPRINTF(Kvm, "Mapping region: 0x%p -> 0x%llx [size: 0x%llx]\n",
361  pmem, range.start(), range.size());
362 
363  if (range.interleaved()) {
364  panic("Tried to map an interleaved memory range into "
365  "a KVM VM.\n");
366  }
367 
368  const MemSlot slot = allocMemSlot(range.size());
369  setupMemSlot(slot, pmem, range.start(), 0/* flags */);
370  } else {
371  DPRINTF(Kvm, "Zero-region not mapped: [0x%llx]\n", range.start());
372  hack("KVM: Zero memory handled as IO\n");
373  }
374  }
375 }
376 
377 const KvmVM::MemSlot
378 KvmVM::allocMemSlot(uint64_t size)
379 {
380  if (!size)
381  panic("Memory slots must have non-zero size.\n");
382 
384  for (pos = memorySlots.begin(); pos != memorySlots.end(); pos++) {
385  if (!pos->size) {
386  pos->size = size;
387  pos->active = false;
388  return pos->slot;
389  }
390  }
391 
392  uint32_t nextSlot = memorySlots.size();
393  if (nextSlot > maxMemorySlot)
394  panic("Out of memory slots.\n");
395 
396  MemorySlot slot;
397  slot.size = size;
398  slot.slot = nextSlot;
399  slot.active = false;
400 
401  memorySlots.push_back(slot);
402  return MemSlot(slot.slot);
403 }
404 
405 void
406 KvmVM::setupMemSlot(const KvmVM::MemSlot num, void *host_addr, Addr guest,
407  uint32_t flags)
408 {
409  MemorySlot &slot = memorySlots.at(num.num);
410  slot.active = true;
411  setUserMemoryRegion(num.num, host_addr, guest, slot.size, flags);
412 }
413 
414 void
416 {
417  MemorySlot &slot = memorySlots.at(num.num);
418  if (slot.active)
419  setUserMemoryRegion(num.num, NULL, 0, 0, 0);
420  slot.active = false;
421 }
422 
423 void
425 {
426  disableMemSlot(num.num);
427  MemorySlot &slot = memorySlots.at(num.num);
428  slot.size = 0;
429 }
430 
431 void
433  void *host_addr, Addr guest_addr,
434  uint64_t len, uint32_t flags)
435 {
436  struct kvm_userspace_memory_region m;
437 
438  memset(&m, 0, sizeof(m));
439  m.slot = slot;
440  m.flags = flags;
441  m.guest_phys_addr = (uint64_t)guest_addr;
442  m.memory_size = len;
443  m.userspace_addr = (__u64)host_addr;
444 
445  if (ioctl(KVM_SET_USER_MEMORY_REGION, (void *)&m) == -1) {
446  panic("Failed to setup KVM memory region:\n"
447  "\tHost Address: 0x%p\n"
448  "\tGuest Address: 0x%llx\n",
449  "\tSize: %ll\n",
450  "\tFlags: 0x%x\n",
451  m.userspace_addr, m.guest_phys_addr,
452  m.memory_size, m.flags);
453  }
454 }
455 
456 void
458 {
459  coalesceMMIO(range.start(), range.size());
460 }
461 
462 void
463 KvmVM::coalesceMMIO(Addr start, int size)
464 {
465  struct kvm_coalesced_mmio_zone zone;
466 
467  zone.addr = start;
468  zone.size = size;
469  zone.pad = 0;
470 
471  DPRINTF(Kvm, "KVM: Registering coalesced MMIO region [0x%x, 0x%x]\n",
472  zone.addr, zone.addr + zone.size - 1);
473  if (ioctl(KVM_REGISTER_COALESCED_MMIO, (void *)&zone) == -1)
474  panic("KVM: Failed to register coalesced MMIO region (%i)\n",
475  errno);
476 }
477 
478 void
480 {
481  if (ioctl(KVM_SET_TSS_ADDR, (unsigned long)tss_address) == -1)
482  panic("KVM: Failed to set VM TSS address\n");
483 }
484 
485 void
487 {
488  if (_hasKernelIRQChip)
489  panic("KvmVM::createIRQChip called twice.\n");
490 
491  if (ioctl(KVM_CREATE_IRQCHIP) != -1) {
492  _hasKernelIRQChip = true;
493  } else {
494  warn("KVM: Failed to create in-kernel IRQ chip (errno: %i)\n",
495  errno);
496  _hasKernelIRQChip = false;
497  }
498 }
499 
500 void
501 KvmVM::setIRQLine(uint32_t irq, bool high)
502 {
503  struct kvm_irq_level kvm_level;
504 
505  kvm_level.irq = irq;
506  kvm_level.level = high ? 1 : 0;
507 
508  if (ioctl(KVM_IRQ_LINE, &kvm_level) == -1)
509  panic("KVM: Failed to set IRQ line level (errno: %i)\n",
510  errno);
511 }
512 
513 int
514 KvmVM::createDevice(uint32_t type, uint32_t flags)
515 {
516 #if defined(KVM_CREATE_DEVICE)
517  struct kvm_create_device dev = { type, 0, flags };
518 
519  if (ioctl(KVM_CREATE_DEVICE, &dev) == -1) {
520  panic("KVM: Failed to create device (errno: %i)\n",
521  errno);
522  }
523 
524  return dev.fd;
525 #else
526  panic("Kernel headers don't support KVM_CREATE_DEVICE\n");
527 #endif
528 }
529 
530 void
532 {
533  panic_if(system != nullptr, "setSystem() can only be called once");
534  panic_if(s == nullptr, "setSystem() called with null System*");
535  system = s;
536 }
537 
538 long
540 {
541  assert(system != nullptr);
542  return dynamic_cast<BaseKvmCPU*>
543  (system->threads[ctx]->getCpuPtr())->getVCpuID();
544 }
545 
546 int
547 KvmVM::createVCPU(long vcpuID)
548 {
549  int fd;
550 
551  fd = ioctl(KVM_CREATE_VCPU, vcpuID);
552  if (fd == -1)
553  panic("KVM: Failed to create virtual CPU");
554 
555  return fd;
556 }
557 
558 long
560 {
561  return nextVCPUID++;
562 }
563 
564 #if defined(__aarch64__)
565 void
566 KvmVM::kvmArmPreferredTarget(struct kvm_vcpu_init &target) const
567 {
568  if (ioctl(KVM_ARM_PREFERRED_TARGET, &target) == -1) {
569  panic("KVM: Failed to get ARM preferred CPU target (errno: %i)\n",
570  errno);
571  }
572 }
573 #endif
574 
575 int
576 KvmVM::ioctl(int request, long p1) const
577 {
578  assert(vmFD != -1);
579 
580  return ::ioctl(vmFD, request, p1);
581 }
582 
583 
584 KvmVM *
585 KvmVMParams::create()
586 {
587  static bool created = false;
588  if (created)
589  warn_once("Use of multiple KvmVMs is currently untested!\n");
590 
591  created = true;
592 
593  return new KvmVM(this);
594 }
KvmVM::kvm
Kvm * kvm
Global KVM interface.
Definition: vm.hh:409
KvmVM
KVM VM container.
Definition: vm.hh:289
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
Kvm::instance
static Kvm * instance
Singleton instance.
Definition: vm.hh:260
Kvm
KVM parent interface.
Definition: vm.hh:72
warn
#define warn(...)
Definition: logging.hh:239
Kvm::capUserMemory
bool capUserMemory() const
Support for KvmVM::setUserMemoryRegion()
Definition: vm.cc:95
Kvm::capXCRs
bool capXCRs() const
Support for getting and setting the x86 XCRs.
Definition: vm.cc:175
system.hh
MipsISA::cpuid
Bitfield< 28, 21 > cpuid
Definition: dt_constants.hh:92
KvmVM::MemSlot
Definition: vm.hh:363
KvmVM::MemorySlot::size
uint64_t size
Definition: vm.hh:544
warn_once
#define warn_once(...)
Definition: logging.hh:243
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
AddrRange::interleaved
bool interleaved() const
Determine if the range is interleaved or not.
Definition: addr_range.hh:257
Kvm::capNumMemSlots
int capNumMemSlots() const
Attempt to determine how many memory slots are available.
Definition: vm.cc:129
KvmVM::_hasKernelIRQChip
bool _hasKernelIRQChip
Do we have in-kernel IRQ-chip emulation enabled?
Definition: vm.hh:533
ContextID
int ContextID
Globally unique thread context ID.
Definition: types.hh:231
KvmVM::freeMemSlot
void freeMemSlot(const MemSlot slot)
Free a previously allocated memory slot.
Definition: vm.cc:424
KvmVM::system
System * system
Definition: vm.hh:524
ArmISA::fd
Bitfield< 14, 12 > fd
Definition: types.hh:159
PhysicalMemory::getBackingStore
std::vector< BackingStoreEntry > getBackingStore() const
Get the pointers to the backing store for external host access.
Definition: physical.hh:215
type
uint8_t type
Definition: inet.hh:421
KvmVM::maxMemorySlot
uint32_t maxMemorySlot
Definition: vm.hh:549
KvmVM::allocMemSlot
const MemSlot allocMemSlot(uint64_t size)
Allocate a memory slot within the VM.
Definition: vm.cc:378
Kvm::capDebugRegs
bool capDebugRegs() const
Support for getting and setting the kvm_debugregs structure.
Definition: vm.cc:165
KvmVM::delayedStartup
void delayedStartup()
Delayed initialization, executed once before the first CPU starts.
Definition: vm.cc:343
KvmVM::~KvmVM
virtual ~KvmVM()
Definition: vm.cc:309
std::vector< BackingStoreEntry >
Kvm::checkExtension
int checkExtension(int extension) const
Check for the presence of an extension to the KVM API.
Definition: vm.cc:263
KvmVM::contextIdToVCpuId
long contextIdToVCpuId(ContextID ctx) const
Get the VCPUID for a given context.
Definition: vm.cc:539
hack
#define hack(...)
Definition: logging.hh:241
KvmVM::cpuStartup
void cpuStartup()
VM CPU initialization code.
Definition: vm.cc:333
System::getPhysMem
PhysicalMemory & getPhysMem()
Get a pointer to access the physical memory of the system.
Definition: system.hh:342
Kvm::capSetTSSAddress
bool capSetTSSAddress() const
Support for KvmVM::setTSSAddress()
Definition: vm.cc:101
KvmVM::MemorySlot
Structures tracking memory slots.
Definition: vm.hh:541
KvmVM::MemorySlot::slot
uint32_t slot
Definition: vm.hh:545
KvmVM::KvmVM
KvmVM(KvmVMParams *params)
Definition: vm.cc:292
X86ISA::system
Bitfield< 15 > system
Definition: misc.hh:997
Kvm::vcpuMMapSize
int vcpuMMapSize
Size of the MMAPed vCPU parameter area.
Definition: vm.hh:257
Kvm::Kvm
Kvm()
Definition: vm.cc:64
KvmVM::nextVCPUID
long nextVCPUID
Next unallocated vCPU ID.
Definition: vm.hh:536
Kvm::~Kvm
virtual ~Kvm()
Definition: vm.cc:80
KvmVM::createVCPU
int createVCPU(long vcpuID)
Create a new vCPU within a VM.
Definition: vm.cc:547
KvmVM::coalesceMMIO
void coalesceMMIO(Addr start, int size)
Request coalescing MMIO for a memory range.
Definition: vm.cc:463
BaseKvmCPU
Base class for KVM based CPU models.
Definition: base.hh:77
Kvm::ioctl
int ioctl(int request, long p1) const
Main VM ioctl interface.
Definition: vm.cc:272
Kvm::capOneReg
bool capOneReg() const
Support for reading and writing single registers.
Definition: vm.cc:139
AddrRange
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:68
System
Definition: system.hh:73
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:234
KvmVM::MemorySlot::active
bool active
Definition: vm.hh:546
Kvm::kvmFD
int kvmFD
KVM VM file descriptor.
Definition: vm.hh:253
KvmVM::MemSlot::num
int32_t num
Definition: vm.hh:370
KvmVM::setSystem
void setSystem(System *s)
Initialize system pointer.
Definition: vm.cc:531
KvmVM::createDevice
int createDevice(uint32_t type, uint32_t flags=0)
Create an in-kernel device model.
Definition: vm.cc:514
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:432
Kvm::apiVersion
int apiVersion
KVM API version.
Definition: vm.hh:255
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:123
Kvm::create
Kvm * create()
Definition: vm.cc:86
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SimObject::params
const Params * params() const
Definition: sim_object.hh:119
base.hh
Kvm::createVM
int createVM()
Create a KVM Virtual Machine.
Definition: vm.cc:280
vm.hh
KvmVM::createIRQChip
void createIRQChip()
Create an in-kernel interrupt controller.
Definition: vm.cc:486
ArmISA::irq
Bitfield< 1 > irq
Definition: miscregs_types.hh:327
KvmVM::started
bool started
Has delayedStartup() already been called?
Definition: vm.hh:530
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:197
System::threads
Threads threads
Definition: system.hh:309
Kvm::capUserNMI
bool capUserNMI() const
Support for BaseKvmCPU::kvmNonMaskableInterrupt().
Definition: vm.cc:113
AddrRange::start
Addr start() const
Get the start address of the range.
Definition: addr_range.hh:314
KvmVM::disableMemSlot
void disableMemSlot(const MemSlot slot)
Disable a memory slot.
Definition: vm.cc:415
KvmVM::setIRQLine
void setIRQLine(uint32_t irq, bool high)
Set the status of an IRQ line using KVM_IRQ_LINE.
Definition: vm.cc:501
ArmISA::len
Bitfield< 18, 16 > len
Definition: miscregs_types.hh:439
KvmVM::vmFD
int vmFD
KVM VM file descriptor.
Definition: vm.hh:527
KvmVM::setTSSAddress
void setTSSAddress(Addr tss_address)
Setup a shared three-page memory region used by the internals of KVM.
Definition: vm.cc:479
KvmVM::ioctl
int ioctl(int request, long p1) const
KVM VM ioctl interface.
Definition: vm.cc:576
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:406
ArmISA::s
Bitfield< 4 > s
Definition: miscregs_types.hh:556
Kvm::capXSave
bool capXSave() const
Support for getting and setting the kvm_xsave structure.
Definition: vm.cc:185
Kvm::capExtendedCPUID
bool capExtendedCPUID() const
Support for BaseKvmCPU::setCPUID2 and getSupportedCPUID().
Definition: vm.cc:107
AddrRange::size
Addr size() const
Get the size of the address range.
Definition: addr_range.hh:297
KvmVM::allocVCPUID
long allocVCPUID()
Allocate a new vCPU ID within the VM.
Definition: vm.cc:559
EXPECTED_KVM_API_VERSION
#define EXPECTED_KVM_API_VERSION
Definition: vm.cc:56
KvmVM::memorySlots
std::vector< MemorySlot > memorySlots
Definition: vm.hh:548
KvmVM::notifyFork
void notifyFork()
Notify a child process of a fork.
Definition: vm.cc:319
ArmISA::m
Bitfield< 0 > m
Definition: miscregs_types.hh:389
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
Kvm::capIRQChip
bool capIRQChip() const
Support for creating an in-kernel IRQ chip model.
Definition: vm.cc:149
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92
Kvm::capVCPUEvents
bool capVCPUEvents() const
Support for getting and setting the kvm_vcpu_events structure.
Definition: vm.cc:155

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