Skip to contentSkip to conversation

x86/apic: Allow reprogramming IOAPIC pins the first time for non-legacy IRQs

PATCH In review Mario Limonciello 1 participant 3 messages Oct 20, 2023 – Oct 23, 2023 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86/apic: Allow reprogramming IOAPIC pins the first time for non-legacy IRQs

If the system is set up without legacy IRQs configured acpi_register_gsi_ioapic() still needs to be able to program the IOAPIC to match the values from _CRS which might not match what is already programmed to the IOAPIC.

---
 arch/x86/kernel/apic/io_apic.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/x86/kernel/apic/io_apic.c +2 -6
index 00da6cf6b07d..27dd279dcc7b 100644
@@ -928,12 +928,8 @@ static bool mp_check_pin_attr(int irq, struct irq_alloc_info *info)
 {
 	struct mp_chip_data *data = irq_get_chip_data(irq);
 
-	/*
-	 * setup_IO_APIC_irqs() programs all legacy IRQs with default trigger
-	 * and polarity attributes. So allow the first user to reprogram the
-	 * pin with real trigger and polarity attributes.
-	 */
-	if (irq < nr_legacy_irqs() && data->count == 1) {
+	/* allow the first user to reprogram the pin with real trigger and polarity */
+	if (data->count == 1) {
 		if (info->ioapic.is_level != data->is_level)
 			mp_register_handler(irq, info->ioapic.is_level);
 		data->entry.is_level = data->is_level = info->ioapic.is_level;
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 x86/irq/i8259: Configure null pic to have one legacy IRQ

If the system is configured with the NULL PIC, the system should still be able to set up the timer IRQ at IRQ 0.

---
 arch/x86/kernel/i8259.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/i8259.c +1 -1
index 43c1c24e934b..885687e64e4e 100644
@@ -424,7 +424,7 @@ static int legacy_pic_probe(void)
 }
 
 struct legacy_pic null_legacy_pic = {
-	.nr_legacy_irqs = 0,
+	.nr_legacy_irqs = 1,
 	.chip = &dummy_irq_chip,
 	.mask = legacy_pic_uint_noop,
 	.unmask = legacy_pic_uint_noop,
Signature · 1 line
2.34.1
#2 lore raw
In reply to Mario Limonciello
Quoted 21 lines · Mario Limonciello

If the system is set up without legacy IRQs configured acpi_register_gsi_ioapic() still needs to be able to program the IOAPIC to match the values from _CRS which might not match what is already programmed to the IOAPIC.

---
  arch/x86/kernel/apic/io_apic.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)
arch/x86/kernel/apic/io_apic.c +0 -1
index 00da6cf6b07d..27dd279dcc7b 100644
@@ -928,12 +928,8 @@ static bool mp_check_pin_attr(int irq, struct irq_alloc_info *info)
  {
  	struct mp_chip_data *data = irq_get_chip_data(irq);
 
-	/*

arch/x86/kernel/apic/io_apic.c static bool mp_check_pin_attr(int irq, struct irq_alloc_info *info) · line 935

Quoted 10 lines
arch/x86/kernel/apic/io_apic.c +2 -5
-	 * setup_IO_APIC_irqs() programs all legacy IRQs with default trigger
-	 * and polarity attributes. So allow the first user to reprogram the
-	 * pin with real trigger and polarity attributes.
-	 */
-	if (irq < nr_legacy_irqs() && data->count == 1) {
+	/* allow the first user to reprogram the pin with real trigger and polarity */
+	if (data->count == 1) {
  		if (info->ioapic.is_level != data->is_level)
  			mp_register_handler(irq, info->ioapic.is_level);
  		data->entry.is_level = data->is_level = info->ioapic.is_level;

David mentioned it on the Bugzilla, but for the benefit of those not looking there, this series is confirmed to fix the problem.