【发布时间】:2020-01-04 12:40:16
【问题描述】:
我想知道 pci 重置何时完成,因此我认为最好的选择是从 pci 设备配置注册表中读取设备 ID 字段。
设备 id 字段在重置后变为 0xffff,并应在 200-400 毫秒后(可能在重置结束后)变回真实设备 id。
如果不等待就访问它,我会从函数“pci_read_config_word”中得到一个错误。
我不想猜测等待的时间。 还有另一种投票方式吗?
pci_set_pcie_reset_state(pdev, pcie_deassert_reset);
while(polling_counter < 100)
{
pci_read_config_word(pdev, PCI_DEVICE_ID,
&device_id);
if (device_id == pdev->device)
break;
polling_counter++;
}
// This function can failed if the reset is not completed.
pci_restore_state(pdev);
来自 dmesg:
[c000000167bcb200] [c0000000000155ac] .show_stack+0x6c/0x198 (unreliable)
[c000000167bcb2b0] [c000000000076a8c] .eeh_dn_check_failure+0x354/0x3f0
[c000000167bcb370] [c000000000029b7c] .rtas_read_config+0x13c/0x198
[c000000167bcb410] [c00000000039c8d0] .pci_bus_read_config_word+0xa0/0xf8
[c000000167bcb4d0] [d000000004f6043c] .reset_device+0x23c/0x530 [mst_ppc_pci_reset]
[c000000167bcb590] [c0000000003a6254] .local_pci_probe+0x7c/0xf8
[c000000167bcb620] [c0000000003a63a8] .__pci_device_probe+0xd8/0x128
[c000000167bcb6d0] [c0000000003a72a8] .pci_device_probe+0x38/0x68
[c000000167bcb760] [c0000000004d0bd8] .really_probe+0xb0/0x288
[c000000167bcb810] [c0000000004d0e4c] .driver_probe_device+0x9c/0x110
[c000000167bcb8a0] [c0000000004d0fbc] .__driver_attach+0xfc/0x100
[c000000167bcb930] [c0000000004cfee4] .bus_for_each_dev+0xc4/0x118
[c000000167bcb9e0] [c0000000004d08a8] .driver_attach+0x28/0x40
[c000000167bcba60] [c0000000004cf3b0] .bus_add_driver+0x190/0x340
[c000000167bcbb10] [c0000000004d1950] .driver_register+0x98/0x1b8
[c000000167bcbbb0] [c0000000003a760c] .__pci_register_driver+0x64/0x140
[c000000167bcbc50] [d000000004f608c0] .init+0x28/0x430 [mst_ppc_pci_reset]
[c000000167bcbcd0] [c00000000000ab68] .do_one_initcall+0x68/0x1e0
[c000000167bcbd90] [c00000000010893c] .SyS_init_module+0xcc/0x218
[c000000167bcbe30] [c0000000000098ec] syscall_exit+0x0/0x40
【问题讨论】:
标签: linux-kernel linux-device-driver pci