Module Name: src Committed By: jmcneill Date: Sun Feb 21 17:07:45 UTC 2021
Modified Files: src/sys/arch/arm/pic: pic.c pic_splfuncs.c picvar.h Log Message: Inline pic_set_priority and use cpu_dosoftints_ci when available. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/arch/arm/pic/pic.c cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/pic/pic_splfuncs.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/pic/picvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/pic/pic.c diff -u src/sys/arch/arm/pic/pic.c:1.68 src/sys/arch/arm/pic/pic.c:1.69 --- src/sys/arch/arm/pic/pic.c:1.68 Sun Feb 21 08:31:36 2021 +++ src/sys/arch/arm/pic/pic.c Sun Feb 21 17:07:45 2021 @@ -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 @@ EVCNT_ATTACH_STATIC(pic_deferral_ev); 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 @@ pic_do_pending_ints(register_t psw, int 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 @@ pic_do_pending_ints(register_t psw, int #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 Index: src/sys/arch/arm/pic/pic_splfuncs.c diff -u src/sys/arch/arm/pic/pic_splfuncs.c:1.16 src/sys/arch/arm/pic/pic_splfuncs.c:1.17 --- src/sys/arch/arm/pic/pic_splfuncs.c:1.16 Sat Feb 20 22:53:31 2021 +++ src/sys/arch/arm/pic/pic_splfuncs.c Sun Feb 21 17:07:45 2021 @@ -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 @@ splx(int savedipl) 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 @@ splx(int savedipl) 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); Index: src/sys/arch/arm/pic/picvar.h diff -u src/sys/arch/arm/pic/picvar.h:1.30 src/sys/arch/arm/pic/picvar.h:1.31 --- src/sys/arch/arm/pic/picvar.h:1.30 Sat Feb 20 19:30:46 2021 +++ src/sys/arch/arm/pic/picvar.h Sun Feb 21 17:07:45 2021 @@ -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 @@ struct pic_ops { #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)