This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Custom PCI linux driver MSI

Hi,

 I am writing a custom module for Keystone 2 to handle a xilinx PCIe device and for this purpose i need to enable 4 MSI vectors. When i enable a single vector using pci_enable_msi(pdev) function the module works properly however when i try to enable multiple interrupts using the pci_enable_msi_block(pdev,32) the function returns 16 which means that it can allocate 16 interrupts however when i use  pci_enable_msi_block(pdev,16) the function returns 1 instead of 0. I tried passing all possible values to this function to see what is the result which is as below:

for(i=2;i<33;i++)
{
     ret = pci_enable_msi_block(pdev,i);
     printk(KERN_DEBUG "For request i=%d the return value is=%d\n",i, ret);
}

[ 89.421184] For request i=2 the return value is=1
[ 89.421196] For request i=3 the return value is=1
[ 89.421208] For request i=4 the return value is=1
[ 89.421220] For request i=5 the return value is=1
[ 89.421232] For request i=6 the return value is=1
[ 89.421243] For request i=7 the return value is=1
[ 89.421255] For request i=8 the return value is=1
[ 89.421266] For request i=9 the return value is=1
[ 89.421278] For request i=10 the return value is=1
[ 89.421290] For request i=11 the return value is=1
[ 89.421301] For request i=12 the return value is=1
[ 89.421313] For request i=13 the return value is=1
[ 89.421325] For request i=14 the return value is=1
[ 89.421336] For request i=15 the return value is=1
[ 89.421348] For request i=16 the return value is=1
[ 89.421353] For request i=17 the return value is=16
[ 89.421359] For request i=18 the return value is=16
[ 89.421364] For request i=19 the return value is=16
[ 89.421369] For request i=20 the return value is=16
[ 89.421374] For request i=21 the return value is=16
[ 89.421380] For request i=22 the return value is=16
[ 89.421385] For request i=23 the return value is=16
[ 89.421390] For request i=24 the return value is=16
[ 89.421395] For request i=25 the return value is=16
[ 89.421401] For request i=26 the return value is=16
[ 89.421406] For request i=27 the return value is=16
[ 89.421411] For request i=28 the return value is=16
[ 89.421416] For request i=29 the return value is=16
[ 89.421422] For request i=30 the return value is=16
[ 89.421427] For request i=31 the return value is=16
[ 89.421432] For request i=32 the return value is=16

the function is successful (returns 0) only when pci_enable_msi_block(pdev,1) is used.

my intended use is as below:

ret = pci_enable_msi_block(pdev,4);

// request irq to assign interrupt handlers

I have also tried to use the pci_enable_msi_exact and pci_enable_msi_range functions however the code does not compile due to an implicit function declaration error.

So kindly provide solution to this issue so that i can allocate and use multiple vectors.

Regards,

Yaseen

  • Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com). Please read all the links below my signature.

    We will get back to you on the above query shortly. Thank you for your patience.

    Thank you.

    Note: We strongly recommend you to create new e2e thread for your queries instead of following up on an old/closed e2e thread, new threads gets more attention than old threads and can provide link of old threads or information on the new post for clarity and faster response.

  • Dear Yaseen,
    Please refer to the following E2E post.
    e2e.ti.com/.../1530132
  • Thank you Titus,

    I have read the answer from the link you shared however the last sentence of the answer is not clear i.e " To allocate multiple interrupts for the device, the application can try to make multiple calls into pci_enable_msi_block() to get multiple interrupts." As per my understanding if i use the function as pci_enable_msi_block(pdev,1) it will allocate one interrupt and update the pdev->irq, how will it be possible to get multiple interrupts using this multiple times?

    Regards,