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.

[参考译文] J784S4XEVM:PCIe RC 使能 BAR 0 崩溃

Guru**** 2694485 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1596683/j784s4xevm-pcie-rc-enable-bar-0-crash

器件型号: J784S4XEVM

尊敬的专家:

我将 J784S4 EVM 与 SDK 10 配合使用。

我正在进行 2 个 EVM 之间的 PCIe 连接。

在 RC 侧、我能够启用 BAR 1。

但当我启用 bar 0 时、Linux 将崩溃

root@j784s4-evm:~# devmem2 0xd100300 w 0x106
/dev/mem opened.
Memory mapped at address 0xffff94b27000.
Read at address  0x0D100300 (0xffff94b27300): 0x00012400
Write at address 0x0D100300 (0xffff94b27300): 0x00000106, readback 0x00000106
root@j784s4-evm:~# echo 1 > /sys/bus/pci/devices/0000\:00\:00.0/remove
-sh: /sys/bus/pci/devices/0000:00:00.0/remove: No such file or directory
root@j784s4-evm:~# echo 1 > /sys/bus/pci/rescan
[  170.773002] pci 0000:00:00.0: [104c:b012] type 01 class 0x060400
[  170.779042] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x000000ff]
[  170.785411] pci 0000:00:00.0: supports D1
[  170.789417] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[  170.797566] pci 0000:00:00.0: BAR 0: assigned [mem 0x10011000-0x100110ff]
[  170.804364] pci 0000:00:00.0: PCI bridge to [bus 01]
[  170.809446] pcieport 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
[  191.804815] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
[  191.810899] rcu:     4-...!: (5 ticks this GP) idle=d46c/1/0x4000000000000000 softirq=2662/2662 fqs=3
[  191.819840] rcu:     (detected by 0, t=5254 jiffies, g=4301, q=670 ncpus=8)
[  191.826523] Task dump for CPU 4:
[  191.829737] task:sh              state:R  running task     stack:0     pid:1124  ppid:678    flags:0x00000205
[  191.839632] Call trace:
[  191.842067]  __switch_to+0xcc/0x12c
[  191.845557]  msix_setup_msi_descs+0x40/0x134
[  191.849817]  __pci_enable_msix_range+0x368/0x610
[  191.854420]  pci_alloc_irq_vectors_affinity+0xc4/0x144
[  191.859546]  pci_alloc_irq_vectors+0x14/0x20
[  191.863803]  pcie_portdrv_probe+0x1d8/0x5f0
[  191.867973]  pci_device_probe+0xa4/0x168
[  191.871882]  really_probe+0x148/0x2b0
[  191.875533]  __driver_probe_device+0x78/0x12c
[  191.879876]  driver_probe_device+0xd8/0x15c
[  191.884046]  __device_attach_driver+0xb8/0x134
[  191.888476]  bus_for_each_drv+0x88/0xe8
[  191.892298]  __device_attach+0xa0/0x190
[  191.896120]  device_attach+0x14/0x20
[  191.899684]  pci_bus_add_device+0x64/0xd4
[  191.903682]  pci_bus_add_devices+0x3c/0x88
[  191.907766]  pci_rescan_bus+0x30/0x44
[  191.911414]  rescan_store+0x84/0xa8
[  191.914889]  bus_attr_store+0x28/0x3c
[  191.918538]  sysfs_kf_write+0x44/0x54
[  191.922189]  kernfs_fop_write_iter+0x120/0x1cc
[  191.926618]  vfs_write+0x1c0/0x308
[  191.930010]  ksys_write+0x74/0x10c
[  191.933400]  __arm64_sys_write+0x1c/0x28
[  191.937310]  invoke_syscall+0x48/0x114
[  191.941048]  el0_svc_common.constprop.0+0xc0/0xe0
[  191.945738]  do_el0_svc+0x1c/0x28
[  191.949040]  el0_svc+0x2c/0x84
[  191.952083]  el0t_64_sync_handler+0x120/0x12c
[  191.956426]  el0t_64_sync+0x190/0x194
[  191.960076] rcu: rcu_preempt kthread timer wakeup didn't happen for 5282 jiffies! g4301 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402
[  191.971352] rcu:     Possible timer handling issue on cpu=5 timer-softirq=356
[  191.978206] rcu: rcu_preempt kthread starved for 5288 jiffies! g4301 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=5
[  191.988529] rcu:     Unless rcu_preempt kthread gets sufficient CPU time, OOM is now expected behavior.
[  191.997637] rcu: RCU grace-period kthread stack dump:
[  192.002670] task:rcu_preempt     state:I stack:0     pid:16    ppid:2      flags:0x00000008
[  192.011002] Call trace:
[  192.013437]  __switch_to+0xcc/0x12c
[  192.016914]  __schedule+0x264/0x9c4
[  192.020389]  schedule+0x5c/0xc4
[  192.023517]  schedule_timeout+0x90/0x108
[  192.027427]  rcu_gp_fqs_loop+0x114/0x4c8
[  192.031339]  rcu_gp_kthread+0x134/0x160
[  192.035163]  kthread+0x110/0x114
[  192.038384]  ret_from_fork+0x10/0x20
[  192.041947] rcu: Stack dump where RCU GP kthread last ran:
[  192.047413] Task dump for CPU 5:
[  192.050627] task:swapper/5       state:R  running task     stack:0     pid:0     ppid:1      flags:0x00000008
[  192.060519] Call trace:
[  192.062952]  __switch_to+0xcc/0x12c
[  192.066429]  0x0

感谢你的帮助

Charles

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Charles:  

    1. 生成错误时、什么作为 EP 连接?
    2. 您可以在 EP 已连接的情况下共享“dmesg"日志“日志吗?

    此致、

    Takuma

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Charles:

    好的、明白。 您能否分享如何启用 RC0?

    此致、

    Takuma

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Takuma:

    我按照 Linux SDK 文档来引导两个 EVM  3.2.2.13. PCIe 根复合体与  3.2.2.11. PCIe 端点

    检测到 PCIe 发现和 EP 后、我可以修改 EP 的 IB 转换、并可以从 RC 到 EP 执行读取/写入操作(一切都按预期工作)。

    然后我尝试在 RC 上打开 BAR0 :  

    1. 在 RC 上、我使用 devmem2 覆盖 PCIe_CORE_RP_I_RC_BAR_CONFIG_REG
    2. 我重新扫描总线--> RC 崩溃

    我 以前发布过我的命令 :

    root@j784s4-evm:~# devmem2 0xd100300 w 0x106

    此致、

    Charles

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Charles:

    在重新配置过程中、BAR0 和 BAR1 之间的条形码看起来有很大不同、但如果这是无意的、可能是导致错误的原因?

    更具体地说,酒吧设置最初是一个 32 位不可预取的 BAR1 ,孔径大小为 1MB。 devmem2 会将其更改为 32 位不可预取的 BAR0、孔径大小为 256KB。

     共享的两个日志似乎与条形设置一致。 也就是说、在原始 POST 错误日志的这一行中为 BAR0 分配了 256 字节的内存:  
    PCI 0000:00:00.0:条形码 0:已分配[mem 0x10011000-0x100110ff]

    这与启用了 BAR1 的 dmesg 日志相反、在这一行中为 BAR1 分配了 1MB:
    [3.118291]  PCI 0000:00:00.0:BAR 1:已分配[mem 0x1000000-0x101fffff]

    此致、

    Takuma

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Takuma:

    即使我将 BAR0 和 BAR1 设置为  32 位不可预取 、孔径大小为 1MB(我将 BAR0 设置为酒吧 1)、RC 崩溃也是如此。

    可能缺少一些寄存器、需要配置其他寄存器。

    此致、

    Charles

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Charles:

    您可以查看 pcie-cadence-host.c 驱动程序、以了解在 RC 端完成了哪些配置。 通常、RC 的 BAR 寄存器在运行时不会发生变化。

    此致、

    Takuma