|
1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | 2 | /* |
3 | | - * VMX-pmu related msrs test |
| 3 | + * Test for VMX-pmu perf capability msr |
4 | 4 | * |
5 | 5 | * Copyright (C) 2021 Intel Corporation |
6 | 6 | * |
7 | | - * Test to check the effect of various CPUID settings |
8 | | - * on the MSR_IA32_PERF_CAPABILITIES MSR, and check that |
9 | | - * whatever we write with KVM_SET_MSR is _not_ modified |
10 | | - * in the guest and test it can be retrieved with KVM_GET_MSR. |
11 | | - * |
12 | | - * Test to check that invalid LBR formats are rejected. |
| 7 | + * Test to check the effect of various CPUID settings on |
| 8 | + * MSR_IA32_PERF_CAPABILITIES MSR, and check that what |
| 9 | + * we write with KVM_SET_MSR is _not_ modified by the guest |
| 10 | + * and check it can be retrieved with KVM_GET_MSR, also test |
| 11 | + * the invalid LBR formats are rejected. |
13 | 12 | */ |
14 | 13 |
|
15 | 14 | #define _GNU_SOURCE /* for program_invocation_short_name */ |
@@ -107,8 +106,11 @@ int main(int argc, char *argv[]) |
107 | 106 | ASSERT_EQ(vcpu_get_msr(vm, VCPU_ID, MSR_IA32_PERF_CAPABILITIES), (u64)host_cap.lbr_format); |
108 | 107 |
|
109 | 108 | /* testcase 3, check invalid LBR format is rejected */ |
110 | | - ret = _vcpu_set_msr(vm, 0, MSR_IA32_PERF_CAPABILITIES, PMU_CAP_LBR_FMT); |
| 109 | + /* Note, on Arch LBR capable platforms, LBR_FMT in perf capability msr is 0x3f, |
| 110 | + * to avoid the failure, use a true invalid format 0x30 for the test. */ |
| 111 | + ret = _vcpu_set_msr(vm, 0, MSR_IA32_PERF_CAPABILITIES, 0x30); |
111 | 112 | TEST_ASSERT(ret == 0, "Bad PERF_CAPABILITIES didn't fail."); |
112 | 113 |
|
| 114 | + printf("Completed perf capability tests.\n"); |
113 | 115 | kvm_vm_free(vm); |
114 | 116 | } |
0 commit comments