Module Name: src Committed By: cherry Date: Thu Sep 20 05:08:45 UTC 2018
Modified Files: src/sys/arch/x86/x86: intr.c Log Message: When we removed the XEN special case from isa/isa_machdep.c there was a corner case that was missed in x86/intr.c:intr_establish_xname() In isa_machdep.c:isa_intr_establish_xname() the legacy_irq parameter is never set to -1. It is also incorrect to call isa_intr_establish_xname() with a legacy_irq parameter of -1. Thus we infer that whenever we see (legacy_irq == -1) in intr_establish_xname() which is downstream, we were *NOT* called from isa_machdep.c:isa_intr_establish_xname() Given that there are no other users of intr_establish_xnam() which pass a valid legacy_irq != -1, we assume therefore that we *WERE* called from isa_machdep.c:isa_intr_establish_xname() in this case. This is an important distinction in the case where a valid legacy_irq > NUM_LEGACY_IRQS was passed down from isa_intr_establish_xname() but was ignored by xen_pirq_alloc() and overwritten with the "pseudo" irq which is then passed back. We thus pass the incorrect "legacy" irq value to pirq_establish(). Even though non ISA (ie; PCI and MSI(X) cases), this is the correct behaviour, we need to maintain (bug?) compatibility with the isa case. Thus the one liner diff. CVS: ---------------------------------------------------------------------- CVS: CVSROOT cvs.NetBSD.org:/cvsroot CVS: please use "PR category/123" to have the commitmsg appended to PR 123 CVS: CVS: Please evaluate your changes and consider the following. CVS: Abort checkin if you answer no. CVS: => For all changes: CVS: Do the changed files compile? CVS: Has the change been tested? CVS: => If you are not completely familiar with the changed components: CVS: Has the change been posted for review? CVS: Have you allowed enough time for feedback? CVS: => If the change is major: CVS: => If the change adds files to, or removes files from $DESTDIR: CVS: => If you are changing a library or kernel interface: CVS: Have you successfully run "./build.sh release"? To generate a diff of this commit: cvs rdiff -u -r1.129 -r1.130 src/sys/arch/x86/x86/intr.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/intr.c diff -u src/sys/arch/x86/x86/intr.c:1.129 src/sys/arch/x86/x86/intr.c:1.130 --- src/sys/arch/x86/x86/intr.c:1.129 Fri Sep 14 01:50:51 2018 +++ src/sys/arch/x86/x86/intr.c Thu Sep 20 05:08:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.129 2018/09/14 01:50:51 mrg Exp $ */ +/* $NetBSD: intr.c,v 1.130 2018/09/20 05:08:45 cherry Exp $ */ /* * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.129 2018/09/14 01:50:51 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.130 2018/09/20 05:08:45 cherry Exp $"); #include "opt_intrdebug.h" #include "opt_multiprocessor.h" @@ -1291,6 +1291,7 @@ intr_establish_xname(int legacy_irq, str sizeof(intrstr_buf)); evtchn = xen_pirq_alloc(&irq, type); + irq = (legacy_irq == -1) ? irq : legacy_irq; /* ISA compat */ pih = pirq_establish(irq & 0xff, evtchn, handler, arg, level, intrstr, xname); pih->pic_type = pic->pic_type;