====== IRQ, ACPI and APIC and the Linux kernel ====== There are several **[[http://tldp.org/HOWTO/BootPrompt-HOWTO.html|boot prompt]]** parameters for troubleshooting IRQ problems with Linux. Here hare my notes on this subject. ===== irqpoll ===== | irqpoll | This reduces driver initialization failures due to shared interrupts. | **[[http://uwsg.iu.edu/hypermail/linux/kernel/0611.0/0830.html|Question:]]** My question is: once I specified the "irqpoll" option to boot the installation CD, is the system doomed to always work in "IRQ polling mode" (which is much more CPU wasteful if I understand this correctly)? Am I really using my hardware now in less than optimal manner (like in PIO vs. DMA, for example)? **[[http://uwsg.iu.edu/hypermail/linux/kernel/0611.0/0875.html|Answer:]]** irqpoll has a small impact, how big depends what the box does (on a gigabit network firewall its bad news, on a typical desktop its not measurable). IRQ problems of the form you report can arise from a couple of places - one is vendors getting IRQ routing tables wrong (suprisingly common), the other may be a Linux bug. Checking for a BIOS update may therefore be useful. ===== ACPI ===== | acpi=off | This parameter disables the whole ACPI system. This may prove very useful, for example, if your computer does not support ACPI or if you think the ACPI implementation might cause some problems. | | acpi=force | Activates the ACPI system even if your computer BIOS is prior to 2000. This parameter overwrites acpi=off and can also be used with current hardware if the ACPI support is not activated despite apm=off. | | pci=noacpi\\ acpi=noirq | This disables the use of ACPI routing information during the PCI configuration stages. | | pci=acpi | This parameter activates the PCI IRQ routing in the new ACPI system. | | acpi_irq_balance | ACPI is allowed to use PIC interrupts to minimize the common use of IRQs. | | acpi_irq_nobalance | ACPI is not allowed to use PIC interrupts. | | acpi_irq_pci=irq-number | List of IRQs that can be used by PCI. | | acpi_irq_isa=irq-number | List of IRQs that cannot be used by PCI. | | acpi=oldboot | Deactivates the ACPI system almost completely; only the components required for the boot process will be used. | | acpi=ht | Deactivates the ACPI system almost completely; only the components required for hyper threading will be used. | | acpi_os_name="Microsoft Windows" | | ===== APIC ===== | apic | This parameter instructs the kernel to use the APIC system. | | noapic | This parameter instructs the kernel not to use the APIC system. | | apic=verbose\\ apic=debug | Modify the quantity of information delivered by the APIC system on start. | | lapic | Activates the local APIC system even if it is disabled in the BIOS. | | nolapic | Disables the local APIC system even if it is activated in the BIOS. | ====== Interrupts ====== ===== Interrupt controllers ===== Evolution of interrupt controllers in PC: ^ PIC Intel 8259 | IRQ0 - IRQ7 | ^ Two PIC Intel 8259 | IRQ0 - IRQ15 | ^ IO-APIC | Max 255 physical hardware IRQ, typical system only around 24 total hardware lines | Historical IRQ assignment for two PIC systems: ^ IRQ 0 | System timer. Reserved for the system. Cannot be changed by a user. | ^ IRQ 1 | Keyboard. Reserved for the system. Cannot be altered even if no keyboard is present or needed. | ^ IRQ 2 | Second IRQ controller. See below for explanation. | ^ IRQ 3 | COM 2(Default) COM 4(User) | ^ IRQ 4 | COM 1(Default) COM 3(User) | ^ IRQ 5 | Sound card (Sound Blaster Pro or later) or LPT2(User) | ^ IRQ 6 | Floppy disk controller | ^ IRQ 7 | LPT1(Parallel port) or sound card (8-bit Sound Blaster and compatibles) | ^ IRQ 8 | Real time clock | ^ IRQ 9 | ACPI SCI or ISA MPU-401 | ^ IRQ 10 | Free / Open interrupt / Available | ^ IRQ 11 | Free / Open interrupt / Available | ^ IRQ 12 | PS/2 connector Mouse / If no PS/2 connector mouse is used, this can be used for other peripherals | ^ IRQ 13 | Math co-processor. Cannot be changed | ^ IRQ 14 | Primary IDE. If no Primary IDE this can be changed | ^ IRQ 15 | Secondary IDE | ===== APIC ===== From the paper [[http://osdev.berlios.de/pic.html|Advanced Programmable Interrupt Controller]]. Some motherboards have an **IO APIC** on them. Functionally, it replaces the 8259's. You must essentially shut off the 8259's and turn on the IO APIC to use it. The IO APIC is typically located at physical address FEC00000, **Local APIC** (LAPIC). Built into all recent x86 CPU chips (Pent Pro and up) is a thing called a Local APIC. It is addressed at physical addresses FEE00xxx. It is part of the CPU chip, can generate/accept interrupts. In multiprocessor system, the APIC's are wired together so they can communicate. A LAPIC feature - useful also in a single processor system - is the ability to set timer interrupts. ===== PCI interrupt routing ===== * **[[http://tldp.org/HOWTO/Plug-and-Play-HOWTO-7.html|PnP and PCI Interrupts]]** * **[[http://www.microsoft.com/whdc/archive/pciirq.mspx|PCI IRQ Routing Table Specification]]** * **[[http://mysite.verizon.net/~mrscary/devenum.htm|IRQ steering and device enumeration]]** * **[[http://pcmcia-cs.sourceforge.net/ftp/doc/PCMCIA-HOWTO-4.html#ss4.2|PCI interrupt configuration]]** **ISA and PCI** - Multiple PCI devices can share a PCI IRQ. On computers that use a PCI bus, the 16 standard IRQs can be programmed to either PCI or ISA mode. An IRQ cannot be programmed for both modes at once. Microsoft Windows 98 can get and use one of the following IRQ tables: * Get IRQ table using **ACPI BIOS** * Get IRQ table using **MS Specification Table** * Get IRQ table from **Protected Mode PCI BIOS 2.1 call** * Get IRQ table from **Real Mode PCI BIOS 2.1 call** **PCI** - Each PCI system board consists of one or more slots and a PCI Interrupt Router. Each slot has four interrupt pins, known as INTA#, INTB#, INTC#, and INTD#. The PCI Interrupt Router has several interrupt pins, known as PIRQ1#, PIRQ2#, PIRQ3#, ... PIRQn#. There is no PIRQ0#. The INTn# pins for each slot may be wire OR'd with other INTn# pins from the same or other slots, and these groups of pins may also be connected to a PIRQn# pin on the Interrupt Router. The actual PIRQ value assigned to each interrupt pin on each Interrupt Router is assigned by the chip-set vendor. Microsoft will work closely with chip-set vendors to assign appropriate PIRQ values for existing and future PCI chip sets. ===== Interrupt handlers ===== From the [[wp>Interrupt_handler|Interrupt handler Wikipedia article]]. In modern systems, interrupt handlers are split into two parts: the First-Level Interrupt Handler (FLIH) and the Second-Level Interrupt Handlers (SLIH). FLIHs are also known as hard interrupt handlers, fast interrupt handlers and top-half of interrupt, and SLIHs are also known as interrupt threads, slow interrupt handlers and bottom-half of interrupt. ===== ACPI specification ===== * **[[http://www.tldp.org/HOWTO/ACPI-HOWTO/|ACPI Howto]]** * **[[http://www.columbia.edu/~ariel/acpi/acpi_howto.html|Linux ACPI-HOWTO, The Sequel]]** From the [[wp>Advanced_Configuration_and_Power_Interface|ACPI Wikipedia article]]. The Advanced Configuration and Power Interface (ACPI) specification is an open industry standard. ACPI puts the operating system (OS) in control of power management. Conversely, the previously existing [[wp>Advanced_Power_Management|APM]] model assigns power management control to the BIOS, with limited intervention from the OS. In ACPI, the BIOS provides the OS with methods for directly controlling the dirty details of the hardware so it has nearly complete control over the power savings.