Skip to contentSkip to conversation

arm64: timer: ignore ISTATUS with disabled timer

PATCH In review Nadav Amit 2 participants 3 messages Jun 15, 2023 – Jul 1, 2023

Subsystems (2)
lore
Share & tools
lore

Nadav Amit

author
#0 lore raw

PATCH 1/1 arm64: timer: ignore ISTATUS with disabled timer

From: Nadav Amit <[email protected]>

According to ARM specifications for the vtimer (CNTV_CTL_EL0): "When the value of the ENABLE bit is 0, the ISTATUS field is UNKNOWN."

Currently the test, however, does check that ISTATUS is cleared when the ENABLE bit is zero. Remove this check as the value is unknown.

---
 arm/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arm/timer.c +1 -1
index 2cb8051..0b976a7 100644
@@ -256,7 +256,7 @@ static void test_timer_pending(struct timer_info *info)
 	set_timer_irq_enabled(info, true);
 
 	report(!info->irq_received, "no interrupt when timer is disabled");
-	report(!timer_pending(info) && gic_timer_check_state(info, GIC_IRQ_STATE_INACTIVE),
+	report(gic_timer_check_state(info, GIC_IRQ_STATE_INACTIVE),
 			"interrupt signal no longer pending");
 
 	info->write_cval(now - 1);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Nadav Amit

From: Nadav Amit <[email protected]>

According to ARM specifications for the vtimer (CNTV_CTL_EL0): "When the value of the ENABLE bit is 0, the ISTATUS field is UNKNOWN."

Currently the test, however, does check that ISTATUS is cleared when the ENABLE bit is zero. Remove this check as the value is unknown.

Hmm, does it? timer_pending() is

/* Check that the timer condition is met. */ static bool timer_pending(struct timer_info *info)

 {
        return (info->read_ctl() & ARCH_TIMER_CTL_ENABLE) &&
                (info->read_ctl() & ARCH_TIMER_CTL_ISTATUS);

}

which I would expect to short-circuit when ENABLE is zero.

Thanks,
drew

Quoted 22 lines
---
 arm/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arm/timer.c +1 -1
index 2cb8051..0b976a7 100644
@@ -256,7 +256,7 @@ static void test_timer_pending(struct timer_info *info)
 	set_timer_irq_enabled(info, true);
 
 	report(!info->irq_received, "no interrupt when timer is disabled");
-	report(!timer_pending(info) && gic_timer_check_state(info, GIC_IRQ_STATE_INACTIVE),
+	report(gic_timer_check_state(info, GIC_IRQ_STATE_INACTIVE),
 			"interrupt signal no longer pending");
 
 	info->write_cval(now - 1);
Signature · 1 line
2.34.1
author
#2 lore raw
Quoted 15 lines · Andrew Jones
Quoted 7 lines · Nadav Amit

From: Nadav Amit <[email protected]>

According to ARM specifications for the vtimer (CNTV_CTL_EL0): "When the value of the ENABLE bit is 0, the ISTATUS field is UNKNOWN."

Currently the test, however, does check that ISTATUS is cleared when the ENABLE bit is zero. Remove this check as the value is unknown.

Hmm, does it? timer_pending() is

Quoted 8 lines

/* Check that the timer condition is met. */ static bool timer_pending(struct timer_info *info)

{
       return (info->read_ctl() & ARCH_TIMER_CTL_ENABLE) &&
               (info->read_ctl() & ARCH_TIMER_CTL_ISTATUS);
}

which I would expect to short-circuit when ENABLE is zero.

Yes, my bad. Drop it.

I had a different unrelated interrupt before that turned on the ENABLE. This just mask an additional failure.

Obviously we can reset the ENABLE before each test, but I presume it is fair to say that in general if a certain test fails, subsequent failures are prone to be false-positives.