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

Generated on Tue Mar 23 2021 19:41:24 for gem5 by doxygen 1.8.17