git: c57694ce9471 - main - Disable the arm physical timer when an irq exists

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Sun, 29 Jan 2023 14:59:52 UTC
The branch main has been updated by andrew:

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

commit c57694ce94712ce1fe0341ae51d70446a7dbbfa2
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-01-28 17:36:24 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-01-29 14:58:24 +0000

    Disable the arm physical timer when an irq exists
    
    Some firmware leaves the timers enabled. Ensure they are disabled if
    there are any physical timer interrupt resources to ensure we don't
    receive any unexpected interrupts from them.
---
 sys/arm/arm/generic_timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c
index 2527af9b9068..0556643032c2 100644
--- a/sys/arm/arm/generic_timer.c
+++ b/sys/arm/arm/generic_timer.c
@@ -521,7 +521,8 @@ arm_tmr_attach(device_t dev)
 	if (sc->res[GT_VIRT] != NULL)
 		arm_tmr_disable(false);
 	/* And the physical */
-	if (sc->physical)
+	if (sc->res[GT_PHYS_SECURE] != NULL ||
+	    sc->res[GT_PHYS_NONSECURE] != NULL)
 		arm_tmr_disable(true);
 
 	arm_tmr_timecount.tc_frequency = sc->clkfreq;