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 support for setting and getting interru...



details:   https://anonhg.NetBSD.org/src/rev/ec45754fcb8e
branches:  trunk
changeset: 324673:ec45754fcb8e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jul 15 16:03:24 2018 +0000

description:
Add support for setting and getting interrupt affinity.

diffstat:

 sys/arch/arm/pic/pic.c    |  28 ++++++++++++++++++++++++++--
 sys/arch/arm/pic/picvar.h |  11 ++++++++++-
 2 files changed, 36 insertions(+), 3 deletions(-)

diffs (92 lines):

diff -r e434ee9a8bec -r ec45754fcb8e sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c    Sun Jul 15 13:34:43 2018 +0000
+++ b/sys/arch/arm/pic/pic.c    Sun Jul 15 16:03:24 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pic.c,v 1.43 2018/07/09 06:08:42 ryo Exp $     */
+/*     $NetBSD: pic.c,v 1.44 2018/07/15 16:03:24 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.43 2018/07/09 06:08:42 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.44 2018/07/15 16:03:24 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -44,6 +44,7 @@
 #include <sys/kmem.h>
 #include <sys/mutex.h>
 #include <sys/once.h>
+#include <sys/interrupt.h>
 #include <sys/xcall.h>
 #include <sys/ipi.h>
 
@@ -881,3 +882,26 @@
 
        pic_disestablish_source(is);
 }
+
+#ifdef MULTIPROCESSOR
+int
+interrupt_distribute(void *ih, const kcpuset_t *newset, kcpuset_t *oldset)
+{
+       struct intrsource * const is = ih;
+       struct pic_softc * const pic = is->is_pic;
+
+       if (pic == NULL)
+               return EOPNOTSUPP;
+       if (pic->pic_ops->pic_set_affinity == NULL ||
+           pic->pic_ops->pic_get_affinity == NULL)
+               return EOPNOTSUPP;
+
+       if (!is->is_mpsafe)
+               return EINVAL;
+
+       if (oldset != NULL)
+               pic->pic_ops->pic_get_affinity(pic, is->is_irq, oldset);
+
+       return pic->pic_ops->pic_set_affinity(pic, is->is_irq, newset);
+}
+#endif
diff -r e434ee9a8bec -r ec45754fcb8e sys/arch/arm/pic/picvar.h
--- a/sys/arch/arm/pic/picvar.h Sun Jul 15 13:34:43 2018 +0000
+++ b/sys/arch/arm/pic/picvar.h Sun Jul 15 16:03:24 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: picvar.h,v 1.16 2015/07/07 21:43:46 matt Exp $ */
+/*     $NetBSD: picvar.h,v 1.17 2018/07/15 16:03:24 jmcneill Exp $     */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -76,6 +76,10 @@
            int (*func)(void *), void *arg);
 int    pic_alloc_irq(struct pic_softc *pic);
 void   pic_disestablish_source(struct intrsource *is);
+#ifdef MULTIPROCESSOR
+void   pic_distribute_source(struct intrsource *is, const kcpuset_t *,
+           kcpuset_t *);
+#endif
 void   pic_do_pending_ints(register_t psw, int newipl, void *frame);
 void   pic_dispatch(struct intrsource *is, void *frame);
 
@@ -114,6 +118,9 @@
        uint8_t is_iplidx;
        bool is_mpsafe;
        char is_source[16];
+#ifdef MULTIPROCESSOR
+       kcpuset_t *is_affinity;
+#endif
 };
 
 struct pic_percpu {
@@ -156,6 +163,8 @@
 #ifdef MULTIPROCESSOR
        void (*pic_cpu_init)(struct pic_softc *, struct cpu_info *);
        void (*pic_ipi_send)(struct pic_softc *, const kcpuset_t *, u_long);
+       int (*pic_set_affinity)(struct pic_softc *, size_t, const kcpuset_t *);
+       void (*pic_get_affinity)(struct pic_softc *, size_t, kcpuset_t *);
 #endif
 };
 



Home | Main Index | Thread Index | Old Index