Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 In the case of a shared GSI, bind will fail...



details:   https://anonhg.NetBSD.org/src/rev/05e445454836
branches:  trunk
changeset: 993897:05e445454836
user:      cherry <cherry%NetBSD.org@localhost>
date:      Sun Oct 07 16:36:36 2018 +0000

description:
In the case of a shared GSI, bind will fail, so we do not attempt this.
The sharing is accomplished by demultiplexing the port event of the first
bind. This is accomplished in intr.c:intr_establish_xname()

Note that the pic_delroute() is buggy (commented suitably) for the shared
gsi case, since it will unbind reset it unconditionally, leaving the other
shared callbacks stranded.

This problem will go awaywhen we unify further with native code, as this
case is taken care of appropriately in that case.

diffstat:

 sys/arch/x86/x86/i8259.c  |  13 +++++++++++--
 sys/arch/x86/x86/ioapic.c |  14 ++++++++++++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diffs (83 lines):

diff -r a181f2c924bb -r 05e445454836 sys/arch/x86/x86/i8259.c
--- a/sys/arch/x86/x86/i8259.c  Sun Oct 07 14:20:01 2018 +0000
+++ b/sys/arch/x86/x86/i8259.c  Sun Oct 07 16:36:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i8259.c,v 1.19 2018/10/07 05:28:51 cherry Exp $        */
+/*     $NetBSD: i8259.c,v 1.20 2018/10/07 16:36:36 cherry Exp $        */
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.19 2018/10/07 05:28:51 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.20 2018/10/07 16:36:36 cherry Exp $");
 
 #include <sys/param.h> 
 #include <sys/systm.h>
@@ -267,6 +267,14 @@
        int port, irq;
        irq = vect2irq[idtvec];
        KASSERT(irq != 0);
+       if (irq2port[irq] != 0) {
+               /* 
+                * Shared interrupt - we can't rebind.
+                *  The port is shared instead.
+                */
+               return;
+       }
+       
        port = bind_pirq_to_evtch(irq);
        KASSERT(port < NR_EVENT_CHANNELS);
        KASSERT(port >= 0);
@@ -292,6 +300,7 @@
 
        KASSERT(port < NR_EVENT_CHANNELS);
 
+       /* XXX: This is problematic for shared interrupts */
        KASSERT(irq2port[irq] != 0);
        irq2port[irq] = 0;
 
diff -r a181f2c924bb -r 05e445454836 sys/arch/x86/x86/ioapic.c
--- a/sys/arch/x86/x86/ioapic.c Sun Oct 07 14:20:01 2018 +0000
+++ b/sys/arch/x86/x86/ioapic.c Sun Oct 07 16:36:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ioapic.c,v 1.57 2018/10/07 05:28:51 cherry Exp $       */
+/*     $NetBSD: ioapic.c,v 1.58 2018/10/07 16:36:36 cherry Exp $       */
 
 /*-
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.57 2018/10/07 05:28:51 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.58 2018/10/07 16:36:36 cherry Exp $");
 
 #include "opt_ddb.h"
 
@@ -576,6 +576,15 @@
        int port, irq;
        irq = vect2irq[idtvec];
        KASSERT(irq != 0);
+
+       if (irq2port[irq] != 0) {
+               /* 
+                * Shared interrupt - we can't rebind.
+                *  The port is shared instead.
+                */
+               return;
+       }
+
        port = bind_pirq_to_evtch(irq);
        KASSERT(port < NR_EVENT_CHANNELS);
        KASSERT(port >= 0);
@@ -602,6 +611,7 @@
 
        KASSERT(port < NR_EVENT_CHANNELS);
 
+       /* XXX: This is problematic for shared interrupts */
        KASSERT(irq2port[irq] != 0);
        irq2port[irq] = 0;
 



Home | Main Index | Thread Index | Old Index