Skip to contentSkip to conversation

arm64: microbench: fix unexpected PPI

PATCH In review Jingyi Wang 2 participants 2 messages Dec 18, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: microbench: fix unexpected PPI

For the origin value of CNTV_CVAL_EL0 architecturally UNKNOWN, we may receive an unexpected PPI before we actual trigger the timer interrupt. So we should set ARCH_TIMER_CTL_IMASK in timer_prep.

---
 arm/micro-bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arm/micro-bench.c +1 -1
index 362f93e..95c418c 100644
@@ -227,7 +227,7 @@ static bool timer_prep(void)
 	}
 
 	writel(1 << PPI(TIMER_VTIMER_IRQ), gic_isenabler);
-	write_sysreg(ARCH_TIMER_CTL_ENABLE, cntv_ctl_el0);
+	write_sysreg(ARCH_TIMER_CTL_IMASK | ARCH_TIMER_CTL_ENABLE, cntv_ctl_el0);
 	isb();
 
 	gic_prep_common();
Signature · 6 lines
2.19.1

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
#1 lore raw
Quoted 25 lines · Jingyi Wang

For the origin value of CNTV_CVAL_EL0 architecturally UNKNOWN, we may receive an unexpected PPI before we actual trigger the timer interrupt. So we should set ARCH_TIMER_CTL_IMASK in timer_prep.

---
 arm/micro-bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arm/micro-bench.c +1 -1
index 362f93e..95c418c 100644
@@ -227,7 +227,7 @@ static bool timer_prep(void)
 	}
 
 	writel(1 << PPI(TIMER_VTIMER_IRQ), gic_isenabler);
-	write_sysreg(ARCH_TIMER_CTL_ENABLE, cntv_ctl_el0);
+	write_sysreg(ARCH_TIMER_CTL_IMASK | ARCH_TIMER_CTL_ENABLE, cntv_ctl_el0);
 	isb();
 
 	gic_prep_common();
Signature · 1 line
2.19.1

Queued, https://gitlab.com/rhdrjones/kvm-unit-tests/commits/arm/queue

Thanks,
drew

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm