From owner-p4-projects@FreeBSD.ORG Mon Dec 31 07:22:54 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 925F616A420; Mon, 31 Dec 2007 07:22:54 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5746216A418 for ; Mon, 31 Dec 2007 07:22:54 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4698E13C448 for ; Mon, 31 Dec 2007 07:22:54 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBV7Mr5I035114 for ; Mon, 31 Dec 2007 07:22:53 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBV7MrDp035110 for perforce@freebsd.org; Mon, 31 Dec 2007 07:22:53 GMT (envelope-from kmacy@freebsd.org) Date: Mon, 31 Dec 2007 07:22:53 GMT Message-Id: <200712310722.lBV7MrDp035110@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 132159 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Dec 2007 07:22:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=132159 Change 132159 by kmacy@pandemonium:kmacy:xen31 on 2007/12/31 07:22:14 make interrupts work by having find_unbound_irq look at the dynirq range only register pic template on demand for devices Affected files ... .. //depot/projects/xen31/sys/i386/include/xen/evtchn.h#4 edit .. //depot/projects/xen31/sys/xen/evtchn/evtchn.c#4 edit Differences ... ==== //depot/projects/xen31/sys/i386/include/xen/evtchn.h#4 (text+ko) ==== @@ -56,6 +56,8 @@ void unmask_evtchn(int port); + + static inline void clear_evtchn(int port) { @@ -71,6 +73,13 @@ } /* + * Use these to access the event channel underlying the IRQ handle returned + * by bind_*_to_irqhandler(). + */ +int irq_to_evtchn_port(int irq); + + +/* * CHARACTER-DEVICE DEFINITIONS */ ==== //depot/projects/xen31/sys/xen/evtchn/evtchn.c#4 (text+ko) ==== @@ -219,16 +219,18 @@ static int find_unbound_irq(void) { - int irq; - - for (irq = 0; irq < NR_IRQS; irq++) + int dynirq, irq; + + for (dynirq = 0; dynirq < NR_IRQS; dynirq++) { + irq = dynirq_to_irq(dynirq); if (irq_bindcount[irq] == 0) break; - + } + if (irq == NR_IRQS) panic("No available IRQ to bind to: increase NR_IRQS!\n"); - return irq; + return (irq); } static int @@ -509,6 +511,7 @@ int retval; irq = bind_ipi_to_irq(ipi, cpu); + intr_register_source(&xp->xp_pins[irq].xp_intsrc); retval = intr_add_handler(devname, irq, NULL, handler, NULL, irqflags, NULL); if (retval != 0) { unbind_from_irq(irq); @@ -718,8 +721,8 @@ TODO; } - -void notify_remote_via_irq(int irq) +void +notify_remote_via_irq(int irq) { int evtchn = evtchn_from_irq(irq); @@ -877,6 +880,12 @@ mtx_unlock_spin(&irq_mapping_update_lock); } +int +irq_to_evtchn_port(int irq) +{ + return evtchn_from_irq(irq); +} + void mask_evtchn(int port) { @@ -1041,7 +1050,6 @@ tpin->xp_intsrc.is_pic = xp->xp_dynirq_pic; tpin->xp_vector = dynirq_to_irq(i); - intr_register_source(&tpin->xp_intsrc); } /* * Now, we go ahead and claim every PIRQ there is. @@ -1061,7 +1069,6 @@ tpin->xp_intsrc.is_pic = xp->xp_pirq_pic; tpin->xp_vector = pirq_to_irq(i); - intr_register_source(&tpin->xp_intsrc); } }