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 Inline pic_set_priority and use cpu_dosofti...



details:   https://anonhg.NetBSD.org/src/rev/c3da00b543cc
branches:  trunk
changeset: 959683:c3da00b543cc
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Feb 21 17:07:45 2021 +0000

description:
Inline pic_set_priority and use cpu_dosoftints_ci when available.

diffstat:

 sys/arch/arm/pic/pic.c          |  38 +++++---------------------------------
 sys/arch/arm/pic/pic_splfuncs.c |  15 ++++++++-------
 sys/arch/arm/pic/picvar.h       |  15 +++++++++------
 3 files changed, 22 insertions(+), 46 deletions(-)

diffs (157 lines):

diff -r d8fdcd6e5c7a -r c3da00b543cc sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c    Sun Feb 21 17:07:06 2021 +0000
+++ b/sys/arch/arm/pic/pic.c    Sun Feb 21 17:07:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pic.c,v 1.68 2021/02/21 08:31:36 skrll Exp $   */
+/*     $NetBSD: pic.c,v 1.69 2021/02/21 17:07:45 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.68 2021/02/21 08:31:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.69 2021/02/21 17:07:45 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -95,34 +95,6 @@
 
 static int pic_init(void);
 
-#ifdef __HAVE_PIC_SET_PRIORITY
-void
-pic_set_priority(struct cpu_info *ci, int newipl)
-{
-       register_t psw = cpsid(I32_bit);
-       if (pic_list[0] != NULL)
-               (pic_list[0]->pic_ops->pic_set_priority)(pic_list[0], newipl);
-       ci->ci_cpl = newipl;
-       if ((psw & I32_bit) == 0)
-               cpsie(I32_bit);
-}
-
-void
-pic_set_priority_psw(struct cpu_info *ci, register_t psw, int newipl)
-{
-       if ((psw & I32_bit) == 0) {
-               DISABLE_INTERRUPT();
-       }
-       if (pic_list[0] != NULL) {
-               (pic_list[0]->pic_ops->pic_set_priority)(pic_list[0], newipl);
-       }
-       ci->ci_cpl = newipl;
-       if ((psw & I32_bit) == 0) {
-               ENABLE_INTERRUPT();
-       }
-}
-#endif
-
 #ifdef MULTIPROCESSOR
 int
 pic_ipi_ast(void *arg)
@@ -564,7 +536,7 @@
                        if (ipl <= newipl)
                                break;
 
-                       pic_set_priority_psw(ci, psw, ipl);
+                       pic_set_priority(ci, ipl);
                        pic_list_deliver_irqs(ci, psw, ipl, frame);
                        pic_list_unblock_irqs(ci);
                }
@@ -573,12 +545,12 @@
 #ifdef __HAVE_PREEMPTION
        struct lwp *l = curlwp;
        if (newipl == IPL_NONE && (l->l_md.md_astpending & __BIT(1))) {
-               pic_set_priority_psw(ci, psw, IPL_SCHED);
+               pic_set_priority(ci, IPL_SCHED);
                kpreempt(0);
        }
 #endif
        if (ci->ci_cpl != newipl)
-               pic_set_priority_psw(ci, psw, newipl);
+               pic_set_priority(ci, newipl);
 }
 
 static void
diff -r d8fdcd6e5c7a -r c3da00b543cc sys/arch/arm/pic/pic_splfuncs.c
--- a/sys/arch/arm/pic/pic_splfuncs.c   Sun Feb 21 17:07:06 2021 +0000
+++ b/sys/arch/arm/pic/pic_splfuncs.c   Sun Feb 21 17:07:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pic_splfuncs.c,v 1.16 2021/02/20 22:53:31 jmcneill Exp $       */
+/*     $NetBSD: pic_splfuncs.c,v 1.17 2021/02/21 17:07:45 jmcneill Exp $       */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.16 2021/02/20 22:53:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.17 2021/02/21 17:07:45 jmcneill Exp $");
 
 #define _INTR_PRIVATE
 #include <sys/param.h>
@@ -101,7 +101,7 @@
                                break;
                        }
 
-                       pic_set_priority_psw(ci, psw, ipl);
+                       pic_set_priority(ci, ipl);
                        pic_list_deliver_irqs(ci, psw, ipl, NULL);
                        pic_list_unblock_irqs(ci);
                }
@@ -113,11 +113,12 @@
 skip_pending:
 #endif
 
-       ci->ci_cpl = savedipl;
-       if (__predict_true(pic_list[0] != NULL)) {
-               (pic_list[0]->pic_ops->pic_set_priority)(pic_list[0], savedipl);
-       }
+       pic_set_priority(ci, savedipl);
+#if defined(__HAVE_CPU_DOSOFTINTS_CI)
+       cpu_dosoftints_ci(ci);
+#else
        cpu_dosoftints();
+#endif
 
        KASSERTMSG(ci->ci_cpl == savedipl, "cpl %d savedipl %d",
            ci->ci_cpl, savedipl);
diff -r d8fdcd6e5c7a -r c3da00b543cc sys/arch/arm/pic/picvar.h
--- a/sys/arch/arm/pic/picvar.h Sun Feb 21 17:07:06 2021 +0000
+++ b/sys/arch/arm/pic/picvar.h Sun Feb 21 17:07:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: picvar.h,v 1.30 2021/02/20 19:30:46 jmcneill Exp $     */
+/*     $NetBSD: picvar.h,v 1.31 2021/02/21 17:07:45 jmcneill Exp $     */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -176,18 +176,21 @@
 #endif
 };
 
+/* Using an inline causes catch-22 problems with cpu.h */
 #ifdef __HAVE_PIC_SET_PRIORITY
 /*
  * This is used to update a hardware pic with a value corresponding
  * to the ipl being set.
  */
-struct cpu_info;
-void   pic_set_priority(struct cpu_info *, int);
-void   pic_set_priority_psw(struct cpu_info *, register_t, int);
+#define pic_set_priority(ci, newipl)                                   \
+       do {                                                            \
+               (ci)->ci_cpl = (newipl);                                \
+               if (__predict_true(pic_list[0] != NULL)) {              \
+                       (pic_list[0]->pic_ops->pic_set_priority)(pic_list[0], newipl); \
+               }                                                       \
+       } while (0)
 #else
-/* Using an inline causes catch-22 problems with cpu.h */
 #define        pic_set_priority(ci, newipl)            ((void)((ci)->ci_cpl = (newipl)))
-#define        pic_set_priority_psw(ci, psw, newipl)   ((void)((ci)->ci_cpl = (newipl)))
 #endif
 
 #define        PIC_IRQBASE_ALLOC       (-2)



Home | Main Index | Thread Index | Old Index