tools/testing/selftests/kvm/x86/xapic_tpr_test.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/x86/xapic_tpr_test.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/kvm/x86/xapic_tpr_test.c- Extension
.c- Size
- 5827 bytes
- Lines
- 277
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
fcntl.hstdatomic.hstdio.hstdlib.hstring.hsys/ioctl.hunistd.hapic.hkvm_util.hprocessor.htest_util.h
Detected Declarations
function tpr_guest_irq_sync_flag_resetfunction tpr_guest_irq_sync_val_getfunction tpr_guest_irq_sync_val_incfunction tpr_guest_irq_handler_xapicfunction tpr_guest_irq_handler_x2apicfunction tpr_guest_irq_queuefunction tpr_guest_tpr_getfunction tpr_guest_ppr_getfunction tpr_guest_cr8_getfunction tpr_guest_check_tpr_ppr_cr8_equalfunction tpr_guest_codefunction lapic_tpr_getfunction lapic_tpr_setfunction sregs_tprfunction test_tpr_check_tpr_zerofunction test_tpr_check_tpr_cr8_equalfunction test_tpr_set_tpr_for_irqfunction test_tprfunction main
Annotated Snippet
switch (get_ucall(vcpu, &uc)) {
case UCALL_ABORT:
REPORT_GUEST_ASSERT(uc);
break;
case UCALL_DONE:
test_tpr_check_tpr_cr8_equal(vcpu);
done = true;
break;
case UCALL_SYNC:
test_tpr_check_tpr_cr8_equal(vcpu);
test_tpr_set_tpr_for_irq(vcpu, uc.args[1]);
break;
default:
TEST_FAIL("Unknown ucall result 0x%lx", uc.cmd);
break;
}
}
kvm_vm_free(vm);
}
int main(int argc, char *argv[])
{
/*
* Use separate VMs for the xAPIC and x2APIC tests so that x2APIC can
* be fully hidden from the guest. KVM disallows changing CPUID after
* KVM_RUN and AVIC is disabled if _any_ vCPU is allowed to use x2APIC.
*/
test_tpr(false);
test_tpr(true);
}
Annotation
- Immediate include surface: `fcntl.h`, `stdatomic.h`, `stdio.h`, `stdlib.h`, `string.h`, `sys/ioctl.h`, `unistd.h`, `apic.h`.
- Detected declarations: `function tpr_guest_irq_sync_flag_reset`, `function tpr_guest_irq_sync_val_get`, `function tpr_guest_irq_sync_val_inc`, `function tpr_guest_irq_handler_xapic`, `function tpr_guest_irq_handler_x2apic`, `function tpr_guest_irq_queue`, `function tpr_guest_tpr_get`, `function tpr_guest_ppr_get`, `function tpr_guest_cr8_get`, `function tpr_guest_check_tpr_ppr_cr8_equal`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.