65#ifdef KVM_GET_DEVICE_ATTR
66 struct kvm_device_attr dattr =
71 reinterpret_cast<uint64_t
>(
data),
74 if (
ioctl(KVM_GET_DEVICE_ATTR, &dattr) == -1) {
75 panic(
"Failed to get attribute (group: %i, attr: %i, errno: %i)",
79 panic(
"Kernel headers don't support KVM_GET_DEVICE_ATTR\n");
86#ifdef KVM_SET_DEVICE_ATTR
87 struct kvm_device_attr dattr =
92 reinterpret_cast<uint64_t
>(
data),
95 if (
ioctl(KVM_SET_DEVICE_ATTR, &dattr) == -1) {
96 panic(
"Failed to set attribute (group: %i, attr: %i, errno: %i)",
100 panic(
"Kernel headers don't support KVM_GET_DEVICE_ATTR\n");
107#ifdef KVM_HAS_DEVICE_ATTR
108 struct kvm_device_attr dattr =
116 return ioctl(KVM_HAS_DEVICE_ATTR, &dattr) == 0;
118 panic(
"Kernel headers don't support KVM_HAS_DEVICE_ATTR\n");
127 return ::ioctl(
fd, request, p1);
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.
int ioctl(int request, long p1) const
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.