1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Test that KVM_GET_MSR_INDEX_LIST and 4 * KVM_GET_MSR_FEATURE_INDEX_LIST work as intended 5 * 6 * Copyright (C) 2020, Red Hat, Inc. 7 */ 8 #include <fcntl.h> 9 #include <stdio.h> 10 #include <stdlib.h> 11 #include <string.h> 12 #include <sys/ioctl.h> 13 14 #include "test_util.h" 15 #include "kvm_util.h" 16 #include "processor.h" 17 18 int main(int argc, char *argv[]) 19 { 20 const struct kvm_msr_list *feature_list; 21 int i; 22 23 /* 24 * Skip the entire test if MSR_FEATURES isn't supported, other tests 25 * will cover the "regular" list of MSRs, the coverage here is purely 26 * opportunistic and not interesting on its own. 27 */ 28 if (!kvm_check_cap(KVM_CAP_GET_MSR_FEATURES)) { 29 print_skip("KVM_CAP_GET_MSR_FEATURES not supported"); 30 exit(KSFT_SKIP); 31 } 32 33 (void)kvm_get_msr_index_list(); 34 35 feature_list = kvm_get_feature_msr_index_list(); 36 for (i = 0; i < feature_list->nmsrs; i++) 37 kvm_get_feature_msr(feature_list->indices[i]); 38 } 39