Hello masasi,
Please use the function pci_enable_msi to set up the MSI capability for the device.
int pci_enable_msi(struct pci_dev *dev)
A successful call allocates ONE interrupt to the device, regardless of how many MSIs the device supports. The device is switched from pin-based interrupt mode to MSI mode. The dev->irq number is changed to a new number which represents the message signaled interrupt; consequently, this function should be called before the driver calls request_irq(), because an MSI is delivered via a vector that is different from the vector of a pin-based interrupt.
Please refer to the document Documentation/PCI/MSI-HOWTO.txt for details, and refer to sample code drivers/net/ethernet/intel/e1000e/netdev.c.
The interrupt number is set at the mpic init, its value is determined by the register "Shared Message Signaled Interrupt Vector/Priority Register (MSIVPRs)".
The msi node is defined here:
Documentation/devicetree/bindings/powerpc/fsl/msi-pic.txt
Related code:
arch/powerpc/sysdev/fsl_msi.c
Please refer to the following example.
interrupts : each one of the interrupts here is one entry per 32 MSIs, and routed to the host interrupt controller. the interrupts should be set as edge sensitive. If msi-available-ranges is present, only the interrupts that correspond to available ranges shall be present.
The interrupt number "e0, e1, ..." is calculated from the offset address of the register "Shared Message Signaled Interrupt Vector/Priority Register(MSIVPRs)".
msi@41600 {
compatible = "fsl,mpic-msi";
reg = <0x41600 0x80>;
msi-available-ranges = <0 0x100>;
interrupts = <
0xe0 0 0 0
0xe1 0 0 0
0xe2 0 0 0
0xe3 0 0 0
0xe4 0 0 0
0xe5 0 0 0
0xe6 0 0 0
0xe7 0 0 0>;
};
Have a great day,
Yiping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------