tools/testing/selftests/kvm/loongarch/arch_timer.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/loongarch/arch_timer.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/kvm/loongarch/arch_timer.c- Extension
.c- Size
- 5424 bytes
- Lines
- 201
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
arch_timer.hkvm_util.hprocessor.htimer_test.hucall_common.h
Detected Declarations
function do_idlefunction guest_irq_handlerfunction guest_test_period_timerfunction guest_test_oneshot_timerfunction guest_test_emulate_timerfunction guest_time_count_testfunction guest_codefunction test_vm_cleanup
Annotated Snippet
while (start < end) {
prev = start;
start = timer_get_cycles();
__GUEST_ASSERT(prev <= start,
"prev = 0x%lx, start = 0x%lx.\n",
prev, start);
}
}
}
static void guest_code(void)
{
u32 cpu = guest_get_vcpuid();
/* must run at first */
guest_time_count_test(cpu);
timer_irq_enable();
local_irq_enable();
guest_test_period_timer(cpu);
guest_test_oneshot_timer(cpu);
guest_test_emulate_timer(cpu);
GUEST_DONE();
}
struct kvm_vm *test_vm_create(void)
{
struct kvm_vm *vm;
int nr_vcpus = test_args.nr_vcpus;
vm = vm_create_with_vcpus(nr_vcpus, guest_code, vcpus);
vm_init_descriptor_tables(vm);
vm_install_exception_handler(vm, EXCCODE_INT, guest_irq_handler);
/* Make all the test's cmdline args visible to the guest */
sync_global_to_guest(vm, test_args);
return vm;
}
void test_vm_cleanup(struct kvm_vm *vm)
{
kvm_vm_free(vm);
}
Annotation
- Immediate include surface: `arch_timer.h`, `kvm_util.h`, `processor.h`, `timer_test.h`, `ucall_common.h`.
- Detected declarations: `function do_idle`, `function guest_irq_handler`, `function guest_test_period_timer`, `function guest_test_oneshot_timer`, `function guest_test_emulate_timer`, `function guest_time_count_test`, `function guest_code`, `function test_vm_cleanup`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
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.