Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/pic Add reference counts to intr_mask/intr_unma...
details: https://anonhg.NetBSD.org/src/rev/8c189e189aa2
branches: trunk
changeset: 466492:8c189e189aa2
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Dec 23 15:51:47 2019 +0000
description:
Add reference counts to intr_mask/intr_unmask as calls can be nested, spotted by thorpej
diffstat:
sys/arch/arm/pic/pic.c | 10 ++++++----
sys/arch/arm/pic/picvar.h | 3 ++-
2 files changed, 8 insertions(+), 5 deletions(-)
diffs (55 lines):
diff -r 9b32924b04d6 -r 8c189e189aa2 sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c Mon Dec 23 15:48:51 2019 +0000
+++ b/sys/arch/arm/pic/pic.c Mon Dec 23 15:51:47 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pic.c,v 1.49 2019/12/23 15:34:23 jmcneill Exp $ */
+/* $NetBSD: pic.c,v 1.50 2019/12/23 15:51:47 jmcneill Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -33,7 +33,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.49 2019/12/23 15:34:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.50 2019/12/23 15:51:47 jmcneill Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -909,7 +909,8 @@
struct pic_softc * const pic = is->is_pic;
const int irq = is->is_irq;
- (*pic->pic_ops->pic_block_irqs)(pic, irq & ~0x1f, __BIT(irq & 0x1f));
+ if (atomic_inc_32_nv(&is->is_mask_count) == 1)
+ (*pic->pic_ops->pic_block_irqs)(pic, irq & ~0x1f, __BIT(irq & 0x1f));
}
void
@@ -919,7 +920,8 @@
struct pic_softc * const pic = is->is_pic;
const int irq = is->is_irq;
- (*pic->pic_ops->pic_unblock_irqs)(pic, irq & ~0x1f, __BIT(irq & 0x1f));
+ if (atomic_dec_32_nv(&is->is_mask_count) == 0)
+ (*pic->pic_ops->pic_unblock_irqs)(pic, irq & ~0x1f, __BIT(irq & 0x1f));
}
const char *
diff -r 9b32924b04d6 -r 8c189e189aa2 sys/arch/arm/pic/picvar.h
--- a/sys/arch/arm/pic/picvar.h Mon Dec 23 15:48:51 2019 +0000
+++ b/sys/arch/arm/pic/picvar.h Mon Dec 23 15:51:47 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: picvar.h,v 1.24 2019/12/23 15:34:23 jmcneill Exp $ */
+/* $NetBSD: picvar.h,v 1.25 2019/12/23 15:51:47 jmcneill Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -126,6 +126,7 @@
bool is_mpsafe;
char is_source[16];
char *is_xname;
+ uint32_t is_mask_count;
};
struct pic_percpu {
Home |
Main Index |
Thread Index |
Old Index