From 93d574ea957decec1c95dea9bfa8bc72457cc60d Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Fri, 10 Mar 2023 12:43:59 +0000 Subject: [PATCH] Always enable the virtual timer for userspace We always have it, some languages assume it's present, e.g. go before 1.20. Enable it by default on arm and arm64. PR: 269070 Reviewed by: kevans Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D39059 --- sys/arm/arm/generic_timer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c index 5d694e8e966..0b48841c996 100644 --- a/sys/arm/arm/generic_timer.c +++ b/sys/arm/arm/generic_timer.c @@ -270,13 +270,12 @@ setup_user_access(void *arg __unused) cntkctl = get_el1(cntkctl); cntkctl &= ~(GT_CNTKCTL_PL0PTEN | GT_CNTKCTL_PL0VTEN | - GT_CNTKCTL_EVNTEN); + GT_CNTKCTL_EVNTEN | GT_CNTKCTL_PL0PCTEN); + /* Always enable the virtual timer */ + cntkctl |= GT_CNTKCTL_PL0VCTEN; + /* Enable the physical timer if supported */ if (arm_tmr_sc->physical) { cntkctl |= GT_CNTKCTL_PL0PCTEN; - cntkctl &= ~GT_CNTKCTL_PL0VCTEN; - } else { - cntkctl |= GT_CNTKCTL_PL0VCTEN; - cntkctl &= ~GT_CNTKCTL_PL0PCTEN; } set_el1(cntkctl, cntkctl); isb();