aboutsummaryrefslogtreecommitdiffhomepage
path: root/sysdeps
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2021-07-01 23:11:14 +0200
committerjohannst <johannes.stoelp@gmail.com>2021-07-01 23:11:14 +0200
commit9f025e829ab6ed468cfb51d72ac105624afc3851 (patch)
tree2aaa2efdd2aced5ace9fedd8e04c020e1a96d575 /sysdeps
parent4e1887f91c3f763fc8cd0797e8d96901139daf60 (diff)
downloadmini-kvm-rs-9f025e829ab6ed468cfb51d72ac105624afc3851.tar.gz
mini-kvm-rs-9f025e829ab6ed468cfb51d72ac105624afc3851.zip
added support to query caps on kvm fd + few caps
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/kvm.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sysdeps/kvm.c b/sysdeps/kvm.c
index 1665349..f7ff1a4 100644
--- a/sysdeps/kvm.c
+++ b/sysdeps/kvm.c
@@ -56,6 +56,32 @@ int main() {
printf("pub(crate) const KVM_EXIT_IO_OUT : u64 = 0x%x;\n", KVM_EXIT_IO_OUT);
printf("pub(crate) const KVM_EXIT_MMIO : u64 = 0x%x;\n", KVM_EXIT_MMIO);
+ /* Capabilities */
+
+ // Can be used on /dev/kvm fd and VM fd (if KVM_CAP_CHECK_EXTENSION_VM is available).
+ //
+ // param: capability to query KVM_CAP_*
+ // ret : 0 unsupported, 1 supported (some return >=1 returning number for cap)
+ printf("pub(crate) const KVM_CHECK_EXTENSION : u64 = 0x%x;\n", KVM_CHECK_EXTENSION);
+
+ /* Bool Capabilities */
+
+ // Check if capabilities can be checked in VM fd.
+ //
+ // ret: 0 unsupported, 1 supported
+ printf("pub(crate) const KVM_CAP_CHECK_EXTENSION_VM : u64 = 0x%x;\n", KVM_CAP_CHECK_EXTENSION_VM);
+
+ /* Int Capabilities */
+
+ // Check the recommended max amount of VCPUs.
+ //
+ // ret: 0 unsupported, >0 #vcpus
+ printf("pub(crate) const KVM_CAP_NR_VCPUS : u64 = 0x%x;\n", KVM_CAP_NR_VCPUS);
+ // Check the possible max amount of VCPUs.
+ //
+ // ret: 0 unsupported, >0 #vcpus
+ printf("pub(crate) const KVM_CAP_MAX_VCPUS : u64 = 0x%x;\n", KVM_CAP_MAX_VCPUS);
+
/* Testing constants */
printf("#[cfg(test)] const TEST_KVM_REGS_SIZE : usize = %ld;\n", sizeof(struct kvm_regs));