1
votes

Hello iam developing PCIe communication between Xilinx FPGA and Intel PC... I have written a kernel module(linux driver), i am using INTx interrupts. I am facing the problem in interrupt handling....

Before loading kernel module:

from lspci: INT A-->11

from config read : INT A-->11

from /proc/interrupts : Nothing because irq not registerd

After loading kernel module:

from lspci: INT A-->16

from config read : INT A-->11

from /proc/interrupts : INT 11 registerd

When i run the program in FPGA it was sending interrupt to IRQ-16 and saying no body cared and it was disabled.

in my module_init:

request_irq(dev->gIrq, XPCIe_IRQHandler, IRQF_SHARED, gDrvrName, gDev));

My irq handler:

static irqreturn_t XPCIe_IRQHandler(int irq, void *dev_id, struct pt_regs *regs)
{    return IRQ_HANDLED; }

So anybody can say what the problem may be....

2

2 Answers

0
votes

You don't show where your dev->gIrq is set from, but your kernel module should be taking the interrupt number from the struct pci_dev associated with your device. See this comment in include/linux/pci.h:

struct pci_dev {
    ...
    /*
     * Instead of touching interrupt line and base address registers
     * directly, use the values stored here. They might be different!
     */
    unsigned int    irq;
0
votes

Yeah Gil, thanks for your reply.. in the code

 request_irq(dev->gIrq, XPCIe_IRQHandler, IRQF_SHARED, gDrvrName, gDev));

dev->gIrq is nothing but which i have taken from the pci_dev struct only.

and

Andy iam not using any MSI or MSI-X interrupts to use pci_alloc_irq_vectors().