40 #include <linux/kvm.h>
41 #include <sys/ioctl.h>
62 #ifdef KVM_GET_DEVICE_ATTR
63 struct kvm_device_attr dattr = {
67 reinterpret_cast<uint64_t
>(
data),
70 if (
ioctl(KVM_GET_DEVICE_ATTR, &dattr) == -1) {
71 panic(
"Failed to get attribute (group: %i, attr: %i, errno: %i)",
75 panic(
"Kernel headers don't support KVM_GET_DEVICE_ATTR\n");
82 #ifdef KVM_SET_DEVICE_ATTR
83 struct kvm_device_attr dattr = {
87 reinterpret_cast<uint64_t
>(
data),
90 if (
ioctl(KVM_SET_DEVICE_ATTR, &dattr) == -1) {
91 panic(
"Failed to set attribute (group: %i, attr: %i, errno: %i)",
95 panic(
"Kernel headers don't support KVM_GET_DEVICE_ATTR\n");
102 #ifdef KVM_HAS_DEVICE_ATTR
103 struct kvm_device_attr dattr = {
110 return ioctl(KVM_HAS_DEVICE_ATTR, &dattr) == 0;
112 panic(
"Kernel headers don't support KVM_HAS_DEVICE_ATTR\n");
121 return ::ioctl(
fd, request, p1);