@@ -132,62 +132,6 @@ x86_nmi(void)
132132 return (0 );
133133}
134134
135- /*
136- * Recalculate the interrupt masks from scratch.
137- *
138- * Must be called with intr_lock held.
139- */
140- void
141- intr_calculatemasks (struct cpu_info * ci )
142- {
143- int irq , level ;
144- u_int64_t unusedirqs , intrlevel [MAX_INTR_SOURCES ];
145- struct intrhand * q ;
146-
147- MUTEX_ASSERT_LOCKED (& intr_lock );
148-
149- /* First, figure out which levels each IRQ uses. */
150- unusedirqs = 0xffffffffffffffffUL ;
151- for (irq = 0 ; irq < MAX_INTR_SOURCES ; irq ++ ) {
152- int levels = 0 ;
153-
154- if (ci -> ci_isources [irq ] == NULL ) {
155- intrlevel [irq ] = 0 ;
156- continue ;
157- }
158- for (q = ci -> ci_isources [irq ]-> is_handlers ; q ; q = q -> ih_next )
159- levels |= (1 << q -> ih_level );
160- intrlevel [irq ] = levels ;
161- if (levels )
162- unusedirqs &= ~(1UL << irq );
163- }
164-
165- /* Then figure out which IRQs use each level. */
166- for (level = 0 ; level < NIPL ; level ++ ) {
167- u_int64_t irqs = 0 ;
168- for (irq = 0 ; irq < MAX_INTR_SOURCES ; irq ++ )
169- if (intrlevel [irq ] & (1 << level ))
170- irqs |= (1UL << irq );
171- }
172-
173- for (irq = 0 ; irq < MAX_INTR_SOURCES ; irq ++ ) {
174- int maxlevel = IPL_NONE ;
175- int minlevel = IPL_HIGH ;
176-
177- if (ci -> ci_isources [irq ] == NULL )
178- continue ;
179- for (q = ci -> ci_isources [irq ]-> is_handlers ; q ;
180- q = q -> ih_next ) {
181- if (q -> ih_level < minlevel )
182- minlevel = q -> ih_level ;
183- if (q -> ih_level > maxlevel )
184- maxlevel = q -> ih_level ;
185- }
186- ci -> ci_isources [irq ]-> is_maxlevel = maxlevel ;
187- ci -> ci_isources [irq ]-> is_minlevel = minlevel ;
188- }
189- }
190-
191135/*
192136 * Allocate an interrupt slot on the given cpu.
193137 * - Called with intr_lock held.
@@ -305,20 +249,10 @@ intr_allocate_slot(struct pic *pic, int legacy_irq, int pin, int level,
305249duplicate :
306250 if (pic == & i8259_pic )
307251 idtvec = ICU_OFFSET + legacy_irq ;
308- else {
309- #ifdef IOAPIC_HWMASK
310- if (level > isp -> is_maxlevel ) {
311- #else
312- if (isp -> is_minlevel == 0 || level < isp -> is_minlevel ) {
313- #endif
314- idtvec = idt_vec_alloc (APIC_LEVEL (level ),
315- IDT_INTR_HIGH );
316- if (idtvec == 0 ) {
317- return (EBUSY );
318- }
319- } else
320- idtvec = isp -> is_idtvec ;
321- }
252+ else if (isp -> is_idtvec == 0 )
253+ idtvec = idt_vec_alloc ();
254+ else
255+ idtvec = isp -> is_idtvec ;
322256 } else {
323257other :
324258 /*
@@ -342,7 +276,7 @@ intr_allocate_slot(struct pic *pic, int legacy_irq, int pin, int level,
342276 }
343277 return (EBUSY );
344278found :
345- idtvec = idt_vec_alloc (APIC_LEVEL ( level ), IDT_INTR_HIGH );
279+ idtvec = idt_vec_alloc ();
346280 if (idtvec == 0 ) {
347281 free (ci -> ci_isources [slot ], M_DEVBUF );
348282 ci -> ci_isources [slot ] = NULL ;
@@ -474,9 +408,6 @@ intr_establish(int legacy_irq, struct pic *pic, int pin, int type, int level,
474408
475409 * p = ih ;
476410
477- intr_calculatemasks (ci );
478-
479-
480411 if (source -> is_idtvec != idt_vec ) {
481412 if (source -> is_idtvec != 0 && source -> is_idtvec != idt_vec )
482413 idt_vec_free (source -> is_idtvec );
@@ -541,7 +472,6 @@ intr_disestablish(struct intrhand *ih)
541472
542473 * p = q -> ih_next ;
543474
544- intr_calculatemasks (ci );
545475 if (source -> is_handlers == NULL )
546476 pic -> pic_delroute (pic , ci , ih -> ih_pin , idtvec , source -> is_type );
547477 else
@@ -594,7 +524,7 @@ intr_handler(struct intrframe *frame, struct intrhand *ih)
594524
595525/*
596526 * Fake interrupt handler structures for the benefit of symmetry with
597- * other interrupt sources, and the benefit of intr_calculatemasks()
527+ * other interrupt sources.
598528 */
599529struct intrhand fake_softclock_intrhand ;
600530struct intrhand fake_softnet_intrhand ;
@@ -635,9 +565,6 @@ cpu_intr_init(struct cpu_info *ci)
635565 ci -> ci_isources [LIR_TIMER ] = isp ;
636566#endif
637567
638- mtx_enter (& intr_lock );
639- intr_calculatemasks (ci );
640- mtx_leave (& intr_lock );
641568}
642569
643570void
@@ -660,9 +587,9 @@ intr_printconfig(void)
660587 isp = ci -> ci_isources [i ];
661588 if (isp == NULL )
662589 continue ;
663- printf ("cpu%u source %d is pin %d from pic %s maxlevel %d \n" ,
590+ printf ("cpu%u source %d is pin %d from pic %s\n" ,
664591 ci -> ci_apicid , i , isp -> is_pin ,
665- isp -> is_pic -> pic_name , isp -> is_maxlevel );
592+ isp -> is_pic -> pic_name );
666593 for (ih = isp -> is_handlers ; ih != NULL ;
667594 ih = ih -> ih_next )
668595 printf ("\thandler %p level %d\n" ,
0 commit comments