177a3aa26SEmanuele Giuseppe Esposito // SPDX-License-Identifier: GPL-2.0 277a3aa26SEmanuele Giuseppe Esposito /* 377a3aa26SEmanuele Giuseppe Esposito * Test that KVM_GET_MSR_INDEX_LIST and 477a3aa26SEmanuele Giuseppe Esposito * KVM_GET_MSR_FEATURE_INDEX_LIST work as intended 577a3aa26SEmanuele Giuseppe Esposito * 677a3aa26SEmanuele Giuseppe Esposito * Copyright (C) 2020, Red Hat, Inc. 777a3aa26SEmanuele Giuseppe Esposito */ 877a3aa26SEmanuele Giuseppe Esposito #include <fcntl.h> 977a3aa26SEmanuele Giuseppe Esposito #include <stdio.h> 1077a3aa26SEmanuele Giuseppe Esposito #include <stdlib.h> 1177a3aa26SEmanuele Giuseppe Esposito #include <string.h> 1277a3aa26SEmanuele Giuseppe Esposito #include <sys/ioctl.h> 1377a3aa26SEmanuele Giuseppe Esposito 1477a3aa26SEmanuele Giuseppe Esposito #include "test_util.h" 1577a3aa26SEmanuele Giuseppe Esposito #include "kvm_util.h" 1677a3aa26SEmanuele Giuseppe Esposito #include "processor.h" 1777a3aa26SEmanuele Giuseppe Esposito main(int argc,char * argv[])1877a3aa26SEmanuele Giuseppe Espositoint main(int argc, char *argv[]) 1977a3aa26SEmanuele Giuseppe Esposito { 202128e30bSSean Christopherson const struct kvm_msr_list *feature_list; 212128e30bSSean Christopherson int i; 2277a3aa26SEmanuele Giuseppe Esposito 232128e30bSSean Christopherson /* 242128e30bSSean Christopherson * Skip the entire test if MSR_FEATURES isn't supported, other tests 252128e30bSSean Christopherson * will cover the "regular" list of MSRs, the coverage here is purely 262128e30bSSean Christopherson * opportunistic and not interesting on its own. 272128e30bSSean Christopherson */ 28*7ed397d1SSean Christopherson TEST_REQUIRE(kvm_has_cap(KVM_CAP_GET_MSR_FEATURES)); 292128e30bSSean Christopherson 302128e30bSSean Christopherson (void)kvm_get_msr_index_list(); 312128e30bSSean Christopherson 322128e30bSSean Christopherson feature_list = kvm_get_feature_msr_index_list(); 332128e30bSSean Christopherson for (i = 0; i < feature_list->nmsrs; i++) 342128e30bSSean Christopherson kvm_get_feature_msr(feature_list->indices[i]); 3577a3aa26SEmanuele Giuseppe Esposito } 36