gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
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 74 of file vm.hh.

Constructor & Destructor Documentation

Kvm::~Kvm ( )
virtual

Definition at line 82 of file vm.cc.

References kvmFD.

Kvm::Kvm ( )
private

Definition at line 66 of file vm.cc.

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

Referenced by create().

Kvm::Kvm ( const Kvm kvm)
private

Member Function Documentation

int 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 125 of file vm.cc.

References checkExtension().

Referenced by BaseKvmCPU::startup().

bool Kvm::capDebugRegs ( ) const

Support for getting and setting the kvm_debugregs structure.

Definition at line 167 of file vm.cc.

References checkExtension().

Referenced by X86KvmCPU::X86KvmCPU().

bool Kvm::capExtendedCPUID ( ) const

Support for BaseKvmCPU::setCPUID2 and getSupportedCPUID().

Definition at line 109 of file vm.cc.

References checkExtension().

Referenced by X86KvmCPU::X86KvmCPU().

bool Kvm::capIRQChip ( ) const

Support for creating an in-kernel IRQ chip model.

See Also
KvmVM::createIRQChip()

Definition at line 151 of file vm.cc.

References checkExtension().

int 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 131 of file vm.cc.

References checkExtension().

Referenced by KvmVM::KvmVM().

bool Kvm::capOneReg ( ) const

Support for reading and writing single registers.

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

Definition at line 141 of file vm.cc.

References checkExtension().

bool Kvm::capSetTSSAddress ( ) const

Support for KvmVM::setTSSAddress()

Definition at line 103 of file vm.cc.

References checkExtension().

Referenced by X86KvmCPU::X86KvmCPU().

bool Kvm::capUserMemory ( ) const

Support for KvmVM::setUserMemoryRegion()

Definition at line 97 of file vm.cc.

References checkExtension().

bool Kvm::capUserNMI ( ) const

Support for BaseKvmCPU::kvmNonMaskableInterrupt().

Definition at line 115 of file vm.cc.

References checkExtension().

Referenced by X86KvmCPU::X86KvmCPU().

bool Kvm::capVCPUEvents ( ) const

Support for getting and setting the kvm_vcpu_events structure.

Definition at line 157 of file vm.cc.

References checkExtension().

Referenced by X86KvmCPU::X86KvmCPU().

bool Kvm::capXCRs ( ) const

Support for getting and setting the x86 XCRs.

Definition at line 177 of file vm.cc.

References checkExtension().

Referenced by X86KvmCPU::X86KvmCPU().

bool Kvm::capXSave ( ) const

Support for getting and setting the kvm_xsave structure.

Definition at line 187 of file vm.cc.

References checkExtension().

Referenced by X86KvmCPU::X86KvmCPU().

int 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 265 of file vm.cc.

References ioctl(), and panic.

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

Kvm * Kvm::create ( )

Definition at line 88 of file vm.cc.

References instance, and Kvm().

int Kvm::createVM ( )
private

Create a KVM Virtual Machine.

Returns
File descriptor pointing to the VM

Definition at line 282 of file vm.cc.

References ioctl(), and panic.

int Kvm::getAPIVersion ( ) const
inline

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

Definition at line 84 of file vm.hh.

References apiVersion.

int 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 90 of file vm.hh.

References vcpuMMapSize.

Referenced by BaseKvmCPU::startup().

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

Friends And Related Function Documentation

friend class KvmVM
friend

Definition at line 76 of file vm.hh.

Member Data Documentation

int Kvm::apiVersion
private

KVM API version.

Definition at line 257 of file vm.hh.

Referenced by getAPIVersion(), and Kvm().

Kvm * Kvm::instance = NULL
staticprivate

Singleton instance.

Definition at line 262 of file vm.hh.

Referenced by create().

int Kvm::kvmFD
private

KVM VM file descriptor.

Definition at line 255 of file vm.hh.

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

int Kvm::vcpuMMapSize
private

Size of the MMAPed vCPU parameter area.

Definition at line 259 of file vm.hh.

Referenced by getVCPUMMapSize(), and Kvm().


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

Generated on Fri Jun 9 2017 13:04:13 for gem5 by doxygen 1.8.6