hi, Experts
I have been long trapped on failure when loading altera pcie driver .ko module. I am trying to connect IMX8MQ with altera cyclone thru PCIE1.0/1 lane. My kernel is 4.9.88 and demo board is IMX8MQ evk and Terasic C5P, they are connected thru a M.2 to pcie adaptor.
The failure was reported when calling request_irq(), and return -22, which is EINVAL. Then I digged into the kernel and found failure was happened in irq_settings_can_request() (/kernel/irq/manage.c), which means the irq line is not allowed to request.
In the probe function of pcie driver, before request_irq(), I used pci_alloc_irq_vectors(pdev, 1,1, PCI_IRQ_ALL_TYPES) to enable one MSI, following is the debug log:
[ 72.098972] alt_up_pci init(), build at Jun 19 2020 08:57:28
[ 72.105806] alt_up_pci 0001:01:00.0: enabling device (0000 -> 0002)
[ 72.112302] pci_enable_device OK.
[ 72.115856] pci_request_regions OK.
[ 72.119611] pci_set_dma_mask OK.
[ 72.123050] pci_set_consistent_dma_mask OK.
[ 72.127508] alt_up_pci BAR2 initialized.
[ 72.131749] alt_up_pci BAR4 initialized.
[ 72.135848] PCIE BAR initialization OK.
[ 72.139904] alt_up_pci DMA0 initialized as type2.
[ 72.144890] alt_up_pci_dev_init OK.
[ 72.148590] pci_alloc_irq_vectors OK.
[ 72.152470] mydev->irq_line is 15!
[ 72.156082] Sanity-check passed!
[ 72.159431] irq_to_desc passed!
[ 72.162695] desc->status_use_accessors value is 68608
[ 72.168150] _IRQ_NOREQUEST value is 2048
[ 72.172274] _IRQ_PER_CPU_DEVID value is 131072
[ 72.176973] return val of request_irq is -22!
[ 72.181528] pci_request_irq() failed.
[ 72.185484] alt_up_pci_probe() failed with error: -22
The status_use_accessors value is 0x10c00, and irq_settings_can_request(), where this value and with _IRQ_NOREQEUST, the result is not zero, so EINVAL returned.
This is really puzzled for me. What I am dong wrong ? Attachment is pcie driver.
Hi Chenguang
4.9.88 kernel is very old and not more supported, recommended to
try latest kernels described on link
Embedded Linux for i.MX Applications Processors | NXP
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------