Tuesday, January 15, 2013

ARM: Interrupts in Linux

This is based on Linux kernel 3.8-rc1.

When an interrupt has occurred: (Code flow from top to bottom)

[GIC: Global Interrupt Controller]

For the SoCs which are using ARM GIC:

arch/arm/kernel/setup.c:
 
handle_arch_irq = mdesc->handle_irq

arch/arm/mach-ux500/board-mop500.c:
.handle_irq     = gic_handle_irq,

arch/arm/common/gic.c:
gic_handle_irq:handle_IRQ

arch/arm/kernel/irq.c:
handle_IRQ:generic_handle_irq

For the SoCs which are using their own GIC:
arch/arm/kernel/entry-armv.S:

__irq_svc:irq_handler:arch_irq_handler_default

arch/arm/include/asm/entry-macro-multi.S

arch_irq_handler_default:
get_irqnr_preamble
get_irqnr_and_base - An arch specific function which gets the IRQ no.
asm_do_IRQ

arch/arm/kernel/irq.c

asm_do_IRQ:handle_IRQ:generic_handle_irq

Common code:
kernel/irq/irqdesc.c:
generic_handle_irq:generic_handle_irq_desc

include/linux/irqdesc.h:
generic_handle_irq_desc:desc->handle_irq

[TODO: FILL THE MISSING CODE FLOW]

"kernel/irq/handle.c":
handle_irq_event_percpu
action->handler: execute the interrupt handler
irq_wake_thread: wakeup threaded function
------------------------------------------------------------------
"kernel/irq/chip.c":
__irq_set_handler:desc->handle_irq = handle;

[TODO: FILL THE MISSING CODE FLOW]

kernel/irq/manage.c:
request_threaded_irq:__setup_irq
include/linux/interrupt.h
request_irq:request_threaded_irq

When an ISR is registered using request_irq(): (Code flow from bottom to top)


=========================================================================

1 comment:

  1. How does it jump to ret_from_intr after interrupt was handled?

    ReplyDelete