-1

我在总线 08:01 后面的总线 PCI 09 上有设备,如下所示:

0000:08:01.0 -> ../../../devices/pci0000:00/0000:00:03.0/0000:07:00.0/0000:08:01.0/0000:09:00.0

我在总线 09 上的设备关闭并重新启动 CPU 后,我打开总线 09 上的设备。所以,我重新扫描 PCI 总线 0000:08:01.0。但它没有找到我的设备。

巴士 08:01 重启后:

root@localhost:~# lspci -s 0000\:08\:01.0 -v
08:01.0 PCI bridge: PLX Technology, Inc. PEX 8614 12-lane, 12-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=08, secondary=09, subordinate=09, sec-latency=0
Capabilities: [40] Power Management version 3
Capabilities: [48] MSI: Enable+ Count=1/4 Maskable+ 64bit+
Capabilities: [68] Express Downstream Port (Slot+), MSI 00
Capabilities: [a4] Subsystem: PLX Technology, Inc. PEX 8614 12-lane, 12-Port PCI Express Gen 2 (5.0 GT/s) Switch
Capabilities: [100] Device Serial Number ba-86-01-10-b5-df-0e-00
Capabilities: [fb4] Advanced Error Reporting
Capabilities: [148] Virtual Channel
Capabilities: [520] Access Control Services
Capabilities: [950] Vendor Specific Information: ID=0001 Rev=0 Len=010 <?>
Kernel driver in use: pcieport

我注意到没有像这样的“桥后可预取内存”字段:

#lspci -s 0000\:01\:00.0 -v
01:00.0 Class 0604: Device 10b5:8617 (rev ba)
Flags: bus master, fast devsel, latency 0, IRQ 9
Memory at c4b00000 (32-bit, non-prefetchable) [size=128K]
Bus: primary=01, secondary=02, subordinate=05, sec-latency=0
I/O behind bridge: None
Memory behind bridge: c0000000-c4afffff [size=75M]
Prefetchable memory behind bridge: 00000000c4c00000-00000000c96fffff [size=75M]
Capabilities: [40] Power Management version 3
Capabilities: [48] MSI: Enable- Count=1/4 Maskable+ 64bit+
Capabilities: [68] Express Upstream Port, MSI 00
Capabilities: [a4] Subsystem: Device 10b5:8617
Capabilities: [100] Device Serial Number ba-86-01-10-b5-df-0e-00
Capabilities: [fb4] Advanced Error Reporting
Capabilities: [138] Power Budgeting <?>
Capabilities: [148] Virtual Channel
Capabilities: [950] Vendor Specific Information: ID=0001 Rev=0 Len=010 <?>
Kernel driver in use: pcieport

当我在重新启动前打开设备时,CPU 只能在总线 09 中找到设备。重启后CPU有什么办法可以在PCI总线上找到设备?或者,当 CPU 启动时,如何在没有设备的情况下在总线 0000:08:01.0 的桥后分配内存?

4

1 回答 1

-1

感谢您的回答,我只是一个新手linux用户。我尝试在启动后重新扫描总线 PCI,但没有找到该设备。但是在我的项目中,我看到一个使用内核 4.14 的系统上的应用程序可以重新扫描总线 PCI 上的设备,并在重新启动后发现它,而最初没有在设备上。

CPU 启动后的 PCI 总线

# ls -l /sys/bus/pci/devices/
lrwxrwxrwx    1 root     root             0 Jan  1 00:50 0000:00:00.0 -> ../../../devices/platform/bcm963xx-pcie.0/pci0000:00/0000:00:00.0
lrwxrwxrwx    1 root     root             0 Jan  1 00:50 0000:01:00.0 -> ../../../devices/platform/bcm963xx-pcie.0/pci0000:00/0000:00:00.0/0000:01:00.0
lrwxrwxrwx    1 root     root             0 Jan  1 00:50 0000:02:00.0 -> ../../../devices/platform/bcm963xx-pcie.0/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:00.0
lrwxrwxrwx    1 root     root             0 Jan  1 00:50 0000:02:02.0 -> ../../../devices/platform/bcm963xx-pcie.0/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:02.0
lrwxrwxrwx    1 root     root             0 Jan  1 00:50 0000:02:03.0 -> ../../../devices/platform/bcm963xx-pcie.0/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:03.0

CPU启动时记录

pci 0000:02:03.0: PCI bridge to [bus 05]
pci 0000:02:03.0:   bridge window [mem 0xc3200000-0xc4afffff]
pci 0000:02:03.0:   bridge window [mem 0xc7e00000-0xc96fffff 64bit pref]

我确定在总线 5 中,有一个设备准备好与 CPU 通信,但 CPU 在启动时找不到它。但是当我重新扫描总线 02:03 并使用 bcm_ll_pcie_init 时,设备找到了。

重新扫描后

lrwxrwxrwx    1 root     root             0 Jan  1 01:13 0000:05:00.0 -> ../../../devices/platform/bcm963xx-pcie.0/pci0000:00/0000:00:00.0/0000:01:00.0/0000:02:03.0/0000:05:00.0

当我重新扫描总线时记录 02:03

Maple netlink-based raw driver transport driver
bcm963xx-pcie: Core [0] PCIe Intr [PCIE_MSTR_UR_ATTN]
pci 0000:03:00.0: [14e4:6862] type 00 class 0x048000
pci 0000:03:00.0: reg 0x10: [mem 0x00000000-0x007fffff 64bit pref]
pci 0000:03:00.0: reg 0x18: [mem 0x00000000-0x00ffffff 64bit pref]
pci 0000:03:00.0: reg 0x20: [mem 0x00000000-0x0000ffff 64bit pref]
pci 0000:03:00.0: PME# supported from D0 D3hot
pcieport 0000:02:00.0: Checking PCIe ASPM for vendor 14e4 device 6862
pcieport 0000:02:00.0: Disabling PCIe ASPM for vendor 14e4 device 6862
pci 0000:04:00.0: [14e4:8470] type 00 class 0x020000
pci 0000:04:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit pref]
pci 0000:04:00.0: reg 0x18: [mem 0x00000000-0x007fffff 64bit pref]
pci 0000:04:00.0: PME# supported from D0 D3hot D3cold
pci 0000:04:00.1: [14e4:8470] type 00 class 0x020000
pci 0000:04:00.1: reg 0x10: [mem 0x00000000-0x00007fff 64bit pref]
pci 0000:04:00.1: reg 0x18: [mem 0x00000000-0x007fffff 64bit pref]
pci 0000:04:00.1: PME# supported from D0 D3hot D3cold
pcieport 0000:02:02.0: Checking PCIe ASPM for vendor 14e4 device 8470
pcieport 0000:02:02.0: Disabling PCIe ASPM for vendor 14e4 device 8470
pci 0000:05:00.0: [14e4:6862] type 00 class 0x048000
pci 0000:05:00.0: reg 0x10: [mem 0x00000000-0x007fffff 64bit pref]
pci 0000:05:00.0: reg 0x18: [mem 0x00000000-0x00ffffff 64bit pref]
pci 0000:05:00.0: reg 0x20: [mem 0x00000000-0x0000ffff 64bit pref]
pci 0000:05:00.0: PME# supported from D0 D3hot
pcieport 0000:02:03.0: Checking PCIe ASPM for vendor 14e4 device 6862
pcieport 0000:02:03.0: Disabling PCIe ASPM for vendor 14e4 device 6862

您可以在 PCI 总线 05 上看到设备,找到 0000:05:00.0: [14e4:6862]。我也尝试在我的系统中重新扫描,但它不起作用,找不到设备。但我注意到我的 CPU 没有像我的帖子那样的工作系统那样的“桥后可预取内存”。你怎么看待这件事?

于 2020-07-15T02:12:38.380 回答