0

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

  1. should I try to define CONFIG_PCI_MSI_IRQ_DOMAIN? where can I config it?(I can not find it in kernel menuconfig)
  2. what is MSI IRQ Domain?
  3. or should I need to override arch_setup_msi_irqs()?
Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
hans.chen
  • 23
  • 2
  • Which arch are you using? Does it override `arch_setup_msi_irqs()`? – CL. Jan 23 '16 at 14:23
  • I use x86_64. I didn't override 'arch_setup_msi_irqs()'. Should I need to implement it? why? – hans.chen Jan 25 '16 at 06:58
  • The x86 arch code overrides `arch_setup_msi_irqs()`. Search there. – CL. Jan 25 '16 at 08:42
  • I find the `arch_setup_msi_irqs` function in \arch\x86\kernel\x86_init.c And it will call the `native_setup_msi_irqs` function in \arch\x86\kernel\apic\msi.c Unfortunately, It still always return 1 when nvec > 1 (just like previous one) But, the comment in source code is different `/* Multiple MSI vectors only supported with interrupt remapping */` I have no idea how to do. Could you guide a direction for me? Thank you. – hans.chen Jan 29 '16 at 08:34
  • Did CONFIG_IRQ_REMAP & setting INTEL_IOMMU/AMD_IOMMU work !! ? – Adit Ya Sep 18 '18 at 14:22

0 Answers0