From owner-cvs-src@FreeBSD.ORG Tue May 8 21:29:15 2007 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6606316A404; Tue, 8 May 2007 21:29:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 56F0913C468; Tue, 8 May 2007 21:29:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l48LTFoO057887; Tue, 8 May 2007 21:29:15 GMT (envelope-from jhb@repoman.freebsd.org) Received: (from jhb@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l48LTFZ5057886; Tue, 8 May 2007 21:29:15 GMT (envelope-from jhb) Message-Id: <200705082129.l48LTFZ5057886@repoman.freebsd.org> From: John Baldwin Date: Tue, 8 May 2007 21:29:14 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/amd64/amd64 intr_machdep.c io_apic.c local_apic.c msi.c nexus.c src/sys/amd64/include apicvar.h intr_machdep.h src/sys/amd64/isa atpic.c src/sys/i386/i386 intr_machdep.c io_apic.c local_apic.c msi.c nexus.c ... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2007 21:29:15 -0000 jhb 2007-05-08 21:29:14 UTC FreeBSD src repository Modified files: sys/amd64/amd64 intr_machdep.c io_apic.c local_apic.c msi.c nexus.c sys/amd64/include apicvar.h intr_machdep.h sys/amd64/isa atpic.c sys/i386/i386 intr_machdep.c io_apic.c local_apic.c msi.c nexus.c sys/i386/include apicvar.h intr_machdep.h sys/i386/isa atpic.c Log: Minor fixes and tweaks to the x86 interrupt code: - Split the intr_table_lock into an sx lock used for most things, and a spin lock to protect intrcnt_index. Originally I had this as a spin lock so interrupt code could use it to lookup sources. However, we don't actually do that because it would add a lot of overhead to interrupts, and if we ever do support removing interrupt sources, we can use other means to safely do so w/o locking in the interrupt handling code. - Replace is_enabled (boolean) with is_handlers (a count of handlers) to determine if a source is enabled or not. This allows us to notice when a source is no longer in use. When that happens, we now invoke a new PIC method (pic_disable_intr()) to inform the PIC driver that the source is no longer in use. The I/O APIC driver frees the APIC IDT vector when this happens. The MSI driver no longer needs to have a hack to clear is_enabled during msi_alloc() and msix_alloc() as a result of this change as well. - Add an apic_disable_vector() to reset an IDT vector back to Xrsvd to complement apic_enable_vector() and use it in the I/O APIC and MSI code when freeing an IDT vector. - Add a new nexus hook: nexus_add_irq() to ask the nexus driver to add an IRQ to its irq_rman. The MSI code uses this when it creates new interrupt sources to let the nexus know about newly valid IRQs. Previously the msi_alloc() and msix_alloc() passed some extra stuff back to the nexus methods which then added the IRQs. This approach is a bit cleaner. - Change the MSI sx lock to a mutex. If we need to create new sources, drop the lock, create the required number of sources, then get the lock and try the allocation again. Revision Changes Path 1.32 +38 -27 src/sys/amd64/amd64/intr_machdep.c 1.30 +20 -2 src/sys/amd64/amd64/io_apic.c 1.39 +12 -0 src/sys/amd64/amd64/local_apic.c 1.6 +71 -57 src/sys/amd64/amd64/msi.c 1.77 +11 -15 src/sys/amd64/amd64/nexus.c 1.24 +1 -0 src/sys/amd64/include/apicvar.h 1.18 +5 -4 src/sys/amd64/include/intr_machdep.h 1.22 +11 -3 src/sys/amd64/isa/atpic.c 1.27 +38 -27 src/sys/i386/i386/intr_machdep.c 1.34 +20 -2 src/sys/i386/i386/io_apic.c 1.41 +13 -0 src/sys/i386/i386/local_apic.c 1.6 +71 -57 src/sys/i386/i386/msi.c 1.73 +11 -15 src/sys/i386/i386/nexus.c 1.24 +1 -0 src/sys/i386/include/apicvar.h 1.20 +5 -4 src/sys/i386/include/intr_machdep.h 1.28 +11 -3 src/sys/i386/isa/atpic.c