Module Name: src Committed By: cherry Date: Sun Oct 7 16:36:36 UTC 2018
Modified Files: src/sys/arch/x86/x86: i8259.c ioapic.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/x86/i8259.c cvs rdiff -u -r1.57 -r1.58 src/sys/arch/x86/x86/ioapic.c 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/x86/x86/i8259.c diff -u src/sys/arch/x86/x86/i8259.c:1.19 src/sys/arch/x86/x86/i8259.c:1.20 --- src/sys/arch/x86/x86/i8259.c:1.19 Sun Oct 7 05:28:51 2018 +++ src/sys/arch/x86/x86/i8259.c Sun Oct 7 16:36:36 2018 @@ -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 @@ i8259_setup(struct pic *pic, struct cpu_ 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 @@ i8259_unsetup(struct pic *pic, struct cp KASSERT(port < NR_EVENT_CHANNELS); + /* XXX: This is problematic for shared interrupts */ KASSERT(irq2port[irq] != 0); irq2port[irq] = 0; Index: src/sys/arch/x86/x86/ioapic.c diff -u src/sys/arch/x86/x86/ioapic.c:1.57 src/sys/arch/x86/x86/ioapic.c:1.58 --- src/sys/arch/x86/x86/ioapic.c:1.57 Sun Oct 7 05:28:51 2018 +++ src/sys/arch/x86/x86/ioapic.c Sun Oct 7 16:36:36 2018 @@ -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 @@ ioapic_addroute(struct pic *pic, struct 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 @@ ioapic_delroute(struct pic *pic, struct KASSERT(port < NR_EVENT_CHANNELS); + /* XXX: This is problematic for shared interrupts */ KASSERT(irq2port[irq] != 0); irq2port[irq] = 0;