Arch Linux Image for VisionFive 2

could you dmesg |grep -ie pvr_k -ie rgx -ie drm ?

mine looks like this:

$ uname -a
Linux VF2-A 5.15.2-cwt-3.0.4-2 #1 SMP PREEMPT Wed Jun 14 01:20:40 +07 2023 riscv64 GNU/Linux

$ dmesg |grep -ie pvr_k -ie rgx -ie drm
[    0.646801] PVR_K:  1: Read BVNC 36.50.54.182 from HW device registers
[    0.646874] PVR_K:  1: RGX Device registered BVNC 36.50.54.182 with 1 core in the system
[    0.792378] PVR_K:  1: RGX Firmware image 'rgx.fw.36.50.54.182' loaded
[    0.796462] PVR_K:  1: Shader binary image 'rgx.sh.36.50.54.182' loaded
[    0.798833] [drm] Initialized pvr 1.17.6210866 20170530 for 18000000.gpu on minor 0
[    2.782652] innohdmi-starfive 29590000.hdmi: [drm:inno_hdmi_i2c_adapter] registered Inno HDMI I2C bus driver success
[    2.783884] [drm] Initialized starfive 1.0.0 20191101 for soc:display-subsystem on minor 1
[    3.284002] starfive soc:display-subsystem: [drm] Cannot find any crtc or sizes
[    3.784230] starfive soc:display-subsystem: [drm] Cannot find any crtc or sizes
[    4.284388] starfive soc:display-subsystem: [drm] Cannot find any crtc or sizes
[    9.419763] systemd[1]: Starting Load Kernel Module drm...
[    9.586787] systemd[1]: modprobe@drm.service: Deactivated successfully.
[    9.587524] systemd[1]: Finished Load Kernel Module drm.
[   39.085943] starfive soc:display-subsystem: [drm] fb0: starfive frame buffer device

Sure, first the working cwt13:

[    0.650446] PVR_K:  1: Read BVNC 36.50.54.182 from HW device registers
[    0.650512] PVR_K:  1: RGX Device registered BVNC 36.50.54.182 with 1 core in the system
[    0.652006] PVR_K:  1: RGX Firmware image 'rgx.fw.36.50.54.182' loaded
[    0.655880] PVR_K:  1: Shader binary image 'rgx.sh.36.50.54.182' loaded
[    0.658189] [drm] Initialized pvr 1.17.6210866 20170530 for 18000000.gpu on minor 0
[    2.643433] innohdmi-starfive 29590000.hdmi: [drm:inno_hdmi_i2c_adapter] registered Inno HDMI I2C bus driver success
[    2.645553] [drm] Initialized starfive 1.0.0 20191101 for soc:display-subsystem on minor 1
[    3.993865] starfive soc:display-subsystem: [drm] fb0: starfive frame buffer device
[    9.329240] systemd[1]: Starting Load Kernel Module drm...
[    9.513265] systemd[1]: modprobe@drm.service: Deactivated successfully.
[    9.517520] systemd[1]: Finished Load Kernel Module drm.

And the failing packaged kernel as an attachment, as itā€™s somewhat bigger.
cwt-pkg.txt (15.7 KB)

Hmmā€¦ that is super weird and unexpected!

I feel like you board didnā€™t load the corrected dtb. Do you put both SD and NVMe together?

The boot partition is common (listed to max-depth 2):

/boot
/boot/dtbs
/boot/dtbs/5.15.2-cwt13
/boot/dtbs/sifive
/boot/dtbs/starfive
/boot/extlinux
/boot/extlinux/extlinux.conf
/boot/initramfs-linux.img
/boot/initrd.img-5.15.2-cwt13
/boot/uEnv.txt
/boot/vmlinuz
/boot/vmlinuz-5.15.2-cwt13

boot is from SD, root is on NVME (u-boot doesnā€™t appear to recognise the NVME, but thatā€™s a different problem ā€¦).

The latest firmware files are identical on /dev/mtdX, and the SD/NMVE partitions 1 & 2 are imaged from the cwt13 image.

I agree that it smells like a dtb issue, just donā€™t see where it comes from.

I have just built an experimental real-time kernel using instructions and patches from Analysis of Running Real-Time Linux on VisionFive 2.

If you really want to try, the kernel packages are here: Release cwt13-rt 3.0.4-2 Ā· cwt/pkgbuild-linux-cwt-starfive-visionfive2 Ā· GitHub

2 Likes

Did the firmware packaging issues get resolved to allow easier installation of the open source PVR driver?

I was told that visionfive2-img-gpu and mesa-pvr should be able to co-exist, but visionfive2-img-gpu fails to verify when installing from aur currently so I canā€™t add it as a dep. I logged an issue. Publish update to AUR please Ā· Issue #4 Ā· trissylegs/aur-visionfive2-img-gpu Ā· GitHub

1 Like

To get up and running in the meantime, install visionfive2-img-gpu from that git repo and my package from aur. Then you can run hw-accelerated weston.

1 Like

I have got mesa-pvr-vf2 to build and install OK. I built visionfive2-img-gpu but it failed to install due to 2 conflicting files that I presume must be included with cwt13 by default.

[root@ArchVF2 aur-visionfive2-img-gpu]# pacman -U visionfive2-img-gpu-1.17.6210866-4-riscv64.pkg.tar.zst 
loading packages...
warning: visionfive2-img-gpu-1.17.6210866-4 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) visionfive2-img-gpu-1.17.6210866-4

Total Installed Size:  42.22 MiB
Net Upgrade Size:       0.48 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
error: failed to commit transaction (conflicting files)
visionfive2-img-gpu: /usr/lib/firmware/rgx.fw.36.50.54.182 exists in filesystem
visionfive2-img-gpu: /usr/lib/firmware/rgx.sh.36.50.54.182 exists in filesystem
Errors occurred, no packages were upgraded.

To work around this I simply deleted the two conflicting files, then I was able to install visionfive2-img-gpu but I donā€™t think I needed to do that.

It doesnā€™t seem that gdm is packaged for rv64 Arch yet and Iā€™ve not been able to get lightdm nor sddm to work as a display manager. Which display manager and what config, if any is required, are you using @sajattack? Did you have to create an xorg.conf? If youā€™re not using a DM, how are you starting Weston?

Does GNOME work for you or have you not tested it?

1 Like

There will be no conflict in the next version as the kernel and img-gpu will be provided as packages.

FYI: you can also instruct the pacman to overwrite any conflict file.

    sudo pacman -U --overwrite "*" *.zst
2 Likes

Iā€™m using lightdm to start Weston. Weston itself works, and a few demos. With the PVR aware Mesa, actually very little works, many GTK programs (that work with the ā€˜vanillaā€™ Mesa) will crash with the new one. Gnome will not run, Iā€™m not sure how complete / consistent with various bits that are ported are.

1 Like

Did you have to adjust lightdm.conf or do anything else to get it to work like create an xorg.conf?

When I run sudo systemctl start lightdm after installing the mesa-pvr pacakge I just get a blinking cursor in the top left of the screen, I never see the lightdm login page.

I donā€™t recall having to do anything else. Unfortunately the SSD has just died, so I canā€™t check. Perhaps

Section "Device"
    Identifier             "Screen0"
    Driver                 "fbdev"
    Option "fbdev"         "/dev/fb0"
EndSection

@cwt, The problem with the PVR driver not initialising correctly is caused by rebuilding the initramfs (using the supplied, unmodified /etc/mkinitcpio.conf).

On cwt13:

  • Using the distributed initrd.img-5.15.2-cwt13 the PVR device initialises correctly.
  • Using a generated initrd.img-5.15.2-cwt13 (sudo mkinitcpio -g /boot/initrd.img-5.15.2-cwt13), always results in PVR_K initialisation errors.

100% reproducable.

$ lsinitcpio /boot/initrd.img-5.15.2-cwt13 > /tmp/new.txt
$ lsinitcpio /boot/initrd.img-5.15.2-cwt13.orig > /tmp/orig.txt
$ diff /tmp/orig.txt /tmp/new.txt 
0a1
> VERSION
12,13d12
< etc/modprobe.d/rtl88x2bu.conf
< etc/modprobe.d/rtw8822bu.conf
202a202
> usr/lib/libc.so.6
207d206
< usr/lib/libcrypto.so.3
210c209
< usr/lib/libc.so.6
---
> usr/lib/libcrypto.so.3
223a223
> usr/lib/libm.so.6
226d225
< usr/lib/libm.so.6
235a235,236
> usr/lib/modprobe.d/bluetooth-usb.conf
> usr/lib/modprobe.d/nvdimm-security.conf
271c272
< usr/lib/systemd/libsystemd-shared-253.4-1.so
---
> usr/lib/systemd/libsystemd-shared-253.5-2.so
288d288
< VERSION

Explains why the packaged kernels displayed this fault.

@stronnag If I understand your question correctly, you are using the packaged kernel (which installed from # pacman -U linux-cwt-515-starfive-visionfive2-*.zst, right?)

In that package, the kernel version should be 5.15.2-cwt-3.0.4-2, the initrd image should name /boot/initramfs-linux.img , and the kernel itself should name /boot/vmlinuz

$ uname -a
Linux VF2-A 5.15.2-cwt-3.0.4-2 #1 SMP PREEMPT Wed Jun 14 01:20:40 +07 2023 riscv64 GNU/Linux

$ sudo pacman -Ql linux-cwt-515-starfive-visionfive2 |grep "vmlinuz"
linux-cwt-515-starfive-visionfive2 /boot/vmlinuz
linux-cwt-515-starfive-visionfive2 /usr/lib/modules/5.15.2-cwt-3.0.4-2/vmlinuz

$ sudo pacman -Ql linux-cwt-515-starfive-visionfive2 |grep preset
linux-cwt-515-starfive-visionfive2 /etc/mkinitcpio.d/linux.preset

$ cat /etc/mkinitcpio.d/linux.preset
# mkinitcpio preset file for the linux package

ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz"

PRESETS=('default')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux.img"
#default_options=""

Which I wonder why are you using this command sudo mkinitcpio -g /boot/initrd.img-5.15.2-cwt13? Because that would overwrite the non-packaged initrd image that was shipped with the cwt13 image before I create the packaged kernel.

I am using the imaged 5.15.2-cwt13 kernel. That is why I use the command sudo mkinitcpio -g /boot/initrd.img-5.15.2-cwt13. But making an initramfs with the packaged kernel has the same result of a non-working PVR_K.

Ok, thatā€™s unexpected. Could you try remove nvme from the board and boot from fresh written SD only?

So far (removed nvme, clean cwt13 SD card):

  • Booting clean cwt13 SD - no PVR-K errors
  • Booting cwt13 + initramfs earlier from experiment (the only change to the SD) - PVR-K errors

Next up, add mkinitcpio to cwt13 SD and rebuild initramfs ā€¦

So finally:

  • Clean new install of cwt13 to SD (nmve removed)
  • pacman -Syu (required for next step)
  • pacman -S mkinitcpio
  • mkinitcpio -g /boot/initrd.img-5.15.2-cwt13
  • reboot

Results in ā€¦ PVR-K errors on reboot