Skip to content

Commit d9c41dc

Browse files
sean-jcbonzini
authored andcommitted
KVM: selftests: Verify that KVM returns the configured APIC cycle length
Add checks in the APIC bus clock test to verify that querying KVM_CAP_X86_APIC_BUS_CYCLES_NS on the VM after changing the frequency returns the VM's actual APIC cycle length, not KVM's default. For giggles, verify that KVM still returns its default frequency for the system-scoped check. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-ID: <20260522173526.3539407-3-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 86e2de1 commit d9c41dc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tools/testing/selftests/kvm/x86/apic_bus_clock_test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ static void run_apic_bus_clock_test(u64 apic_hz, u64 delay_ms,
137137
vm_enable_cap(vm, KVM_CAP_X86_APIC_BUS_CYCLES_NS,
138138
NSEC_PER_SEC / apic_hz);
139139

140+
TEST_ASSERT_EQ(kvm_check_cap(KVM_CAP_X86_APIC_BUS_CYCLES_NS), 1);
141+
TEST_ASSERT_EQ(vm_check_cap(vm, KVM_CAP_X86_APIC_BUS_CYCLES_NS),
142+
NSEC_PER_SEC / apic_hz);
143+
140144
vcpu = vm_vcpu_add(vm, 0, apic_guest_code);
141145
vcpu_args_set(vcpu, 2, apic_hz, delay_ms);
142146

0 commit comments

Comments
 (0)