KVM: selftests: Assert that full-width PMC writes are supported if PDCM=1
authorSean Christopherson <seanjc@google.com>
Sat, 11 Mar 2023 00:46:07 +0000 (16:46 -0800)
committerSean Christopherson <seanjc@google.com>
Thu, 6 Apr 2023 21:58:43 +0000 (14:58 -0700)
KVM emulates full-width PMC writes in software, assert that KVM reports
full-width writes as supported if PERF_CAPABILITIES is supported.

Link: https://lore.kernel.org/r/20230311004618.920745-11-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/x86_64/vmx_pmu_caps_test.c

index c3b0738e361b6222d12c64421bf11977332fea49..035470b38400608748053977161443fccaea7305 100644 (file)
@@ -110,6 +110,9 @@ int main(int argc, char *argv[])
        host_cap.capabilities = kvm_get_feature_msr(MSR_IA32_PERF_CAPABILITIES);
        host_cap.capabilities &= (PMU_CAP_FW_WRITES | PMU_CAP_LBR_FMT);
 
+       TEST_ASSERT(host_cap.full_width_write,
+                   "Full-width writes should always be supported");
+
        test_basic_perf_capabilities(host_cap);
        test_fungible_perf_capabilities(host_cap);
        test_immutable_perf_capabilities(host_cap);