Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Test that KVM_GET_MSR_INDEX_LIST and
0004  * KVM_GET_MSR_FEATURE_INDEX_LIST work as intended
0005  *
0006  * Copyright (C) 2020, Red Hat, Inc.
0007  */
0008 #include <fcntl.h>
0009 #include <stdio.h>
0010 #include <stdlib.h>
0011 #include <string.h>
0012 #include <sys/ioctl.h>
0013 
0014 #include "test_util.h"
0015 #include "kvm_util.h"
0016 #include "processor.h"
0017 
0018 int main(int argc, char *argv[])
0019 {
0020     const struct kvm_msr_list *feature_list;
0021     int i;
0022 
0023     /*
0024      * Skip the entire test if MSR_FEATURES isn't supported, other tests
0025      * will cover the "regular" list of MSRs, the coverage here is purely
0026      * opportunistic and not interesting on its own.
0027      */
0028     TEST_REQUIRE(kvm_has_cap(KVM_CAP_GET_MSR_FEATURES));
0029 
0030     (void)kvm_get_msr_index_list();
0031 
0032     feature_list = kvm_get_feature_msr_index_list();
0033     for (i = 0; i < feature_list->nmsrs; i++)
0034         kvm_get_feature_msr(feature_list->indices[i]);
0035 }