Commit f77e63e2 authored by Marc Zyngier's avatar Marc Zyngier
Browse files

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: default avatarMarc Zyngier <maz@kernel.org>
parents acf2ab28 54306f56
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 −0

File added.

Preview size limit exceeded, changes collapsed.

+5 −6
Original line number Diff line number Diff line
@@ -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++)
+17 −1
Original line number Diff line number Diff line
@@ -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) {
+3 −0
Original line number Diff line number Diff line
@@ -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 */
Loading