41 #ifndef __CPU_KVM_KVMVM_HH__
42 #define __CPU_KVM_KVMVM_HH__
144 #if defined(__i386__) || defined(__x86_64__)
161 bool getSupportedCPUID(
struct kvm_cpuid2 &
cpuid)
const;
173 const CPUIDVector &getSupportedCPUID()
const;
180 bool getSupportedMSRs(
struct kvm_msr_list &msrs)
const;
190 const MSRIndexVector &getSupportedMSRs()
const;
194 mutable CPUIDVector supportedCPUIDCache;
197 mutable MSRIndexVector supportedMSRCache;
229 int ioctl(
int request,
long p1)
const;
230 int ioctl(
int request,
void *p1)
const {
231 return ioctl(request, (
long)p1);
234 return ioctl(request, 0
L);
414 #if defined(__aarch64__)
427 void kvmArmPreferredTarget(
struct kvm_vcpu_init &target)
const;
467 void *host_addr,
Addr guest_addr,
468 uint64_t
len, uint32_t flags);
502 int ioctl(
int request,
long p1)
const;
503 int ioctl(
int request,
void *p1)
const {
504 return ioctl(request, (
long)p1);
507 return ioctl(request, 0
L);
bool capDebugRegs() const
Support for getting and setting the kvm_debugregs structure.
int kvmFD
KVM VM file descriptor.
bool capUserMemory() const
Support for KvmVM::setUserMemoryRegion()
int vcpuMMapSize
Size of the MMAPed vCPU parameter area.
void createIRQChip()
Create an in-kernel interrupt controller.
void cpuStartup()
VM CPU initialization code.
int apiVersion
KVM API version.
long allocVCPUID()
Allocate a new vCPU ID within the VM.
long contextIdToVCpuId(ContextID ctx) const
Get the VCPUID for a given context.
const Params * params() const
std::vector< MemorySlot > memorySlots
static Kvm * instance
Singleton instance.
int ioctl(int request) const
long nextVCPUID
Next unallocated vCPU ID.
int createVCPU(long vcpuID)
Create a new vCPU within a VM.
Base class for KVM based CPU models.
int ioctl(int request, void *p1) const
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.
bool _hasKernelIRQChip
Do we have in-kernel IRQ-chip emulation enabled?
bool capXCRs() const
Support for getting and setting the x86 XCRs.
bool hasKernelIRQChip() const
Is in-kernel IRQ chip emulation enabled?
bool capOneReg() const
Support for reading and writing single registers.
void setIRQLine(uint32_t irq, bool high)
Set the status of an IRQ line using KVM_IRQ_LINE.
int checkExtension(int extension) const
Check for the presence of an extension to the KVM API.
int capNumMemSlots() const
Attempt to determine how many memory slots are available.
void setSystem(System *s)
Initialize system pointer.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
void freeMemSlot(const MemSlot slot)
Free a previously allocated memory slot.
bool started
Has delayedStartup() already been called?
void delayedStartup()
Delayed initialization, executed once before the first CPU starts.
bool capSetTSSAddress() const
Support for KvmVM::setTSSAddress()
void coalesceMMIO(Addr start, int size)
Request coalescing MMIO for a memory range.
void setTSSAddress(Addr tss_address)
Setup a shared three-page memory region used by the internals of KVM.
int createVM()
Create a KVM Virtual Machine.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Structures tracking memory slots.
void setupMemSlot(const MemSlot slot, void *host_addr, Addr guest_addr, uint32_t flags)
Setup a region of physical memory in the guest.
KvmVM(KvmVMParams *params)
int getAPIVersion() const
Get the version of the KVM API implemented by the kernel.
int ioctl(int request, void *p1) const
int vmFD
KVM VM file descriptor.
KvmVM & operator=(const KvmVM &vm)
int createDevice(uint32_t type, uint32_t flags=0)
Create an in-kernel device model.
bool capUserNMI() const
Support for BaseKvmCPU::kvmNonMaskableInterrupt().
bool capVCPUEvents() const
Support for getting and setting the kvm_vcpu_events structure.
bool capXSave() const
Support for getting and setting the kvm_xsave structure.
Kvm & operator=(const Kvm &kvm)
int capCoalescedMMIO() const
Check if coalesced MMIO is supported and which page in the MMAP'ed structure it stores requests in...
int ioctl(int request, long p1) const
KVM VM ioctl interface.
void notifyFork()
Notify a child process of a fork.
Kvm * kvm
Global KVM interface.
bool capIRQChip() const
Support for creating an in-kernel IRQ chip model.
int ioctl(int request, long p1) const
Main VM ioctl interface.
int getVCPUMMapSize() const
Get the size of the MMAPed parameter area used to communicate vCPU parameters between the kernel and ...
void disableMemSlot(const MemSlot slot)
Disable a memory slot.
const MemSlot allocMemSlot(uint64_t size)
Allocate a memory slot within the VM.
Abstract superclass for simulation objects.
int ContextID
Globally unique thread context ID.
bool capExtendedCPUID() const
Support for BaseKvmCPU::setCPUID2 and getSupportedCPUID().
int ioctl(int request) const