36 lines · c
1// SPDX-License-Identifier: GPL-2.02/*3 * Test that KVM_GET_MSR_INDEX_LIST and4 * KVM_GET_MSR_FEATURE_INDEX_LIST work as intended5 *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 18int 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 tests25 * will cover the "regular" list of MSRs, the coverage here is purely26 * opportunistic and not interesting on its own.27 */28 TEST_REQUIRE(kvm_has_cap(KVM_CAP_GET_MSR_FEATURES));29 30 (void)kvm_get_msr_index_list();31 32 feature_list = kvm_get_feature_msr_index_list();33 for (i = 0; i < feature_list->nmsrs; i++)34 kvm_get_feature_msr(feature_list->indices[i]);35}36