Enabling pcie-gen2 on rockpi4(c)

reicast-git build times

i5-2320 (3 Ghz, 4 core), 4 GB RAM, SATA 3 SSD, Endeavour OS - 5m 58s
RockPi 4c, 4 GB RAM, Samsung 960 EVO m.2 SSD, Manjaro ARM - 8m 6s

Not bad considering the RockPi is using a fraction of the power and runs silently.

1 Like

I spoke too soon about my RockPi fully working. Using the rockpi-4b dtb (which is what gets loaded by default according to dmesg), I can only use one of the USB ports (the top USB3.0 port). This is the case under the latest Manjaro default 5.18 kernel and pak0st’s 4K kernel.

How do I specify the DTB to load under recent versions of Manjaro? I tried adding a line like

FDT /path/to/dtbfile

in /boot/extlinux/extlinux.conf but that doesn’t work. It fails to boot even if I point it to the 4b dtb. I’m hoping that if I use the rockpi-4c dtb instead of the 4b one, all 4 USB ports will work.

I emailed the maintainer of the Armbian rockpi4 builds yesterday and he’s looking into applying these patches to the Armbian 5.15 kernel but they may decide to wait for proper mainline support now as it sounds like its close.

If you used a Rock Pi 4B specific image, then that should already be set to load the rockpi4b spcific DTB.

I used the generic Manjaro ARM aarch64 MATE image because I couldn’t find the Manjaro ARM rockpi4 downloads page. I presumed board specific images had been done away with.

Does Manjaro ARM no longer have its own homepage (with links to the install images) or have I lost all search ability?

The download page as a drop down menu for ARM devices.

Both Rock Pi 4 B and C images are listed.

1 Like

I see it now! I think it was getting late and it was past the time to stop messing with stuff.

Do I really have to re-install? Can you not specify (custom) dtbs when you install using the generic image?

You can, but you need to have the correct board firmware on SPI for that. The generic image does not have any uboot.

I was going to do a video comparing some of my ARM devices and so I had built reicast on them all so here’s some more times to compile reicast. It would seem the rockpi4 is about twice as fast as a overclocked RaspberryPi 4 and 50% faster than a Jetson Nano as far as gcc is concerned .

I used the same USB3.0 → SATA3 SSD disk and adapter to run the root fs for all of these tests:

Jetson Nano 4 GB, L4T R32 5.1, Linux 4.9.201 - 12m 57s|
Rpi 4B 8 GB running at 2.1 Ghz, GPU @ 800 Mhz, Manjaro unstable aarch64, Linux 5.10.46, mesa 21.1.4 - 14m 37s
Rpi 4B 8 GB running at 2.1 Ghz, GPU @ 800 Mhz, Raspberry Pi OS Buster armhf, Linux 5.10.17, mesa 19.3.2 - 16m 22s
X96 Air Q1000 / S905X3, 4 GB RAM, Manjaro unstable, linux-aml 5.13.0, mesa 21.1.4 - 27m 3s

I’ve re-installed Manjaro using the 4c image and that has fixed my USB problems.

Everything seems to be working under Manjaro except the onboard audio but thats not a big deal for me as HDMI audio works and I’ve got USB soundcards. ALSA shows the onboard device but my experiments with alsamixer and pavucontrol haven’t had any success in getting any sound out of it yet.

Tested as working under pak0sts kernel on RockPi 4c:

HDMI audio
USB 3.0 + 2.0
Gigabit ethernet
UHD and 4k HDMI output
Direct booting from PCIe 2.0x NVME disks.

It took me a lot of effort to get here but the RockPi 4 is looking great now and I’d recommend it over the Jetson Nano and RPi 4 for experienced users who want a good ARM SBC. It’ll be better when we don’t need a patched kernel to have 4K HDMI support.

If I bought another I’d probably buy the 4b because I’d prefer to have 1 full size HDMI port instead of a mini HDMI and a Mini DP output.

I’m interested to hear what transfer rates people get from their m.2 SSDs after modifying their dtbs to find out what make/model SSDs work best with the RockPi 4s. It doesn’t look like Samsung are a good choice for the RockPis.

@spikerguy have you ever tried the onboard audio of the RockPi 4 under Manjaro?

No I dont think there is audio nodes for audio jack in dts. I have not tried it since sometime. I only have 4C, idk if it have the jack.

1 Like

I only have the 4c but yes, it does have a jack.

I don’t think I tried it under the Radxa legacy kernel but that’d be the next thing to try.

1 Like

Looks like good, need to test.

1 Like

What make/model m.2 SSD(s) do you have kukuz1?

Please tell me what speeds you get if you test this kernel. PCIe 2.0 can supposedly handle up to 500 MB/s but I only get read speeds of just over 300 (310-340 MB/s) with my Samsung EVO 960, which should be able to saturate a PCIe 2.0 link and give closer to 500 MB/s, in theory. This same SSD manages about 400 MB/s under the Radxa Ubuntu 4.4 kernel, when the PCIe 2 overlay is enabled so there is definitely room for improvement in the mainline driver somewhere.

Radxa say PCIe 2.0 isn’t officially supported so we can’t expect it to be perfect but different drives may bring better (or worse) performance.

* Restart config...
* Memory initialization
Initialize kernel stack variables at function entry
> 1. no automatic stack variable initialization (weakest) (**INIT_STACK_NONE**)
  2. pattern-init everything (strongest) (INIT_STACK_ALL_PATTERN) (NEW)
  3. zero-init everything (strongest and safest) (INIT_STACK_ALL_ZERO) (NEW)
choice[1-3?]: 3

Poison kernel stack before returning from syscalls (GCC_PLUGIN_STACKLEAK) [N/y/?] n
Enable heap memory zeroing on allocation by default (INIT_ON_ALLOC_DEFAULT_ON) [N/y/?] n
Enable heap memory zeroing on free by default (INIT_ON_FREE_DEFAULT_ON) [N/y/?] n
Enable register zeroing on function exit (**ZERO_CALL_USED_REGS**) [N/y/?] (NEW) 

I have uploaded packages of the rk3399 PCIe 2.0 enabled kernel and headers here:

1 Like

So, all works good.

SSD NVME KingSpec NE 2280 1Tb (write 250-390Mb/s, read 450-520MB/s)

# hdparm -tT /dev/nvme0n1
 Timing cached reads:   2652 MB in  2.00 seconds = 1326.89 MB/sec
 Timing buffered disk reads: 1254 MB in  3.00 seconds = 417.90 MB/sec
# dd if=tempfile of=/dev/null bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 2,34215 s, 458 MB/s
# dd if=tempfile of=/dev/null bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 0,789859 s, 1,4 GB/s
# dd if=/dev/zero of=tempfile bs=1M count=1024 status=progress
1049624576 bytes (1,0 GB, 1001 MiB) copied, 4 s, 262 MB/s
1024+0 records in
1024+0 records out
1073741824 bytes (1,1 GB, 1,0 GiB) copied, 4,17619 s, 257 MB/s


1 Like

Thanks for those benchmarks kukuz! You’re getting better speeds than I am with my Samsung EVO 960.

I guess the READ\WRITE speed should be closer to 800Mb\sec.

Nanopc-t4 seems to provide PCIe 2.1 x4, but in fact, my nvme SSD seems to have a write speed of only 500MB / s, which seems far from reaching the theoretical bandwidth of PCIe 2.1 X4 of 16gbps.