aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/dev_kvm.txt
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2024-08-05 18:19:32 +0200
committerAlexander Potapenko <glider@google.com>2024-08-07 16:00:37 +0000
commit0020fc2034b4113f0e6c59ba408795e2b63d5e43 (patch)
tree4f7487cde7bdd3da4f5e9fbd94971abfb2fe4b61 /sys/linux/dev_kvm.txt
parent109d2082129b092aabc13316527c1c35a9c6be1b (diff)
sys/linux: declare KVM_{SET,GET,HAS}_DEVICE_ATTR for VMs
In addition to device FDs, certain arches (s390 and ARM64) allow applying device attributes to VM FDs (https://docs.kernel.org/virt/kvm/devices/vm.html) Add descriptions for the corresponding ioctls on ARM64, including support for setting SMCCC filters via struct kvm_smccc_filter.
Diffstat (limited to 'sys/linux/dev_kvm.txt')
-rw-r--r--sys/linux/dev_kvm.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/linux/dev_kvm.txt b/sys/linux/dev_kvm.txt
index 16434a1d0..2066b8d78 100644
--- a/sys/linux/dev_kvm.txt
+++ b/sys/linux/dev_kvm.txt
@@ -147,6 +147,13 @@ ioctl$KVM_SET_DEVICE_ATTR(fd fd_kvmdev, cmd const[KVM_SET_DEVICE_ATTR], arg ptr[
ioctl$KVM_GET_DEVICE_ATTR(fd fd_kvmdev, cmd const[KVM_GET_DEVICE_ATTR], arg ptr[in, kvm_device_attr])
ioctl$KVM_HAS_DEVICE_ATTR(fd fd_kvmdev, cmd const[KVM_HAS_DEVICE_ATTR], arg ptr[in, kvm_device_attr])
+# From https://docs.kernel.org/virt/kvm/devices/vm.html:
+# The virtual machine “device” also accepts the ioctls KVM_SET_DEVICE_ATTR, KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR.
+# The interface uses the same struct kvm_device_attr as other devices, but targets VM-wide settings and controls.
+ioctl$KVM_SET_DEVICE_ATTR_vm(fd fd_kvmvm, cmd const[KVM_SET_DEVICE_ATTR], arg ptr[in, kvm_device_attr_vm])
+ioctl$KVM_GET_DEVICE_ATTR_vm(fd fd_kvmvm, cmd const[KVM_GET_DEVICE_ATTR], arg ptr[in, kvm_device_attr_vm])
+ioctl$KVM_HAS_DEVICE_ATTR_vm(fd fd_kvmvm, cmd const[KVM_HAS_DEVICE_ATTR], arg ptr[in, kvm_device_attr_vm])
+
kvm_mem_region_flags = KVM_MEM_LOG_DIRTY_PAGES, KVM_MEM_READONLY
kvm_mp_state = KVM_MP_STATE_RUNNABLE, KVM_MP_STATE_UNINITIALIZED, KVM_MP_STATE_INIT_RECEIVED, KVM_MP_STATE_HALTED, KVM_MP_STATE_SIPI_RECEIVED, KVM_MP_STATE_STOPPED, KVM_MP_STATE_CHECK_STOP, KVM_MP_STATE_OPERATING, KVM_MP_STATE_LOAD
kvm_irq_routing_entry_type = KVM_IRQ_ROUTING_IRQCHIP, KVM_IRQ_ROUTING_MSI, KVM_IRQ_ROUTING_S390_ADAPTER, KVM_IRQ_ROUTING_HV_SINT
@@ -406,6 +413,32 @@ kvm_device_attr {
addr ptr64[in, int64]
}
+kvm_device_attr_vm [
+ attr_arm64 kvm_device_attr_vm_arm64
+ attr_other kvm_device_attr
+]
+
+kvm_vm_attr_group_arm64 = KVM_ARM_VM_SMCCC_CTRL
+kvm_vm_attr_attr_arm64 = KVM_ARM_VM_SMCCC_FILTER
+
+# TODO(glider): as of now the only supported argument is kvm_smccc_filter.
+# Need to make addr point to a union when this changes.
+kvm_device_attr_vm_arm64 {
+ flags const[0, int32]
+ group flags[kvm_vm_attr_group_arm64, int32]
+ attr flags[kvm_vm_attr_attr_arm64, int64]
+ addr ptr64[in, kvm_smccc_filter]
+}
+
+kvm_smccc_filter_action = KVM_SMCCC_FILTER_HANDLE, KVM_SMCCC_FILTER_DENY, KVM_SMCCC_FILTER_FWD_TO_USER
+
+kvm_smccc_filter {
+ base int32
+ nr_functions int32
+ action flags[kvm_smccc_filter_action, int8]
+ pad array[const[0, int8], 15]
+}
+
kvm_create_device {
type flags[kvm_device_type, int32] (in)
fd fd_kvmdev (out)