Skip to contentSkip to conversation

Understandig ACPI routing PCI IRQ

DISCUSSION Niccolo Rigacci 3 participants 3 messages Nov 19, 2006 – Dec 11, 2006 ACPI

lore
Share & tools
lore
#0 lore raw

Hi, I'm trying to write a little howto about IRQ on modern PCs.

I still have some obscure points, can someone help me understanding the following dmesg messages?

ACPI: PCI Interrupt Link [LNK1] (IRQs *5 7 9 10 11 14 15)
ACPI: PCI Interrupt Link [APSI] (IRQs 20 21 22 23) *0, disabled.

Is the label [APSI] coming from the BIOS? I see several labels in dmesg like LNK1, LUBA, LSID, APC1, ... what is the meaning?

What it the IRQs list? Are those the possible values to route that phisical link to?

Why some PCI interrupt links are assigned at the very begin of boot process, where others are first disabled and then enabled later?

ACPI: PCI Interrupt Link [APSI] enabled at IRQ 23
ACPI: PCI Interrupt 0000:00:0e.0[A] -> Link [APSI] -> GSI 23 (level, low) -> IRQ 185

In the above log entries, what does it means GSI?

I understand that in PCI slot 0e, there is a device 0, that uses the first slot interrupt line (INTA#), which is routed to the CPU IRQ 185. But what there is in the middle?

If someone knows detailed explanation of lspci and dmesg, give me a pointer.

Thank you very much.

Signature · 4 lines
Niccolo Rigacci
Firenze - Italy

Iraq, missione di pace: 47249 morti - www.iraqbodycount.net
#1 lore raw
Quoted 9 lines · Niccolo Rigacci

Hi, I'm trying to write a little howto about IRQ on modern PCs.

I still have some obscure points, can someone help me understanding the following dmesg messages?

   ACPI: PCI Interrupt Link [LNK1] (IRQs *5 7 9 10 11 14 15)
   ACPI: PCI Interrupt Link [APSI] (IRQs 20 21 22 23) *0, disabled.

Is the label [APSI] coming from the BIOS?

Yes. The PCI interrupt link is a device in the ACPI namespace, and "APSI" is the name of it.

Quoted 2 lines

I see several labels in
dmesg like LNK1, LUBA, LSID, APC1, ... what is the meaning?

These names are completely arbitrary and are made up by the BIOS writer. There's no consistency between different BIOSes.

Quoted 2 lines

What it the IRQs list? Are those the possible values to route that phisical link to?

Yes. The ACPI link device shows the "possible" resource settings, which are printed as this list. The currently setting is shown with the "*".

Quoted 3 lines

Why some PCI interrupt links are assigned at the very begin of boot process, where others are first disabled and then enabled later?

We currently disable all PCI interrupt links initially at the end of acpi_pci_link_add().

We used to route all PCI interrupts at boot-time. That was somewhat wasteful because we assigned IRQs for devices that didn't have drivers, for unused PCI interrupt lines (if device 0000:00:0e.0 used INTA#, we assigned IRQs for the unused INTB#, INTC#, and INTD# lines as well), and even for empty slots.

We now route the interrupt when the device driver calls pci_enable_device().

Quoted 4 lines

ACPI: PCI Interrupt Link [APSI] enabled at IRQ 23
ACPI: PCI Interrupt 0000:00:0e.0[A] -> Link [APSI] -> GSI 23 (level, low) -> IRQ 185

In the above log entries, what does it means GSI?

"GSI" is an ACPI term that means "global system interrupt." There's some discussion in section 5.2.12 of the ACPI 3.0 spec. Basically it's a number that identifies either an I/O APIC interrupt input or a legacy 8259 IRQ.

For every I/O APIC in the system, ACPI tells you the base GSI and the APIC type and address (this is either in the MADT or in _MAT objects). Given the type (IOAPIC, IOSAPIC, etc) and the address, you can read the APIC "Max Redir Entry" register to find out how many interrupt inputs it has.

So if you have this:

GSI base #inputs

  IOAPIC 0      32        16
  IOAPIC 1      48        16
  IOAPIC 2      64         8

GSIs 32-47 correspond to inputs on IOAPIC 0, GSIs 48-63 correspond to IOAPIC 1, and GSIs 64-71 correspond to IOAPIC 2.

The GSI numbers are determined by the BIOS. The Linux IRQ numbers (e.g., IRQ 185) are determined by the OS.

Quoted 3 lines

I understand that in PCI slot 0e, there is a device 0, that uses the first slot interrupt line (INTA#), which is routed to the CPU IRQ 185. But what there is in the middle?

I don't know much about the link devices.

reviewer
#2 lore raw
In reply to Niccolo Rigacci
Quoted 10 lines · Niccolo Rigacci

Hi, I'm trying to write a little howto about IRQ on modern PCs.

I still have some obscure points, can someone help me understanding the following dmesg messages?

   ACPI: PCI Interrupt Link [LNK1] (IRQs *5 7 9 10 11 14 15)
   ACPI: PCI Interrupt Link [APSI] (IRQs 20 21 22 23) *0, disabled.

Is the label [APSI] coming from the BIOS? I see several labels in dmesg like LNK1, LUBA, LSID, APC1, ... what is the meaning?

Arbitrary 4-character AML names chosen by the BIOS programmer for ACPI PCI Interrupt Link devices.

There are basically two modes, PIC mode and APIC mode. It is common for programmers to use names that begin with 'A" for APIC mode devices -- which clearly is the case above since the GSI's are above 15.

Quoted 2 lines

What it the IRQs list? Are those the possible values to route that phisical link to?

Yes, as communicated by the BIOS AML _PRS -- Possibile resource settings.

Quoted 8 lines

Why some PCI interrupt links are assigned at the very begin of boot process, where others are first disabled and then enabled later?

ACPI: PCI Interrupt Link [APSI] enabled at IRQ 23
ACPI: PCI Interrupt 0000:00:0e.0[A] -> Link [APSI] -> GSI 23 (level, low) -> IRQ 185

In the above log entries, what does it means GSI?

GSI = Global System Interrupt.
Ie. interrupts as seen as a single list from 0..n for the entire system. This used to be synonymous with the IRQ#, but got screwed up by the MSI code and also some platforms specific IRQ re-numbering code that make the IRQ numbers look "funny". Some of this code is being un-done now and the GSI and IRQ will more often be the same in 2.6.19 onward.

Quoted 3 lines

I understand that in PCI slot 0e, there is a device 0, that uses the first slot interrupt line (INTA#), which is routed to the CPU IRQ 185. But what there is in the middle?

That is the ACPI PCI Interrupt Link. Its name is APSI and per the message above it could be programmed to 20, 21, 22, or 23. Here Linux chose 23 -- which will depend on what other devices are in the system and the probe order.

Quoted 2 lines

If someone knows detailed explanation of lspci and dmesg, give me a pointer.

Well, the other part of the dmesg line above it the '*' which tells you where the link is currently programmed. Generally Linux tries to not move IRQs in PIC mode, but by default will balance them in IO-APIC mode to minimize sharing.

cheers,
-Len