gem5  v21.1.0.2
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
gem5::Kvm Class Reference

KVM parent interface. More...

#include <vm.hh>

Public Member Functions

virtual ~Kvm ()
 
Kvmcreate ()
 
int getAPIVersion () const
 Get the version of the KVM API implemented by the kernel. More...
 
int getVCPUMMapSize () const
 Get the size of the MMAPed parameter area used to communicate vCPU parameters between the kernel and userspace. More...
 
bool capUserMemory () const
 Support for KvmVM::setUserMemoryRegion() More...
 
bool capSetTSSAddress () const
 Support for KvmVM::setTSSAddress() More...
 
bool capExtendedCPUID () const
 Support for BaseKvmCPU::setCPUID2 and getSupportedCPUID(). More...
 
bool capUserNMI () const
 Support for BaseKvmCPU::kvmNonMaskableInterrupt(). More...
 
int capCoalescedMMIO () const
 Check if coalesced MMIO is supported and which page in the MMAP'ed structure it stores requests in. More...
 
int capNumMemSlots () const
 Attempt to determine how many memory slots are available. More...
 
bool capOneReg () const
 Support for reading and writing single registers. More...
 
bool capIRQChip () const
 Support for creating an in-kernel IRQ chip model. More...
 
bool capVCPUEvents () const
 Support for getting and setting the kvm_vcpu_events structure. More...
 
bool capDebugRegs () const
 Support for getting and setting the kvm_debugregs structure. More...
 
bool capXCRs () const
 Support for getting and setting the x86 XCRs. More...
 
bool capXSave () const
 Support for getting and setting the kvm_xsave structure. More...
 

Protected Member Functions

int checkExtension (int extension) const
 Check for the presence of an extension to the KVM API. More...
 
int ioctl (int request, long p1) const
 Main VM ioctl interface. More...
 
int ioctl (int request, void *p1) const
 
int ioctl (int request) const
 

Private Member Functions

 Kvm ()
 
 Kvm (const Kvm &kvm)
 
Kvmoperator= (const Kvm &kvm)
 
int createVM ()
 Create a KVM Virtual Machine. More...
 

Private Attributes

int kvmFD
 KVM VM file descriptor. More...
 
int apiVersion
 KVM API version. More...
 
int vcpuMMapSize
 Size of the MMAPed vCPU parameter area. More...
 

Static Private Attributes

static Kvminstance = NULL
 Singleton instance. More...
 

Friends

class KvmVM
 

Detailed Description

KVM parent interface.

The main Kvm object is used to provide functionality that is not specific to a VM or CPU. For example, it allows checking of the optional features and creation of VM containers.

Definition at line 80 of file vm.hh.

Constructor & Destructor Documentation

◆ ~Kvm()

gem5::Kvm::~Kvm ( )
virtual

Definition at line 93 of file vm.cc.

References kvmFD.

◆ Kvm() [1/2]

gem5::Kvm::Kvm ( )
private

Definition at line 71 of file vm.cc.

References apiVersion, fatal, ioctl(), kvmFD, panic, vcpuMMapSize, and warn_once.

Referenced by create().

◆ Kvm() [2/2]

gem5::Kvm::Kvm ( const Kvm kvm)
private

Member Function Documentation

◆ capCoalescedMMIO()

int gem5::Kvm::capCoalescedMMIO ( ) const

Check if coalesced MMIO is supported and which page in the MMAP'ed structure it stores requests in.

Returns
Offset (in pages) into the mmap'ed vCPU area where the MMIO buffer is stored. 0 if unsupported.

Definition at line 136 of file vm.cc.

References checkExtension().

Referenced by gem5::BaseKvmCPU::startup().

◆ capDebugRegs()

bool gem5::Kvm::capDebugRegs ( ) const

Support for getting and setting the kvm_debugregs structure.

Definition at line 178 of file vm.cc.

References checkExtension().

Referenced by gem5::X86KvmCPU::X86KvmCPU().

◆ capExtendedCPUID()

bool gem5::Kvm::capExtendedCPUID ( ) const

Support for BaseKvmCPU::setCPUID2 and getSupportedCPUID().

Definition at line 120 of file vm.cc.

References checkExtension().

Referenced by gem5::X86KvmCPU::X86KvmCPU().

◆ capIRQChip()

bool gem5::Kvm::capIRQChip ( ) const

Support for creating an in-kernel IRQ chip model.

See also
KvmVM::createIRQChip()

Definition at line 162 of file vm.cc.

References checkExtension().

◆ capNumMemSlots()

int gem5::Kvm::capNumMemSlots ( ) const

Attempt to determine how many memory slots are available.

If it can't be determined, this function returns 0.

Definition at line 142 of file vm.cc.

References checkExtension().

Referenced by gem5::KvmVM::KvmVM().

◆ capOneReg()

bool gem5::Kvm::capOneReg ( ) const

Support for reading and writing single registers.

See also
BaseKvmCPU::getOneReg(), and BaseKvmCPU::setOneReg()

Definition at line 152 of file vm.cc.

References checkExtension().

◆ capSetTSSAddress()

bool gem5::Kvm::capSetTSSAddress ( ) const

Support for KvmVM::setTSSAddress()

Definition at line 114 of file vm.cc.

References checkExtension().

Referenced by gem5::X86KvmCPU::X86KvmCPU().

◆ capUserMemory()

bool gem5::Kvm::capUserMemory ( ) const

Support for KvmVM::setUserMemoryRegion()

Definition at line 108 of file vm.cc.

References checkExtension().

◆ capUserNMI()

bool gem5::Kvm::capUserNMI ( ) const

Support for BaseKvmCPU::kvmNonMaskableInterrupt().

Definition at line 126 of file vm.cc.

References checkExtension().

Referenced by gem5::X86KvmCPU::X86KvmCPU().

◆ capVCPUEvents()

bool gem5::Kvm::capVCPUEvents ( ) const

Support for getting and setting the kvm_vcpu_events structure.

Definition at line 168 of file vm.cc.

References checkExtension().

Referenced by gem5::X86KvmCPU::X86KvmCPU().

◆ capXCRs()

bool gem5::Kvm::capXCRs ( ) const

Support for getting and setting the x86 XCRs.

Definition at line 188 of file vm.cc.

References checkExtension().

Referenced by gem5::X86KvmCPU::X86KvmCPU().

◆ capXSave()

bool gem5::Kvm::capXSave ( ) const

Support for getting and setting the kvm_xsave structure.

Definition at line 198 of file vm.cc.

References checkExtension().

Referenced by gem5::X86KvmCPU::X86KvmCPU().

◆ checkExtension()

int gem5::Kvm::checkExtension ( int  extension) const
protected

Check for the presence of an extension to the KVM API.

The return value depends on the extension, but is always zero if it is unsupported or positive otherwise. Some extensions use the return value provide additional data about the extension.

Returns
0 if the extension is unsupported, positive integer otherwise.

Definition at line 276 of file vm.cc.

References ioctl(), and panic.

Referenced by capCoalescedMMIO(), capDebugRegs(), capExtendedCPUID(), capIRQChip(), capNumMemSlots(), capOneReg(), capSetTSSAddress(), capUserMemory(), capUserNMI(), capVCPUEvents(), capXCRs(), and capXSave().

◆ create()

Kvm * gem5::Kvm::create ( )

Definition at line 99 of file vm.cc.

References instance, and Kvm().

◆ createVM()

int gem5::Kvm::createVM ( )
private

Create a KVM Virtual Machine.

Returns
File descriptor pointing to the VM

Definition at line 293 of file vm.cc.

References ioctl(), and panic.

◆ getAPIVersion()

int gem5::Kvm::getAPIVersion ( ) const
inline

Get the version of the KVM API implemented by the kernel.

Definition at line 90 of file vm.hh.

References apiVersion.

◆ getVCPUMMapSize()

int gem5::Kvm::getVCPUMMapSize ( ) const
inline

Get the size of the MMAPed parameter area used to communicate vCPU parameters between the kernel and userspace.

This area, amongst other things, contains the kvm_run data structure.

Definition at line 96 of file vm.hh.

References vcpuMMapSize.

Referenced by gem5::BaseKvmCPU::startup().

◆ operator=()

Kvm& gem5::Kvm::operator= ( const Kvm kvm)
private

Friends And Related Function Documentation

◆ KvmVM

friend class KvmVM
friend

Definition at line 82 of file vm.hh.

Member Data Documentation

◆ apiVersion

int gem5::Kvm::apiVersion
private

KVM API version.

Definition at line 263 of file vm.hh.

Referenced by getAPIVersion(), and Kvm().

◆ instance

Kvm * gem5::Kvm::instance = NULL
staticprivate

Singleton instance.

Definition at line 268 of file vm.hh.

Referenced by create().

◆ kvmFD

int gem5::Kvm::kvmFD
private

KVM VM file descriptor.

Definition at line 261 of file vm.hh.

Referenced by ioctl(), Kvm(), and ~Kvm().

◆ vcpuMMapSize

int gem5::Kvm::vcpuMMapSize
private

Size of the MMAPed vCPU parameter area.

Definition at line 265 of file vm.hh.

Referenced by getVCPUMMapSize(), and Kvm().


The documentation for this class was generated from the following files:

Generated on Tue Sep 21 2021 12:27:44 for gem5 by doxygen 1.8.17