aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2024-08-08 10:16:34 +0200
committerAlexander Potapenko <glider@google.com>2024-09-03 12:16:36 +0000
commit63c1a4dfb5943c5af91e42a16bf3953757c8e05d (patch)
tree994879148f3ace32acd633d12d87dda29483fa48
parente727bcb7ce726e5f738d264cf99a386a7ff934d7 (diff)
sys/linux: declare KVM_{SET,GET,HAS}_DEVICE_ATTR for VCPUs
According to https://docs.kernel.org/virt/kvm/devices/vcpu.html, VCPUs also have device attributes. Add descriptions for ioctls that manipulate those attributes.
-rw-r--r--sys/linux/dev_kvm.txt70
-rw-r--r--sys/linux/dev_kvm.txt.const12
2 files changed, 82 insertions, 0 deletions
diff --git a/sys/linux/dev_kvm.txt b/sys/linux/dev_kvm.txt
index af41eed55..c1278a177 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/vcpu.html:
+# The virtual cpu “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 VCPU-wide settings and controls.
+ioctl$KVM_SET_DEVICE_ATTR_vcpu(fd fd_kvmcpu, cmd const[KVM_SET_DEVICE_ATTR], arg ptr[in, kvm_device_attr_vcpu])
+ioctl$KVM_GET_DEVICE_ATTR_vcpu(fd fd_kvmcpu, cmd const[KVM_GET_DEVICE_ATTR], arg ptr[in, kvm_device_attr_vcpu])
+ioctl$KVM_HAS_DEVICE_ATTR_vcpu(fd fd_kvmcpu, cmd const[KVM_HAS_DEVICE_ATTR], arg ptr[in, kvm_device_attr_vcpu])
+
# 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.
@@ -440,6 +447,16 @@ kvm_device_attr_vm [
attr_other kvm_device_attr
]
+kvm_device_attr_vcpu [
+ attr_pmu_irq kvm_vcpu_attr_pmu_irq
+ attr_pmu_init kvm_vcpu_attr_pmu_init
+ attr_pmu_filter kvm_vcpu_attr_pmu_filter
+ attr_set_pmu kvm_vcpu_attr_set_pmu
+ attr_irq_timer kvm_vcpu_attr_irq_timer
+ attr_pvtime_ipa kvm_vcpu_attr_pvtime_ipa
+ 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
@@ -452,6 +469,59 @@ kvm_device_attr_vm_arm64 {
addr ptr64[in, kvm_smccc_filter]
}
+kvm_vcpu_attr_pmu_irq {
+ flags const[0, int32]
+ group const[KVM_ARM_VCPU_PMU_V3_CTRL, int32]
+ attr const[KVM_ARM_VCPU_PMU_V3_IRQ, int64]
+ addr ptr64[in, int32]
+}
+
+kvm_vcpu_attr_pmu_init {
+ flags const[0, int32]
+ group const[KVM_ARM_VCPU_PMU_V3_CTRL, int32]
+ attr const[KVM_ARM_VCPU_PMU_V3_INIT, int64]
+ addr const[0, int64]
+}
+
+kvm_vcpu_attr_pmu_filter {
+ flags const[0, int32]
+ group const[KVM_ARM_VCPU_PMU_V3_CTRL, int32]
+ attr const[KVM_ARM_VCPU_PMU_V3_FILTER, int64]
+ addr ptr64[in, kvm_pmu_event_filter]
+}
+
+kvm_vcpu_attr_set_pmu {
+ flags const[0, int32]
+ group const[KVM_ARM_VCPU_PMU_V3_CTRL, int32]
+ attr const[KVM_ARM_VCPU_PMU_V3_SET_PMU, int64]
+ addr ptr64[in, int32]
+}
+
+kvm_vcpu_timer_attributes = KVM_ARM_VCPU_TIMER_IRQ_VTIMER, KVM_ARM_VCPU_TIMER_IRQ_PTIMER
+
+kvm_vcpu_attr_irq_timer {
+ flags const[0, int32]
+ group const[KVM_ARM_VCPU_TIMER_CTRL, int32]
+ attr flags[kvm_vcpu_timer_attributes, int64]
+ addr ptr64[in, int32[16:31]]
+}
+
+kvm_vcpu_attr_pvtime_ipa {
+ flags const[0, int32]
+ group const[KVM_ARM_VCPU_PVTIME_CTRL, int32]
+ attr const[KVM_ARM_VCPU_PVTIME_IPA, int64]
+ addr int64
+}
+
+kvm_pmu_event_filter = KVM_PMU_EVENT_ALLOW, KVM_PMU_EVENT_DENY
+
+kvm_pmu_event_filter {
+ base_event int16
+ nevents int16
+ action flags[kvm_pmu_event_filter, int8]
+ pad array[const[0, int8], 3]
+}
+
kvm_smccc_filter_action = KVM_SMCCC_FILTER_HANDLE, KVM_SMCCC_FILTER_DENY, KVM_SMCCC_FILTER_FWD_TO_USER
kvm_smccc_filter {
diff --git a/sys/linux/dev_kvm.txt.const b/sys/linux/dev_kvm.txt.const
index 96a05cf9c..1a0ae35d0 100644
--- a/sys/linux/dev_kvm.txt.const
+++ b/sys/linux/dev_kvm.txt.const
@@ -11,8 +11,18 @@ KVM_ARM_TARGET_XGENE_POTENZA = 386:amd64:mips64le:ppc64le:s390x:???, arm64:3
KVM_ARM_VCPU_EL1_32BIT = 386:amd64:mips64le:ppc64le:s390x:???, arm64:1
KVM_ARM_VCPU_INIT = 386:amd64:mips64le:ppc64le:s390x:???, arm64:1075883694
KVM_ARM_VCPU_PMU_V3 = 386:amd64:mips64le:ppc64le:s390x:???, arm64:3
+KVM_ARM_VCPU_PMU_V3_CTRL = 386:amd64:mips64le:ppc64le:s390x:???, arm64:0
+KVM_ARM_VCPU_PMU_V3_FILTER = 386:amd64:mips64le:ppc64le:s390x:???, arm64:2
+KVM_ARM_VCPU_PMU_V3_INIT = 386:amd64:mips64le:ppc64le:s390x:???, arm64:1
+KVM_ARM_VCPU_PMU_V3_IRQ = 386:amd64:mips64le:ppc64le:s390x:???, arm64:0
+KVM_ARM_VCPU_PMU_V3_SET_PMU = 386:amd64:mips64le:ppc64le:s390x:???, arm64:3
KVM_ARM_VCPU_POWER_OFF = 386:amd64:mips64le:ppc64le:s390x:???, arm64:0
KVM_ARM_VCPU_PSCI_0_2 = 386:amd64:mips64le:ppc64le:s390x:???, arm64:2
+KVM_ARM_VCPU_PVTIME_CTRL = 386:amd64:mips64le:ppc64le:s390x:???, arm64:2
+KVM_ARM_VCPU_PVTIME_IPA = 386:amd64:mips64le:ppc64le:s390x:???, arm64:0
+KVM_ARM_VCPU_TIMER_CTRL = 386:amd64:mips64le:ppc64le:s390x:???, arm64:1
+KVM_ARM_VCPU_TIMER_IRQ_PTIMER = 386:amd64:mips64le:ppc64le:s390x:???, arm64:1
+KVM_ARM_VCPU_TIMER_IRQ_VTIMER = 386:amd64:mips64le:ppc64le:s390x:???, arm64:0
KVM_ARM_VM_SMCCC_CTRL = 386:amd64:mips64le:ppc64le:s390x:???, arm64:0
KVM_ARM_VM_SMCCC_FILTER = 386:amd64:mips64le:ppc64le:s390x:???, arm64:0
KVM_ASSIGN_DEV_IRQ = 1077980784
@@ -146,6 +156,8 @@ KVM_MSR_EXIT_REASON_FILTER = 4
KVM_MSR_EXIT_REASON_INVAL = 1
KVM_MSR_EXIT_REASON_UNKNOWN = 2
KVM_NMI = 44698, mips64le:ppc64le:536915610
+KVM_PMU_EVENT_ALLOW = 0, mips64le:ppc64le:s390x:???
+KVM_PMU_EVENT_DENY = 1, mips64le:ppc64le:s390x:???
KVM_PPC_ALLOCATE_HTAB = 3221532327
KVM_PPC_GET_PVINFO = 386:amd64:arm64:mips64le:s390x:???, ppc64le:2155916961
KVM_PPC_GET_SMMU_INFO = 386:amd64:arm64:mips64le:s390x:???, ppc64le:1112583846