Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/cortex If we get a spurious interrupt, log a de...



details:   https://anonhg.NetBSD.org/src/rev/b14a6a7bd53b
branches:  trunk
changeset: 1023472:b14a6a7bd53b
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Sep 09 21:39:02 2021 +0000

description:
If we get a spurious interrupt, log a debug message and ignore it.

Otherwise we risk tripping an assertion later on due to an interrupt
firing before it is scheduled.

diffstat:

 sys/arch/arm/cortex/gtmr.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 96cf75b37cf0 -r b14a6a7bd53b sys/arch/arm/cortex/gtmr.c
--- a/sys/arch/arm/cortex/gtmr.c        Thu Sep 09 20:25:30 2021 +0000
+++ b/sys/arch/arm/cortex/gtmr.c        Thu Sep 09 21:39:02 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gtmr.c,v 1.44 2021/08/30 22:53:37 jmcneill Exp $       */
+/*     $NetBSD: gtmr.c,v 1.45 2021/09/09 21:39:02 jmcneill Exp $       */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.44 2021/08/30 22:53:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.45 2021/09/09 21:39:02 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -334,6 +334,12 @@
        struct clockframe * const cf = arg;
        struct gtmr_softc * const sc = &gtmr_sc;
 
+       const uint32_t ctl = gtmr_read_ctl(sc);
+       if ((ctl & (CNTCTL_ENABLE|CNTCTL_ISTATUS)) != (CNTCTL_ENABLE|CNTCTL_ISTATUS)) {
+               aprint_debug_dev(ci->ci_dev, "spurious timer interrupt (ctl=%#x)\n", ctl);
+               return 0;
+       }
+
        const uint64_t now = gtmr_read_cntct(sc);
        uint64_t delta = now - ci->ci_lastintr;
 



Home | Main Index | Thread Index | Old Index