Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 09-18-2019, 11:22 AM   #1
Registered: Aug 2014
Posts: 96

Rep: Reputation: Disabled
Doubt in IRQ handling of kernel


In IRQ flow of ARM architecture for example, when interrupt was triggered, in the architecture specific assembly file the Program Counter register was assigned the address of handle_arch_irq function, which in turn was assigned the function pointer "mdesc->handle_irq".

The handle_irq function pointer is declared in struct machine_desc. In that structure declaration, handle_irq function pointer has argument as struct pt_regs, whose definition is

struct pt_regs {
	unsigned long uregs[18];

But in the generic IRQ handling source code we don't have any handle_irq function having the struct pt_regs as argument.

Also in

it was mentioned as Whenever an interrupt triggers, the low-level architecture code calls into the generic interrupt code by calling desc->handle_irq().

But that generic interrupt code has two arguments irq number and struct irq_desc.

My doubt is will the struct pt_regs argument in architecture specific function pointer handle_irq smoothly type casted to the arguments of generic interrupt code handle_irq function pointer's 2 argument?

I got this doubt because I could not find exact match of function prototype between architecture specific function pointer and generic interrupt handling function pointer and as internally the arguments of generic code will be passed into the stack space which can be accommodated with struct pt_regs as it has just array of unsigned long.

Please reply whether my mapping is correct, if not what is the real logic?

Ayyappan M.

Last edited by ayyasprings; 09-18-2019 at 11:24 AM.
Old 09-19-2019, 06:28 AM   #2
Registered: Aug 2014
Posts: 96

Original Poster
Rep: Reputation: Disabled
I got it after code walkthrough.

the architecture specific mdesc->handle_irq function calls board specific function assigned to that.
which in turn calls handle_IRQ() which receives irq number as one of the argument, and that argument is passed to generic_handle_irq function if it was a valid interrupt which in turn extracts the irq_desc structure value based on the irq number which was populated either in bootup or driver initialization. And corresponding desc->handle_irq() of generic interrupt handling code, will be called with arguments irq number and struct irq_desc extracted.
1 members found this post helpful.
Old 09-19-2019, 06:47 AM   #3
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,146

Rep: Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935
Beyond me, but appreciate the update.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] RHEL 6.4 Error - kernel:do_IRQ: 1.205 No irq handler for vector (irq -1) capperdog Linux - Newbie 4 02-28-2014 08:56 AM
ISR mapping, Kernel IRQ to Real Processor IRQ Rajkamal Linux - Kernel 1 10-24-2012 08:28 AM
UNIQ IRQ and Shared IRQ...I want to make Shared IRQ routin chxooi Linux - Hardware 1 06-12-2010 07:30 AM
PCI IRQ Routing Table (PRT), doubt maheshstms Linux - Kernel 0 05-30-2007 07:35 AM
SCSI Errors when IRQ Shared - How do I not share IRQ MQMan Linux - Hardware 2 01-08-2006 11:42 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration