git: 6136013a16f5 - stable/13 - Disable the arm physical timer when an irq exists

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 15 May 2023 15:45:52 UTC
The branch stable/13 has been updated by andrew:

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

commit 6136013a16f55ec21ae32e068bb425eb97fca250
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-01-28 17:36:24 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-05-15 07:59:43 +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.
    
    (cherry picked from commit c57694ce94712ce1fe0341ae51d70446a7dbbfa2)
---
 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 3f5f65439ddc..5b4972017c2d 100644
--- a/sys/arm/arm/generic_timer.c
+++ b/sys/arm/arm/generic_timer.c
@@ -475,7 +475,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;