Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha Implement cpu_intr_redistribute() for Tusnami...



details:   https://anonhg.NetBSD.org/src/rev/0d33b779c55a
branches:  trunk
changeset: 944341:0d33b779c55a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 26 21:07:48 2020 +0000

description:
Implement cpu_intr_redistribute() for Tusnami/Titan systems.

diffstat:

 sys/arch/alpha/alpha/interrupt.c     |   9 +++++--
 sys/arch/alpha/include/intr.h        |   3 +-
 sys/arch/alpha/include/pci_machdep.h |   4 ++-
 sys/arch/alpha/pci/pci_6600.c        |  19 ++++++++++++++-
 sys/arch/alpha/pci/pci_machdep.c     |  43 ++++++++++++++++++++++++++++++++++-
 5 files changed, 69 insertions(+), 9 deletions(-)

diffs (190 lines):

diff -r efd4a4f0a233 -r 0d33b779c55a sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c  Sat Sep 26 20:58:48 2020 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c  Sat Sep 26 21:07:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.90 2020/09/25 03:40:11 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.91 2020/09/26 21:07:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.90 2020/09/25 03:40:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.91 2020/09/26 21:07:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -575,6 +575,8 @@
        return curcpu()->ci_intrdepth != 0;
 }
 
+void   (*alpha_intr_redistribute)(void);
+
 /*
  * cpu_intr_redistribute:
  *
@@ -583,7 +585,8 @@
 void
 cpu_intr_redistribute(void)
 {
-       /* XXX Nothing, yet. */
+       if (alpha_intr_redistribute != NULL)
+               (*alpha_intr_redistribute)();
 }
 
 /*
diff -r efd4a4f0a233 -r 0d33b779c55a sys/arch/alpha/include/intr.h
--- a/sys/arch/alpha/include/intr.h     Sat Sep 26 20:58:48 2020 +0000
+++ b/sys/arch/alpha/include/intr.h     Sat Sep 26 21:07:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.81 2020/09/25 03:40:11 thorpej Exp $ */
+/* $NetBSD: intr.h,v 1.82 2020/09/26 21:07:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -268,6 +268,7 @@
            unsigned int);
 
 extern struct scbvec scb_iovectab[];
+extern void (*alpha_intr_redistribute)(void);
 
 void   scb_init(void);
 void   scb_set(u_long, void (*)(void *, u_long), void *);
diff -r efd4a4f0a233 -r 0d33b779c55a sys/arch/alpha/include/pci_machdep.h
--- a/sys/arch/alpha/include/pci_machdep.h      Sat Sep 26 20:58:48 2020 +0000
+++ b/sys/arch/alpha/include/pci_machdep.h      Sat Sep 26 21:07:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.20 2020/09/26 02:46:27 thorpej Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.21 2020/09/26 21:07:48 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -132,6 +132,8 @@
 void   alpha_pci_generic_intr_disestablish(pci_chipset_tag_t, void *);
 void   alpha_pci_generic_iointr(void *, unsigned long);
 
+void   alpha_pci_generic_intr_redistribute(pci_chipset_tag_t);
+
 void   alpha_pci_intr_handle_init(pci_intr_handle_t *, u_int, u_int);
 void   alpha_pci_intr_handle_set_irq(pci_intr_handle_t *, u_int);
 u_int  alpha_pci_intr_handle_get_irq(const pci_intr_handle_t *);
diff -r efd4a4f0a233 -r 0d33b779c55a sys/arch/alpha/pci/pci_6600.c
--- a/sys/arch/alpha/pci/pci_6600.c     Sat Sep 26 20:58:48 2020 +0000
+++ b/sys/arch/alpha/pci/pci_6600.c     Sat Sep 26 21:07:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_6600.c,v 1.28 2020/09/26 02:50:41 thorpej Exp $ */
+/* $NetBSD: pci_6600.c,v 1.29 2020/09/26 21:07:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v 1.28 2020/09/26 02:50:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v 1.29 2020/09/26 21:07:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,6 +98,8 @@
 static void    dec_6600_intr_set_affinity(pci_chipset_tag_t, int,
                    struct cpu_info *);
 
+static void    dec_6600_intr_redistribute(void);
+
 /*
  * We keep 2 software copies of the interrupt enables: one global one,
  * and one per-CPU for setting the interrupt affinity.
@@ -132,6 +134,8 @@
        pc->pc_intr_disable = dec_6600_intr_disable;
        pc->pc_intr_set_affinity = dec_6600_intr_set_affinity;
 
+       alpha_intr_redistribute = dec_6600_intr_redistribute;
+
        /* Note eligible CPUs for interrupt routing purposes. */
        for (CPU_INFO_FOREACH(cii, ci)) {
                KASSERT(ci->ci_cpuid < 4);
@@ -396,6 +400,17 @@
                dec_6600_intr_program(pc);
 }
 
+static void
+dec_6600_intr_redistribute(void)
+{
+       KASSERT(sioprimary != NULL);
+
+       pci_chipset_tag_t const pc = &sioprimary->pc_pc;
+
+       /* ISA interrupts always stay on primary. Shuffle PCI interrupts. */
+       alpha_pci_generic_intr_redistribute(pc);
+}
+
 static void *
 dec_6600_pciide_compat_intr_establish(device_t dev,
     const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
diff -r efd4a4f0a233 -r 0d33b779c55a sys/arch/alpha/pci/pci_machdep.c
--- a/sys/arch/alpha/pci/pci_machdep.c  Sat Sep 26 20:58:48 2020 +0000
+++ b/sys/arch/alpha/pci/pci_machdep.c  Sat Sep 26 21:07:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.27 2020/09/26 02:46:28 thorpej Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.28 2020/09/26 21:07:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.27 2020/09/26 02:46:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.28 2020/09/26 21:07:48 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -378,6 +378,45 @@
        }
 }
 
+void
+alpha_pci_generic_intr_redistribute(pci_chipset_tag_t const pc)
+{
+       struct cpu_info *current_ci, *new_ci;
+       unsigned int irq;
+
+       KASSERT(mutex_owned(&cpu_lock));
+       KASSERT(mp_online);
+
+       /* If we can't set affinity, then there's nothing to do. */
+       if (pc->pc_eligible_cpus == 0 || pc->pc_intr_set_affinity == NULL) {
+               return;
+       }
+
+       /*
+        * Look at each IRQ, and allocate a new CPU for each IRQ
+        * that's being serviced by a now-shielded CPU.
+        */
+       for (irq = 0; irq < pc->pc_nirq; irq++) {
+               current_ci =
+                   alpha_shared_intr_get_cpu(pc->pc_shared_intrs, irq);
+               if (current_ci == NULL ||
+                   (current_ci->ci_schedstate.spc_flags & SPCF_NOINTR) == 0) {
+                       continue;
+               }
+
+               new_ci = alpha_pci_generic_intr_select_cpu(pc, irq, 0);
+               if (new_ci == current_ci) {
+                       /* Can't shield this one. */
+                       continue;
+               }
+
+               alpha_shared_intr_set_cpu(pc->pc_shared_intrs, irq, new_ci);
+               pc->pc_intr_set_affinity(pc, irq, new_ci);
+       }
+
+       /* XXX should now re-balance */
+}
+
 #define        ALPHA_PCI_INTR_HANDLE_IRQ       __BITS(0,31)
 #define        ALPHA_PCI_INTR_HANDLE_FLAGS     __BITS(32,63)
 



Home | Main Index | Thread Index | Old Index