gem5
v20.1.0.0
|
KVM device wrapper. More...
#include <device.hh>
Public Member Functions | |
KvmDevice (int fd) | |
virtual | ~KvmDevice () |
template<typename T > | |
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 |
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.
|
inline |
Get the value of an attribute.
See KVM's documentation, and specifically the device-specific documentation, for available attributes and attribute groups.
group | Attribute group |
attr | Attribute ID within group |
Definition at line 75 of file device.hh.
References ArmISA::attr, data, and getAttrPtr().
void KvmDevice::getAttrPtr | ( | uint32_t | group, |
uint64_t | attr, | ||
void * | data | ||
) | const |
Definition at line 60 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.
group | Attribute group |
attr | Attribute ID within group |
Definition at line 100 of file device.cc.
References ArmISA::attr, ioctl(), and panic.
|
inlineprotected |
|
protected |
Definition at line 117 of file device.cc.
References fd.
Referenced by getAttrPtr(), hasAttr(), ioctl(), and setAttrPtr().
|
inlineprotected |
|
inline |
Get the value of an attribute.
See KVM's documentation, and specifically the device-specific documentation, for available attributes and attribute groups.
group | Attribute group |
attr | Attribute ID within group |
Definition at line 92 of file device.hh.
References ArmISA::attr, data, and setAttrPtr().
Referenced by KvmKernelGicV2::KvmKernelGicV2().
void KvmDevice::setAttrPtr | ( | uint32_t | group, |
uint64_t | attr, | ||
const void * | data | ||
) | const |
Definition at line 80 of file device.cc.
References ArmISA::attr, data, ioctl(), and panic.
Referenced by setAttr(), and KvmKernelGicV2::setGicReg().
|
private |
Definition at line 121 of file device.hh.
Referenced by ioctl(), and ~KvmDevice().