From 9f025e829ab6ed468cfb51d72ac105624afc3851 Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 1 Jul 2021 23:11:14 +0200 Subject: added support to query caps on kvm fd + few caps --- sysdeps/kvm.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'sysdeps') 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)); -- cgit v1.2.3