Registering handler/ISR for MSI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Registering handler/ISR for MSI

4,204 Views
gauthamkrishnan_r
Contributor II

I'm generating an MSI from Endpoint to Root Complex on T2080. How to register handler and route the MSI to appropriate ISR for an MSI received on Root Complex? I don't use linux or other OS. It's a baremetal driver. @ufedor 

Labels (1)
Tags (1)
0 Kudos
Reply
8 Replies

4,174 Views
gauthamkrishnan_r
Contributor II

How can we do this without using linux function calls? @ufedor @yipingwang 

0 Kudos
Reply

4,157 Views
yipingwang
NXP TechSupport
NXP TechSupport

You may have to monitor MSI capability registers for possible arrival of MSI write data, which would then invoke the handler you wish to call.

0 Kudos
Reply

4,152 Views
gauthamkrishnan_r
Contributor II

I'm currently polling MSI Status registers periodically to figure out any active interrupts. But reading MSI capability registers makes no sense to me with regard to active interrupts.

0 Kudos
Reply

4,147 Views
yipingwang
NXP TechSupport
NXP TechSupport

Could you poll the registers succesfully?
I meant something similar, the sequence is as below:

write memory address in memory address register.
write # messages requested in message control register
write basic data pattern in message data register
Set MSI enable in control register.


Now poll the interrupt status register on the RC side.

0 Kudos
Reply

4,145 Views
gauthamkrishnan_r
Contributor II

Yes, I'm able to poll it successfully but looking for a solution replicating generation of virtual interrupt numbers when using linux.

0 Kudos
Reply

4,124 Views
yipingwang
NXP TechSupport
NXP TechSupport

I think that will be possible only through linux system call interface.

0 Kudos
Reply

3,954 Views
yipingwang
NXP TechSupport
NXP TechSupport

Virtual interrupt numbers and its generation/handling are part of linux interrupt framework.
Why do you want to replicate it.

I think we have two clean options:

1. use linux system calls for interrupt framework and routing to interrupt handler through request_irq()

2. use manual polling of MSI interrupt and call a custom handler to handle the interrupt without involving linux interrupt framework.

This would make things simple.

0 Kudos
Reply

4,178 Views
yipingwang
NXP TechSupport
NXP TechSupport

To register handler, pci_enable_msi should be called it will reserve a MSI vector.
After that call request_irq function.

err = pci_enable_msi(my_pci_dev);
err = request_irq(my_pci_dev->irq, irq_handler, 0, "PCI_CARD", NULL);

to reserve multiple vectors, use this:

err = pci_enable_msi_block(my_pci_dev,3);
request_irq(my_pci_dev->irq, irq_handler_0, ...); request_irq(my_pci_dev->irq + 1, irq_handler_1, ...); request_irq(my_pci_dev->irq + 2, irq_handler_2, ...);

0 Kudos
Reply