enable/disable PCI interrupts

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
As a course of learning linux device drivers, I'm implementing a PCIe  
driver, and I'd like to understand at what level the interrupts can be or  
should be enabled/disabled. I intentionally do not specify OS, as I'm  
assuming it should be relevant for any platform. By levels I mean the  

a) OS specific interrupts handling framework

b) Interrupts can be disabled or enabled in the PCI/PCIe configuration space  
registers, e.g. COMMAND register

c) Interrupts also can be masked at device level, for instance we can  
configure device not trigger certain interrupts to the host

I understand that whatever interrupt type is being used on PCIe (INTx  
emulation, MSI or MSI-X), it has to be delivered to the host OS. So my  
question is really -- do we actually have to enable or disable interrupts on  
every layer, or it's sufficient only at the closest to hardware, e.g. in  
relevant PCI registers?


We've slightly trimmed the long signature. Click to see the full one.
Re: enable/disable PCI interrupts

In Linux drivers I need to do enable the PCI device in the  
probe (example:
Then, when i want to be able to receive interrupts, I have to register the  
interrupt handler (request_irq, devm_request_irq or request_threaded_irq).
After that, I can control interrupts using the device resources:
Of course at the end I need to deregister the interrupt handler
(example: http://lxr.free-electrons.com/source/drivers/input/serio/pcips2.c
and disable the device

The above was one of the simplest PCI drivers. You can also analyse more co
mplex examples.

In case of PCIe devices you may need to switch on and off the MSI modes:

Of course the above is very simplified description.
You can find more information in:

particularly in:

HTH & Regards,

W dniu pi?tek, 13 listopada 2015 14:55:55 UTC+1 u?ytkownik Mark n
Quoted text here. Click to load it
Quoted text here. Click to load it
Quoted text here. Click to load it
Quoted text here. Click to load it
Quoted text here. Click to load it

Site Timeline