gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
KvmDevice Class Reference

KVM device wrapper. More...

#include <device.hh>

Public Member Functions

 KvmDevice (int fd)
 
virtual ~KvmDevice ()
 
template<typename T >
getAttr (uint32_t group, uint64_t attr) const
 Get the value of an attribute. More...
 
template<typename T >
void setAttr (uint32_t group, uint64_t attr, const T &data) const
 Get the value of an attribute. More...
 
void getAttrPtr (uint32_t group, uint64_t attr, void *data) const
 
void setAttrPtr (uint32_t group, uint64_t attr, const void *data) const
 
bool hasAttr (uint32_t group, uint64_t attr) const
 Check if a device attribute is valid. More...
 

Protected Member Functions

int ioctl (int request, long p1) const
 
int ioctl (int request, void *p1) const
 
int ioctl (int request) const
 

Private Attributes

int fd
 

Detailed Description

KVM device wrapper.

This is a wrapper around a device emulated by KVM. Such devices can be created using KvmVM::createDevice() API. They are typically used for in-kernel interrupt controllers and similar devices.

Each device has a device-specific set of attributes which are mapped into groups. The available attributes are described in the device's documentation in the kernel source tree (Documentation/virtual/kvm/devices/). Each attribute can be accessed with the getAttr() and setAttr() access methods. The presence of an attribute can be queried using the hasAttr() method.

Definition at line 59 of file device.hh.

Constructor & Destructor Documentation

KvmDevice::KvmDevice ( int  fd)

Definition at line 51 of file device.cc.

KvmDevice::~KvmDevice ( )
virtual

Definition at line 56 of file device.cc.

References fd.

Member Function Documentation

template<typename T >
T KvmDevice::getAttr ( uint32_t  group,
uint64_t  attr 
) const
inline

Get the value of an attribute.

See KVM's documentation, and specifically the device-specific documentation, for available attributes and attribute groups.

Parameters
groupAttribute group
attrAttribute ID within group
Returns
Attribute value

Definition at line 77 of file device.hh.

References data, and getAttrPtr().

void KvmDevice::getAttrPtr ( uint32_t  group,
uint64_t  attr,
void *  data 
) const

Definition at line 62 of file device.cc.

References ArmISA::attr, data, ioctl(), and panic.

Referenced by getAttr(), and KvmKernelGicV2::getGicReg().

bool KvmDevice::hasAttr ( uint32_t  group,
uint64_t  attr 
) const

Check if a device attribute is valid.

See KVM's documentation, and specifically the device-specific documentation, for available attributes and attribute groups.

Parameters
groupAttribute group
attrAttribute ID within group
Returns
true if attribute is valid, false otherwise.

Definition at line 102 of file device.cc.

References ArmISA::attr, ioctl(), and panic.

int KvmDevice::ioctl ( int  request,
long  p1 
) const
protected

Definition at line 119 of file device.cc.

References fd.

Referenced by getAttrPtr(), hasAttr(), ioctl(), and setAttrPtr().

int KvmDevice::ioctl ( int  request,
void *  p1 
) const
inlineprotected

Definition at line 115 of file device.hh.

References ioctl().

int KvmDevice::ioctl ( int  request) const
inlineprotected

Definition at line 118 of file device.hh.

References ioctl(), and X86ISA::L.

template<typename T >
void KvmDevice::setAttr ( uint32_t  group,
uint64_t  attr,
const T &  data 
) const
inline

Get the value of an attribute.

See KVM's documentation, and specifically the device-specific documentation, for available attributes and attribute groups.

Parameters
groupAttribute group
attrAttribute ID within group
Returns
Attribute value

Definition at line 94 of file device.hh.

References setAttrPtr().

Referenced by KvmKernelGicV2::KvmKernelGicV2().

void KvmDevice::setAttrPtr ( uint32_t  group,
uint64_t  attr,
const void *  data 
) const

Definition at line 82 of file device.cc.

References ArmISA::attr, data, ioctl(), and panic.

Referenced by setAttr(), and KvmKernelGicV2::setGicReg().

Member Data Documentation

int KvmDevice::fd
private

Definition at line 123 of file device.hh.

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


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