git: 82ddab0e8f9d - main - arm: Don't advertise the virtual timer on arm
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 25 Sep 2023 14:19:52 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=82ddab0e8f9d5d0e4e8fdd2a7a17cd87e464f55b commit 82ddab0e8f9d5d0e4e8fdd2a7a17cd87e464f55b Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2023-09-25 08:10:11 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2023-09-25 14:19:33 +0000 arm: Don't advertise the virtual timer on arm It may not be usable on all SoCs. Sponsored by: Arm Ltd --- sys/arm/arm/generic_timer.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c index 998259c5c90f..e3298ae0fb14 100644 --- a/sys/arm/arm/generic_timer.c +++ b/sys/arm/arm/generic_timer.c @@ -617,7 +617,10 @@ arm_tmr_attach(device_t dev) phandle_t node; pcell_t clock; #endif - int error, user_phys; +#ifdef __aarch64__ + int user_phys; +#endif + int error; int i, first_timer, last_timer; sc = device_get_softc(dev); @@ -693,6 +696,7 @@ arm_tmr_attach(device_t dev) last_timer = GT_PHYS_NONSECURE; } +#ifdef __aarch64__ /* * The virtual timer is always available on arm and arm64, tell * userspace to use it. @@ -702,6 +706,13 @@ arm_tmr_attach(device_t dev) if (TUNABLE_INT_FETCH("hw.userspace_allow_phys_counter", &user_phys) && user_phys != 0) sc->physical_user = sc->physical_sys; +#else + /* + * The virtual timer depends on setting cntvoff from the hypervisor + * privilege level/el2, however this is only set on arm64. + */ + sc->physical_user = true; +#endif arm_tmr_sc = sc;