xenomai3内核的pcie中断报错

说明

客户让调试(asm1184e)pcie转4网口的rtl8111f,在实时内核上。

报错

不插不报错,插上转接网卡就会报错oops,报错如下。

[    4.135563] ------------[ cut here ]------------ 
[    4.135567] irqchip rk-pcie-legacy-int is not pipeline-safe! 
[    4.135582] WARNING: CPU: 0 PID: 199 at kernel/irq/chip.c:52 irq_set_chip+0xbc/0xd0
[    4.135607] Modules linked in: 
[    4.135616] CPU: 0 PID: 199 Comm: rk-pcie Not tainted 6.1.99-xeno #38
[    4.135624] Hardware name: Rockchip RK3588 EVB7 V11 Board (DT) 
[    4.135628] IRQ stage: Linux
[    4.135633] pstate: 604000c9 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) 
[    4.135641] pc : irq_set_chip+0xbc/0xd0
[    4.135650] lr : irq_set_chip+0xbc/0xd0
[    4.135659] sp : ffffffc00c24b8b0
[    4.135662] x29: ffffffc00c24b8b0 x28: 0000000000000000 x27: 0000000000000000
[    4.135674] x26: ffffff81014f7410 x25: ffffffc00a4359d0 x24: ffffff81031ca800
[    4.135686] x23: 0000000000000080 x22: 0000000000000080 x21: 0000000000000000
[    4.135697] x20: ffffffc00a435d40 x19: ffffff81008e5c00 x18: 0000000000000020
[    4.135707] x17: 3620666666666633 x16: 30303978302d3030 x15: ffffffffffffffff
[    4.135718] x14: ffffff8104dc2504 x13: 21656661732d656e x12: 696c657069702074
[    4.135729] x11: ffffffc00a2936e8 x10: ffffffffffffffff x9 : ffffffc0080b2454
[    4.135740] x8 : 00000000ffffffff x7 : 656e696c65706970 x6 : 00000000ffffe387
[    4.135750] x5 : ffffff82f6d29a68 x4 : 00000000ffffe387 x3 : ffffffc2ed05f000
[    4.135761] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffff8100adc880
[    4.135773] Call trace: 
[    4.135777]  irq_set_chip+0xbc/0xd0
[    4.135788]  irq_set_chip_and_handler_name+0x3c/0xa4
[    4.135800]  rk_pcie_intx_map+0x3c/0x60
[    4.135811]  irq_domain_associate_locked+0x70/0x1d0
[    4.135820]  irq_create_mapping_affinity_locked+0x88/0x1a4
[    4.135827]  irq_create_fwspec_mapping+0xfc/0x330
[    4.135835]  irq_create_of_mapping+0x6c/0x90
[    4.135842]  of_irq_parse_and_map_pci+0x16c/0x250
[    4.135854]  pci_assign_irq+0xd4/0x130
[    4.135865]  pci_device_probe+0x38/0x140
[    4.135872]  really_probe+0xc4/0x3e0
[    4.135882]  __driver_probe_device+0x80/0x160
[    4.135889]  driver_probe_device+0x40/0x110
[    4.135895]  __device_attach_driver+0xb8/0x150
[    4.135902]  bus_for_each_drv+0x7c/0xd0
[    4.135913]  __device_attach+0xac/0x1e4
[    4.135920]  device_attach+0x18/0x20
[    4.135925]  pci_bus_add_device+0x54/0xc0
[    4.135937]  pci_bus_add_devices+0x40/0x90
[    4.135946]  pci_host_probe+0x44/0xc4
[    4.135952]  dw_pcie_host_init+0x204/0x660
[    4.135959]  rk_pcie_really_probe+0x4b4/0x9c4
[    4.135967]  kthread+0x110/0x114
[    4.135979]  ret_from_fork+0x10/0x20
[    4.135989] 
[    4.135989] PC: 0xffffffc0080bb73c: 
[    4.135993] b53c  b4000061 f9402c21 b5000081 f9401400 b5ffff60 d65f03c0 a9bf7bfd 910003fd
[    4.136018] b55c  d63f0020 a8c17bfd d65f03c0 52800000 d65f03c0 aa1e03e9 d503201f f9401400
[    4.136040] b57c  f9400c02 f9406c42 b40000c2 a9bf7bfd 910003fd d63f0040 a8c17bfd d65f03c0
[    4.136062] b59c  128004a0 d65f03c0 aa1e03e9 d503201f f9401400 f9400c02 f9408043 37200103
[    4.136084] b5bc  f9403442 b4000102 a9bf7bfd 910003fd d63f0040 a8c17bfd d65f03c0 52800000
[    4.136105] b5dc  d65f03c0 128004a0 d65f03c0 d503201f d503201f aa1e03e9 d503201f f9401400

分析

主要是这一句:

[    4.135567] irqchip rk-pcie-legacy-int is not pipeline-safe! 
[    4.135582] WARNING: CPU: 0 PID: 199 at kernel/irq/chip.c:52 irq_set_chip+0xbc/0xd0

就是 irq_set_chip 中断的错误。

然后去xenomai官网查看中断部分:

https://v4.xenomai.org/dovetail/porting/irqflow/index.html

其中的:

alt text

根据里面的例子:

alt text

修改即可。

修改

struct irq_chip rk_pcie_legacy_irq_chip 的flag上加 IRQCHIP_PIPELINE_SAFE 即可。

patch:

    插入pcie网卡中断问题

diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
index 8984bfbd7ece..7dcf7e112c95 100644
--- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
+++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
@@ -978,7 +978,7 @@ static struct irq_chip rk_pcie_legacy_irq_chip = {
        .irq_disable    = rk_pcie_legacy_irq_mask,
        .irq_mask       = rk_pcie_legacy_irq_mask,
        .irq_unmask     = rk_pcie_legacy_irq_unmask,
-       .flags          = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND,
+       .flags          = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_PIPELINE_SAFE,
 };

 static int rk_pcie_intx_map(struct irq_domain *domain, unsigned int irq,

posted @ 2025-11-28 17:14  杨旭0324  阅读(13)  评论(0)    收藏  举报