Skip to content

PCI BAR Memory Allocation Issue on RK3568-based Device NanoPi R5S #38

Description

@eggcllnt

Hardware/Software Environment

Hardware: NanoPi with Rockchip RK3568 processor

Issue Description
While working with my RK3568-based device, I observed errors related to PCI BAR memory allocation on one of the PCI bridges. The system appears to have three PCIe controllers, but the third one (0002:00:00.0) is showing error messages related to memory allocation.

dmesg Output

[    3.584908] pci_bus 0002:00: root bus resource [bus 00-0f]
[    3.585420] pci_bus 0002:00: root bus resource [io  0x200000-0x2fffff] (bus address [0xf0100000-0xf01fffff])
[    3.586307] pci_bus 0002:00: root bus resource [mem 0xf0200000-0xf1ffffff]
[    3.586935] pci_bus 0002:00: root bus resource [mem 0x380000000-0x3bfffffff] (bus address [0x40000000-0x7fffffff])
[    3.587998] pci 0002:00:00.0: [1d87:3566] type 01 class 0x060400
[    3.588571] pci 0002:00:00.0: reg 0x10: [mem 0x00000000-0x3fffffff]
[    3.589151] pci 0002:00:00.0: reg 0x14: [mem 0x00000000-0x3fffffff]
[    3.589730] pci 0002:00:00.0: reg 0x38: [mem 0x00000000-0x0000ffff pref]
[    3.590420] pci 0002:00:00.0: supports D1 D2
[    3.590819] pci 0002:00:00.0: PME# supported from D0 D1 D3hot
[    3.599827] pci_bus 0002:01: busn_res: can not insert [bus 01-ff] under [bus 00-0f] (conflicts with (null) [bus 00-0f])
[    3.601189] pci 0002:00:00.0: BAR 0: assigned [mem 0x380000000-0x3bfffffff]
[    3.601846] pci 0002:00:00.0: BAR 1: no space for [mem size 0x40000000]
[    3.602454] pci 0002:00:00.0: BAR 1: failed to assign [mem size 0x40000000]
[    3.603088] pci 0002:00:00.0: BAR 6: assigned [mem 0xf0200000-0xf020ffff pref]
[    3.603811] pci 0002:00:00.0: PCI bridge to [bus 01-ff]
[    3.607148] pcieport 0002:00:00.0: PME: Signaling with IRQ 75
[    3.608250] pcieport 0002:00:00.0: AER: enabled with IRQ 75

lspci Output

root@DietPi:~# lspci
0000:00:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3568 Remote Signal Processor (rev 01)
0000:01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
0001:00:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3568 Remote Signal Processor (rev 01)
0001:01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
0002:00:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3568 Remote Signal Processor (rev 01)

Memory Map Information

300000000-33fffffff : pcie@fe260000
340000000-37fffffff : pcie@fe270000
380000000-3bfffffff : pcie@fe280000
  380000000-3bfffffff : 0002:00:00.0
3c0000000-3c03fffff : 3c0000000.pcie dbi
3c0400000-3c07fffff : 3c0400000.pcie dbi
3c0800000-3c0bfffff : 3c0800000.pcie dbi

The logs show:

The system has three PCIe controllers
Each controller is allocated 1GB of memory space
Controller at 0002:00:00.0 successfully assigns BAR 0 to memory range 0x380000000-0x3bfffffff
Controller at 0002:00:00.0 fails to assign BAR 1 which requires 0x40000000 (1GB) of memory
There's also a bus number allocation conflict: "can not insert [bus 01-ff] under [bus 00-0f]"

Steps Taken

Observed the issue during system boot
Collected dmesg logs showing PCI resource allocation
Ran lspci to check detected PCI devices
Checked memory mapping via /proc/iomem

Questions

Is this a known limitation of the RK3568 PCIe controller configuration?
Are there any known workarounds such as kernel parameters or device tree modifications?
Could this indicate a firmware/BIOS issue that might be addressed in a future update?

Expected behavior

The NVMe drive should be consistently detected as /dev/nvme0n1 after booting, allowing me to install an operating system on it or use it for storage.

Additional information

The same NVMe drive works consistently with FriendlyElec's official Debian image, so the issue appears to be related to DietPi's kernel configuration or U-Boot settings rather than a hardware problem. I've also observed that in rare cases, the NVMe drive does get detected after a reboot, but this behavior is inconsistent.
Key error messages from the PCIe subsystem:

busn_res: can not insert [bus 01-ff] under [bus 00-0f] (conflicts with (null) [bus 00-0f])
BAR 1: no space for [mem size 0x40000000]
BAR 1: failed to assign [mem size 0x40000000]

I would appreciate assistance in resolving this issue to allow for consistent NVMe detection and usage on the NanoPi R5S.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions