Skip to contentSkip to conversation

x86: Wrap calls to 8259 with CONFIG_I8259_PIC

PATCH Superseded Bin Meng 3 participants 6 messages Nov 19, 2018 – Nov 27, 2018 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/2 x86: Wrap calls to 8259 with CONFIG_I8259_PIC

mask_irq(), unmask_irq() and specific_eoi() are provided by the i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.

---

 arch/x86/lib/interrupts.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/lib/interrupts.c +8 -1
index 297067d..b1dc6e1 100644
@@ -64,7 +64,9 @@ void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
 	irq_handlers[irq].arg = arg;
 	irq_handlers[irq].count = 0;
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
 	unmask_irq(irq);
+#endif
 
 	if (status)
 		enable_interrupts();
@@ -83,7 +85,9 @@ void irq_free_handler(int irq)
 
 	status = disable_interrupts();
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
 	mask_irq(irq);
+#endif
 
 	irq_handlers[irq].handler = NULL;
 	irq_handlers[irq].arg = NULL;
@@ -104,14 +108,17 @@ void do_irq(int hw_irq)
 	}
 
 	if (irq_handlers[irq].handler) {
+#if CONFIG_IS_ENABLED(I8259_PIC)
 		mask_irq(irq);
+#endif
 
 		irq_handlers[irq].handler(irq_handlers[irq].arg);
 		irq_handlers[irq].count++;
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
 		unmask_irq(irq);
 		specific_eoi(irq);
-
+#endif
 	} else {
 		if ((irq & 7) != 7) {
 			spurious_irq_cnt++;
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 x86: kconfig: Allow board defconfig file to disable 8259 and APIC

At present the Kconfig options (CONFIG_I8259_PIC and CONFIG_APIC) do not include a prompt message, which makes it impossible to be disabled from a board defconfig file.

---

 arch/x86/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/Kconfig +2 -2
index 8fc9187..e052093 100644
@@ -729,7 +729,7 @@ config PCIE_ECAM_SIZE
 	  maximum number of PCI buses as defined by the PCI specification.
 
 config I8259_PIC
-	bool
+	bool "Enable Intel 8259 compatible interrupt controller"
 	default y
 	help
 	  Intel 8259 ISA compatible chipset incorporates two 8259 (master and
@@ -737,7 +737,7 @@ config I8259_PIC
 	  the interrupt correctly.
 
 config APIC
-	bool
+	bool "Enable Intel Advanced Programmable Interrupt Controller"
 	default y
 	help
 	  The (A)dvanced (P)rogrammable (I)nterrupt (C)ontroller is responsible
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 x86: kconfig: Allow board defconfig file to disable 8259 and APIC

Quoted 11 lines · Bin Meng

At present the Kconfig options (CONFIG_I8259_PIC and CONFIG_APIC) do not include a prompt message, which makes it impossible to be disabled from a board defconfig file.

---

 arch/x86/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#3 lore raw

PATCH 1/2 x86: Wrap calls to 8259 with CONFIG_I8259_PIC

In reply to Bin Meng
Quoted 42 lines · Bin Meng

mask_irq(), unmask_irq() and specific_eoi() are provided by the i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.

---

  arch/x86/lib/interrupts.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/lib/interrupts.c +6 -0
index 297067d..b1dc6e1 100644
@@ -64,7 +64,9 @@ void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
  	irq_handlers[irq].arg = arg;
  	irq_handlers[irq].count = 0;
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
  	unmask_irq(irq);
+#endif
 
  	if (status)
  		enable_interrupts();
@@ -83,7 +85,9 @@ void irq_free_handler(int irq)
 
  	status = disable_interrupts();
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
  	mask_irq(irq);
+#endif
 
  	irq_handlers[irq].handler = NULL;
  	irq_handlers[irq].arg = NULL;
@@ -104,14 +108,17 @@ void do_irq(int hw_irq)
  	}
 
  	if (irq_handlers[irq].handler) {
+#if CONFIG_IS_ENABLED(I8259_PIC)
  		mask_irq(irq);
+#endif
 
  		irq_handlers[irq].handler(irq_handlers[irq].arg);

arch/x86/lib/interrupts.c void do_irq(int hw_irq) · line 124

Quoted 10 lines
arch/x86/lib/interrupts.c +2 -1
  		irq_handlers[irq].count++;
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
  		unmask_irq(irq);
  		specific_eoi(irq);
-
+#endif
  	} else {
  		if ((irq & 7) != 7) {
  			spurious_irq_cnt++;

Hi Bin,
thanks for this patch. This is working for my board.

With this we may drop my X86-noirq patch.

cheers,
Hannes

#4 lore raw

PATCH 1/2 x86: Wrap calls to 8259 with CONFIG_I8259_PIC

In reply to Bin Meng

Hi Bin,

Quoted 9 lines · Bin Meng

mask_irq(), unmask_irq() and specific_eoi() are provided by the i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.

---

 arch/x86/lib/interrupts.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Is it possible to use if() instead of #if ?

Regards,
Simon

author
#5 lore raw

PATCH 1/2 x86: Wrap calls to 8259 with CONFIG_I8259_PIC

Hi Simon,

Quoted 8 lines · Simon Glass

Hi Bin,

Quoted 4 lines · Bin Meng

mask_irq(), unmask_irq() and specific_eoi() are provided by the i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.

Quoted 8 lines
Quoted 5 lines

---

 arch/x86/lib/interrupts.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Is it possible to use if() instead of #if ?

Yes, I think so.

Regards,
Bin