I try to enable PCI MSI with
nvec = pci_enable_msi_range(dev, 1, 4);
but nvec is alway return 1 vector(I'm sure my PCIe endpoint enable MSI capability). I find the original IRQ=17 had mapped into 109. So I guest the MSI works. But, just only one vector. I trace the kernel source and find the problem is cause at
pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
My kernel doesn't define CONFIG_PCI_MSI_IRQ_DOMAIN. so the pci_msi_setup_msi_irqs is defined as arch_setup_msi_irqs
#define pci_msi_setup_msi_irqs arch_setup_msi_irqs
int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
{
struct msi_desc *entry;
int ret;
/*
* If an architecture wants to support multiple MSI, it needs to
* override arch_setup_msi_irqs()
*/
if (type == PCI_CAP_ID_MSI && nvec > 1)
return 1;
...
}
I think that is the root cause why my MSI fail.
My question are
- should I try to define CONFIG_PCI_MSI_IRQ_DOMAIN? where can I config it?(I can not find it in kernel menuconfig)
- what is MSI IRQ Domain?
- or should I need to override arch_setup_msi_irqs()?