Skip to contentSkip to conversation

um: irq: don't set the chip for all irqs

PATCH In review Bartosz Golaszewski 2 participants 2 messages Mar 14, 2019 – Mar 15, 2019 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: irq: don't set the chip for all irqs

From: Bartosz Golaszewski <[email protected]>

Setting a chip for an interrupt marks it as allocated. Since UM doesn't support dynamic interrupt numbers (yet), it means we cannot simply increase NR_IRQS and then use the free irqs between LAST_IRQ and NR_IRQS with gpio-mockup or iio testing drivers as irq_alloc_descs() will fail after not being able to neither find an unallocated range of interrupts nor expand the range.

Only call irq_set_chip_and_handler() for irqs until LAST_IRQ.

---
Note: I plan to introduce support for SPARSE_IRQ but AFAICT it will be a bit more complicated, so in the meantime I'd like to propose this change.

 arch/um/kernel/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/kernel/irq.c +1 -1
index f4874b7ec503..598d7b3d9355 100644
@@ -479,7 +479,7 @@ void __init init_IRQ(void)
 	irq_set_chip_and_handler(TIMER_IRQ, &SIGVTALRM_irq_type, handle_edge_irq);
 
 
-	for (i = 1; i < NR_IRQS; i++)
+	for (i = 1; i < LAST_IRQ; i++)
 		irq_set_chip_and_handler(i, &normal_irq_type, handle_edge_irq);
 	/* Initialize EPOLL Loop */
 	os_setup_epoll();
Signature · 1 line
2.20.1
maintainer Reviewed-by Acked-by on v1 1/1
#1 lore raw
Quoted 25 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Setting a chip for an interrupt marks it as allocated. Since UM doesn't support dynamic interrupt numbers (yet), it means we cannot simply increase NR_IRQS and then use the free irqs between LAST_IRQ and NR_IRQS with gpio-mockup or iio testing drivers as irq_alloc_descs() will fail after not being able to neither find an unallocated range of interrupts nor expand the range.

Only call irq_set_chip_and_handler() for irqs until LAST_IRQ.

---
Note: I plan to introduce support for SPARSE_IRQ but AFAICT it will be a bit more complicated, so in the meantime I'd like to propose this change.

  arch/um/kernel/irq.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/kernel/irq.c +0 -0
index f4874b7ec503..598d7b3d9355 100644

arch/um/kernel/irq.c void __init init_IRQ(void) · line 485

Quoted 8 lines
arch/um/kernel/irq.c +1 -1
@@ -479,7 +479,7 @@ void __init init_IRQ(void)
  	irq_set_chip_and_handler(TIMER_IRQ, &SIGVTALRM_irq_type, handle_edge_irq);
 
 
-	for (i = 1; i < NR_IRQS; i++)
+	for (i = 1; i < LAST_IRQ; i++)
  		irq_set_chip_and_handler(i, &normal_irq_type, handle_edge_irq);
  	/* Initialize EPOLL Loop */
  	os_setup_epoll();
Signature · 3 lines
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/