Registering handler/ISR for MSI

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Registering handler/ISR for MSI

4,216 次查看
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 

标签 (1)
标记 (1)
0 项奖励
回复
8 回复数

4,186 次查看
gauthamkrishnan_r
Contributor II

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

0 项奖励
回复

4,169 次查看
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 项奖励
回复

4,164 次查看
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 项奖励
回复

4,159 次查看
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 项奖励
回复

4,157 次查看
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 项奖励
回复

4,136 次查看
yipingwang
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

3,966 次查看
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 项奖励
回复

4,190 次查看
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 项奖励
回复