Linux kernel UIO通用PCI支持中断吗?

Linux kernel UIO通用PCI支持中断吗?,linux-kernel,interrupt,pci,pci-e,Linux Kernel,Interrupt,Pci,Pci E,我使用uio通用驱动程序,硬件由连接到Intel ATOM cpu的PCIe设备(FPGA)组成 但是,在测试中,尽管在驱动程序中可以看到中断,但它并没有传递到用户空间 以下是我正在做的步骤: echo "10ee 0007" > /sys/bus/pci/drivers/uio_pci_generic/new_id 我使用等待中断的用户空间应用程序,正如代码示例中所述 我会触发一个FPGA中断,但不会给出用户空间应用程序的打印,存在一个异常: irq 23: nobody cared

我使用uio通用驱动程序,硬件由连接到Intel ATOM cpu的PCIe设备(FPGA)组成

但是,在测试中,尽管在驱动程序中可以看到中断,但它并没有传递到用户空间

以下是我正在做的步骤:

echo "10ee 0007" > /sys/bus/pci/drivers/uio_pci_generic/new_id
我使用等待中断的用户空间应用程序,正如代码示例中所述

我会触发一个FPGA中断,但不会给出用户空间应用程序的打印,存在一个异常:

irq 23: nobody cared (try booting with the "irqpoll" option)
[ 91.030760] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.18.16 #6
[ 91.037037] Hardware name: /conga-MA5, BIOS MA50R000 10/30/2019
[ 91.043302] Call Trace:
[ 91.045881] <IRQ>
[ 91.048002] dump_stack+0x5c/0x80
[ 91.051464] __report_bad_irq+0x35/0xaf
[ 91.055465] note_interrupt.cold.9+0xa/0x63
[ 91.059823] handle_irq_event_percpu+0x68/0x70
[ 91.064470] handle_irq_event+0x37/0x57
[ 91.068481] handle_fasteoi_irq+0x97/0x150
...
[ 91.176043] handlers:
[ 91.178419] [<00000000ec05b056>] uio_interrupt
[ 91.183054] Disabling IRQ #23

这是FPGA设备的问题吗?或者UIO通用PCI不支持中断吗?

在为irqhandler评论以下几行之后

我能够接收来自FPGA的中断

static irqreturn_t irqhandler(int irq, struct uio_info *info)
 {
      struct uio_pci_generic_dev *gdev = to_uio_pci_generic_dev(info);
-        if (!pci_check_and_mask_intx(gdev->pdev))
-                return IRQ_NONE;
    /* UIO core will signal the user process. */
    return IRQ_HANDLED;
}

然而,显然这仍然是一个解决办法,我们需要稍后研究为什么FPGA不在PCIe配置空间中的状态寄存器中与irq一起提供位状态更改。

您错过了请求中断的部分。您的意思是什么?PCI通用处理程序请求中断作为通用驱动程序代码的一部分。是的,您查看过吗?它似乎使用默认标志(仅在顶部添加共享)。您的案例更可能显示错误的极性设置。您可以向内核命令行添加
apic=debug
,以查看IRQ#23是如何路由的,以及使用了哪些标志。作为测试,您还可以替换
gdev->info.irq\u标志=IRQF\u共享
gdev->info.irq_标志=IRQF_共享| IRQF_触发器|低(如果默认为高激活)或
gdev->info.irq_flags=IRQF_SHARED | IRQF_TRIGGER_high否则。如果是这样的话,您需要找到一种方法,在FPGA级别或通过软件来修复默认极性。只有对pci_check_和_mask_intx的调用返回false。请仔细阅读我在上述评论中所写的内容。
02:00.0 RAM memory: Xilinx Corporation Default PCIe endpoint ID
        Subsystem: Xilinx Corporation Default PCIe endpoint ID
        Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 23
        Region 0: Memory at 91200000 (32-bit, non-prefetchable) [size=1M]
        Capabilities: [40] Power Management version 3
                Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [58] Express (v1) Endpoint, MSI 00
                DevCap: MaxPayload 256 bytes, PhantFunc 1, Latency L0s <64ns, L1 <1us
                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset- SlotPowerLimit 10.000W
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+
                        MaxPayload 256 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
                LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s, Exit Latency L0s unlimited
                        ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
        Capabilities: [100 v1] Device Serial Number 00-00-00-00-00-00-00-00
        Kernel driver in use: uio_pci_generic
static irqreturn_t irqhandler(int irq, struct uio_info *info)
 {
      struct uio_pci_generic_dev *gdev = to_uio_pci_generic_dev(info);
-        if (!pci_check_and_mask_intx(gdev->pdev))
-                return IRQ_NONE;
    /* UIO core will signal the user process. */
    return IRQ_HANDLED;
}