git: 93d574ea957d - main - Always enable the virtual timer for userspace

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Tue, 14 Mar 2023 11:09:37 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=93d574ea957decec1c95dea9bfa8bc72457cc60d

commit 93d574ea957decec1c95dea9bfa8bc72457cc60d
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-03-10 12:43:59 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-03-14 10:37:36 +0000

    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 5d694e8e9660..0b48841c9960 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();