struct reg_sublist *s;
for_each_sublist(c, s) {
- if (s->capability && !kvm_check_cap(s->capability)) {
+ if (s->capability && !kvm_has_cap(s->capability)) {
fprintf(stderr, "%s: %s not available, skipping tests\n", config_name(c), s->name);
exit(KSFT_SKIP);
}
struct kvm_vm *vm;
int ret;
- if (!kvm_check_cap(KVM_CAP_ARM_EL1_32BIT)) {
+ if (!kvm_has_cap(KVM_CAP_ARM_EL1_32BIT)) {
print_skip("KVM_CAP_ARM_EL1_32BIT is not supported");
exit(KSFT_SKIP);
}
static bool clear_log_supported(void)
{
- return kvm_check_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2);
+ return kvm_has_cap(KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2);
}
static void clear_log_create_vm_done(struct kvm_vm *vm)
static bool dirty_ring_supported(void)
{
- return kvm_check_cap(KVM_CAP_DIRTY_LOG_RING);
+ return kvm_has_cap(KVM_CAP_DIRTY_LOG_RING);
}
static void dirty_ring_create_vm_done(struct kvm_vm *vm)
int open_kvm_dev_path_or_exit(void);
unsigned int kvm_check_cap(long cap);
+static inline bool kvm_has_cap(long cap)
+{
+ return kvm_check_cap(cap);
+}
+
#define __KVM_SYSCALL_ERROR(_name, _ret) \
"%s failed, rc: %i errno: %i (%s)", (_name), (_ret), errno, strerror(errno)
}
/* Check the extension for binary stats */
- if (!kvm_check_cap(KVM_CAP_BINARY_STATS_FD)) {
+ if (!kvm_has_cap(KVM_CAP_BINARY_STATS_FD)) {
print_skip("Binary form statistics interface is not supported");
exit(KSFT_SKIP);
}
close(kvm_fd);
- return ret;
+ return (unsigned int)ret;
}
void vm_enable_dirty_ring(struct kvm_vm *vm, uint32_t ring_size)
{
vm->kvm_fd = _open_kvm_dev_path_or_exit(O_RDWR);
- if (!kvm_check_cap(KVM_CAP_IMMEDIATE_EXIT)) {
+ if (!kvm_has_cap(KVM_CAP_IMMEDIATE_EXIT)) {
print_skip("immediate_exit not available");
exit(KSFT_SKIP);
}
* If KVM does not support diag318, then return 0 to
* ensure tests do not break.
*/
- if (!kvm_check_cap(KVM_CAP_S390_DIAG318)) {
+ if (!kvm_has_cap(KVM_CAP_S390_DIAG318)) {
if (!printed_skip) {
fprintf(stdout, "KVM_CAP_S390_DIAG318 not supported. "
"Skipping diag318 test.\n");
1, /* cli */
};
- if (!kvm_check_cap(KVM_CAP_SET_GUEST_DEBUG)) {
+ if (!kvm_has_cap(KVM_CAP_SET_GUEST_DEBUG)) {
print_skip("KVM_CAP_SET_GUEST_DEBUG not supported");
return 0;
}
/* Tell stdout not to buffer its content */
setbuf(stdout, NULL);
- if (!kvm_check_cap(KVM_CAP_SMALLER_MAXPHYADDR)) {
+ if (!kvm_has_cap(KVM_CAP_SMALLER_MAXPHYADDR)) {
printf("module parameter 'allow_smaller_maxphyaddr' is not set. Skipping test.\n");
return 0;
}
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
if (!nested_vmx_supported() ||
- !kvm_check_cap(KVM_CAP_NESTED_STATE) ||
- !kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
+ !kvm_has_cap(KVM_CAP_NESTED_STATE) ||
+ !kvm_has_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
print_skip("Enlightened VMCS is unsupported");
exit(KSFT_SKIP);
}
/* Tell stdout not to buffer its content */
setbuf(stdout, NULL);
- if (!kvm_check_cap(KVM_CAP_HYPERV_CPUID)) {
+ if (!kvm_has_cap(KVM_CAP_HYPERV_CPUID)) {
print_skip("KVM_CAP_HYPERV_CPUID not supported");
exit(KSFT_SKIP);
}
free(hv_cpuid_entries);
if (!nested_vmx_supported() ||
- !kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
+ !kvm_has_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
print_skip("Enlightened VMCS is unsupported");
goto do_sys;
}
do_sys:
/* Test system ioctl version */
- if (!kvm_check_cap(KVM_CAP_SYS_HYPERV_CPUID)) {
+ if (!kvm_has_cap(KVM_CAP_SYS_HYPERV_CPUID)) {
print_skip("KVM_CAP_SYS_HYPERV_CPUID not supported");
goto out;
}
struct kvm_vcpu *vcpu;
struct kvm_vm *vm;
- if (!kvm_check_cap(KVM_CAP_ENFORCE_PV_FEATURE_CPUID)) {
+ if (!kvm_has_cap(KVM_CAP_ENFORCE_PV_FEATURE_CPUID)) {
print_skip("KVM_CAP_ENFORCE_PV_FEATURE_CPUID not supported");
exit(KSFT_SKIP);
}
int main(int argc, char *argv[])
{
- if (!kvm_check_cap(KVM_CAP_SET_BOOT_CPU_ID)) {
+ if (!kvm_has_cap(KVM_CAP_SET_BOOT_CPU_ID)) {
print_skip("set_boot_cpu_id not available");
return 0;
}
{
struct kvm_cpuid_entry2 *cpuid;
- if (!kvm_check_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM) &&
- !kvm_check_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM)) {
+ if (!kvm_has_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM) &&
+ !kvm_has_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM)) {
print_skip("Capabilities not available");
exit(KSFT_SKIP);
}
exit(KSFT_SKIP);
}
- if (!kvm_check_cap(KVM_CAP_X86_TRIPLE_FAULT_EVENT)) {
+ if (!kvm_has_cap(KVM_CAP_X86_TRIPLE_FAULT_EVENT)) {
print_skip("KVM_CAP_X86_TRIPLE_FAULT_EVENT not supported");
exit(KSFT_SKIP);
}
int main(int argc, char *argv[])
{
- if (!kvm_check_cap(KVM_CAP_VM_TSC_CONTROL)) {
+ if (!kvm_has_cap(KVM_CAP_VM_TSC_CONTROL)) {
print_skip("KVM_CAP_VM_TSC_CONTROL not available");
exit(KSFT_SKIP);
}
static void tsc_scaling_check_supported(void)
{
- if (!kvm_check_cap(KVM_CAP_TSC_CONTROL)) {
+ if (!kvm_has_cap(KVM_CAP_TSC_CONTROL)) {
print_skip("TSC scaling not supported by the HW");
exit(KSFT_SKIP);
}
*/
nested_vmx_check_supported();
- if (!kvm_check_cap(KVM_CAP_NESTED_STATE)) {
+ if (!kvm_has_cap(KVM_CAP_NESTED_STATE)) {
print_skip("KVM_CAP_NESTED_STATE not supported");
exit(KSFT_SKIP);
}
have_evmcs = kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS);
- if (!kvm_check_cap(KVM_CAP_NESTED_STATE)) {
+ if (!kvm_has_cap(KVM_CAP_NESTED_STATE)) {
print_skip("KVM_CAP_NESTED_STATE not available");
exit(KSFT_SKIP);
}