gem5 v24.0.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. | |
template<typename T > | |
void | setAttr (uint32_t group, uint64_t attr, const T &data) const |
Get the value of an attribute. | |
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. | |
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 78 of file device.hh.
References gem5::ArmISA::attr, data, and getAttrPtr().
void gem5::KvmDevice::getAttrPtr | ( | uint32_t | group, |
uint64_t | attr, | ||
void * | data ) const |
Definition at line 63 of file device.cc.
References gem5::ArmISA::attr, data, ioctl(), and panic.
Referenced by getAttr(), gem5::KvmKernelGicV2::getGicReg(), and gem5::KvmKernelGicV3::getGicReg().
bool gem5::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 105 of file device.cc.
References gem5::ArmISA::attr, ioctl(), and panic.
|
inlineprotected |
Definition at line 119 of file device.hh.
References ioctl(), and gem5::X86ISA::L.
|
protected |
Definition at line 123 of file device.cc.
References fd.
Referenced by getAttrPtr(), hasAttr(), ioctl(), 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 95 of file device.hh.
References gem5::ArmISA::attr, data, and setAttrPtr().
Referenced by gem5::KvmKernelGicV3::init(), gem5::KvmKernelGic::KvmKernelGic(), gem5::KvmKernelGicV2::KvmKernelGicV2(), and gem5::KvmKernelGicV3::KvmKernelGicV3().
void gem5::KvmDevice::setAttrPtr | ( | uint32_t | group, |
uint64_t | attr, | ||
const void * | data ) const |
Definition at line 84 of file device.cc.
References gem5::ArmISA::attr, data, ioctl(), and panic.
Referenced by setAttr(), gem5::KvmKernelGicV2::setGicReg(), and gem5::KvmKernelGicV3::setGicReg().
|
private |
Definition at line 124 of file device.hh.
Referenced by ioctl(), and ~KvmDevice().