mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 23:23:03 +00:00
Merge branch kvm-arm64/selftests-6.12 into kvmarm-master/next
* kvm-arm64/selftests-6.12: : . : KVM/arm64 selftest updates for 6.12 : : - Check for a bunch of timer emulation corner cases (COlton Lewis) : . KVM: arm64: selftests: Add arch_timer_edge_cases selftest KVM: arm64: selftests: Ensure pending interrupts are handled in arch_timer test Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
commit
f77e63e274
@ -152,6 +152,7 @@ TEST_GEN_PROGS_x86_64 += pre_fault_memory_test
|
||||
TEST_GEN_PROGS_EXTENDED_x86_64 += x86_64/nx_huge_pages_test
|
||||
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/aarch32_id_regs
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/arch_timer_edge_cases
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/hypercalls
|
||||
TEST_GEN_PROGS_aarch64 += aarch64/page_fault_test
|
||||
|
1062
tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c
Normal file
1062
tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -269,13 +269,12 @@ static void guest_inject(struct test_args *args,
|
||||
KVM_INJECT_MULTI(cmd, first_intid, num);
|
||||
|
||||
while (irq_handled < num) {
|
||||
asm volatile("wfi\n"
|
||||
"msr daifclr, #2\n"
|
||||
/* handle IRQ */
|
||||
"msr daifset, #2\n"
|
||||
: : : "memory");
|
||||
wfi();
|
||||
local_irq_enable();
|
||||
isb(); /* handle IRQ */
|
||||
local_irq_disable();
|
||||
}
|
||||
asm volatile("msr daifclr, #2" : : : "memory");
|
||||
local_irq_enable();
|
||||
|
||||
GUEST_ASSERT_EQ(irq_handled, num);
|
||||
for (i = first_intid; i < num + first_intid; i++)
|
||||
|
@ -79,7 +79,7 @@ static inline uint64_t timer_get_cval(enum arch_timer timer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void timer_set_tval(enum arch_timer timer, uint32_t tval)
|
||||
static inline void timer_set_tval(enum arch_timer timer, int32_t tval)
|
||||
{
|
||||
switch (timer) {
|
||||
case VIRTUAL:
|
||||
@ -95,6 +95,22 @@ static inline void timer_set_tval(enum arch_timer timer, uint32_t tval)
|
||||
isb();
|
||||
}
|
||||
|
||||
static inline int32_t timer_get_tval(enum arch_timer timer)
|
||||
{
|
||||
isb();
|
||||
switch (timer) {
|
||||
case VIRTUAL:
|
||||
return read_sysreg(cntv_tval_el0);
|
||||
case PHYSICAL:
|
||||
return read_sysreg(cntp_tval_el0);
|
||||
default:
|
||||
GUEST_FAIL("Could not get timer %d\n", timer);
|
||||
}
|
||||
|
||||
/* We should not reach here */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void timer_set_ctl(enum arch_timer timer, uint32_t ctl)
|
||||
{
|
||||
switch (timer) {
|
||||
|
@ -243,4 +243,7 @@ void smccc_smc(uint32_t function_id, uint64_t arg0, uint64_t arg1,
|
||||
uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5,
|
||||
uint64_t arg6, struct arm_smccc_res *res);
|
||||
|
||||
/* Execute a Wait For Interrupt instruction. */
|
||||
void wfi(void);
|
||||
|
||||
#endif /* SELFTEST_KVM_PROCESSOR_H */
|
||||
|
@ -639,3 +639,9 @@ void vm_vaddr_populate_bitmap(struct kvm_vm *vm)
|
||||
sparsebit_set_num(vm->vpages_valid, 0,
|
||||
(1ULL << vm->va_bits) >> vm->page_shift);
|
||||
}
|
||||
|
||||
/* Helper to call wfi instruction. */
|
||||
void wfi(void)
|
||||
{
|
||||
asm volatile("wfi");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user