Still unable to run 4.18 on Rpi5

Hi,
There are two threads about this, but neither of them have answers that work. Can somebody please give precise instructions on getting hailort 4.18 to run on Rpi5?
I have tried with a clean OS install, following all the instructions, and I still get the same errors that myself and others have documented.
I need this in order to do inference with a batch size greater than 1.

Here is the output of “sudo dmesg | grep hailo”

[    3.105305] hailo: Init module. driver version 4.17.0
[    3.105412] hailo 0000:01:00.0: Probing on: 1e60:2864...
[    3.105417] hailo 0000:01:00.0: Probing: Allocate memory for device extension, 11600
[    3.105435] hailo 0000:01:00.0: enabling device (0000 -> 0002)
[    3.105442] hailo 0000:01:00.0: Probing: Device enabled
[    3.105463] hailo 0000:01:00.0: Probing: mapped bar 0 - 0000000097a29ba1 16384
[    3.105470] hailo 0000:01:00.0: Probing: mapped bar 2 - 0000000003a5f4ae 4096
[    3.105475] hailo 0000:01:00.0: Probing: mapped bar 4 - 000000008a69d2fa 16384
[    3.105479] hailo 0000:01:00.0: Probing: Setting max_desc_page_size to 16384, (page_size=16384)
[    3.105488] hailo 0000:01:00.0: Probing: Enabled 64 bit dma
[    3.105490] hailo 0000:01:00.0: Probing: Using userspace allocated vdma buffers
[    3.105494] hailo 0000:01:00.0: Disabling ASPM L0s
[    3.105497] hailo 0000:01:00.0: Successfully disabled ASPM L0s
[    3.327179] hailo 0000:01:00.0: Firmware was loaded successfully
[    3.345316] hailo 0000:01:00.0: Probing: Added board 1e60-2864, /dev/hailo0

And here is the output of “sudo apt list --installed | grep hailo”

hailort-pcie-driver/now 4.18.0 all [installed,local]
hailort/now 4.18.0 arm64 [installed,local]

Thanks

Hey @rogojin ,

Could you please check the contents of the /lib/firmware directory? If you find any files or folders related to version 4.17, you should remove them. Sometimes during upgrades or purge operations, certain files aren’t deleted because they’re currently in use or open.

This is the contents of my /lib/firmware directory:

total 172
drwxr-xr-x  2 root root   4096 Jul 22 21:29 .
drwxr-xr-x 48 root root   4096 Jul 22 21:29 ..
-rw-r--r--  1 root root 165816 Jul  8 12:53 hailo8_fw.4.18.0.bin
lrwxrwxrwx  1 root root     40 Jul 22 21:29 hailo8_fw.bin -> /lib/firmware/hailo/hailo8_fw.4.18.0.bin

have you done a reset cycle?

I’ve found two other files which are probably relevant:

/lib/modules/6.6.31+rpt-rpi-2712/kernel/drivers/media/pci/hailo/hailo_pci.ko.xz
/lib/modules/6.6.31+rpt-rpi-v8/kernel/drivers/media/pci/hailo/hailo_pci.ko.xz

Running modinfo on these two files gives me the following output:

# 6.6.31+rpt-rpi-2712
filename:       /lib/modules/6.6.31+rpt-rpi-2712/kernel/drivers/media/pci/hailo/hailo_pci.ko.xz
version:        4.17.0
license:        GPL v2
description:    Hailo PCIe driver
author:         Hailo Technologies Ltd.
srcversion:     C57A34FC4F4C6985BE6AF31
alias:          pci:v00001E60d000043A2sv*sd*bc*sc*i*
alias:          pci:v00001E60d000045C4sv*sd*bc*sc*i*
alias:          pci:v00001E60d00002864sv*sd*bc*sc*i*
depends:
intree:         Y
name:           hailo_pci
vermagic:       6.6.31+rpt-rpi-2712 SMP preempt mod_unload modversions aarch64
parm:           o_dbg:int
parm:           no_power_mode:Disables automatic D0->D3 PCIe transactions (invbool)
parm:           force_allocation_from_driver:Determines whether to force buffer allocation from driver or userspace (int)
parm:           force_desc_page_size:Determines the maximum DMA descriptor page size (must be a power of 2) (int)

and

# 6.6.31+rpt-rpi-v8
filename:       /lib/modules/6.6.31+rpt-rpi-v8/kernel/drivers/media/pci/hailo/hailo_pci.ko.xz
version:        4.17.0
license:        GPL v2
description:    Hailo PCIe driver
author:         Hailo Technologies Ltd.
srcversion:     C57A34FC4F4C6985BE6AF31
alias:          pci:v00001E60d000043A2sv*sd*bc*sc*i*
alias:          pci:v00001E60d000045C4sv*sd*bc*sc*i*
alias:          pci:v00001E60d00002864sv*sd*bc*sc*i*
depends:
intree:         Y
name:           hailo_pci
vermagic:       6.6.31+rpt-rpi-v8 SMP preempt mod_unload modversions aarch64
parm:           o_dbg:int
parm:           no_power_mode:Disables automatic D0->D3 PCIe transactions (invbool)
parm:           force_allocation_from_driver:Determines whether to force buffer allocation from driver or userspace (int)
parm:           force_desc_page_size:Determines the maximum DMA descriptor page size (must be a power of 2) (int)

Yes. I wiped my SD card and started from scratch, and I have rebooted at every step.
Unless you mean something else by “reset”?

Something is installing hailo 4.17 on the machine. Are you doing sudo apt install hailo_all?

No, I haven’t run sudo apt install hailo_all.

I start from a clean Raspberry Pi OS, and then I do this:

sudo dpkg -i hailort-pcie-driver_4.18.0_all.deb
sudo dpkg -i hailort_4.18.0_arm64.deb

what is the value in uname -r?

uname -r

6.6.31+rpt-rpi-2712

So the only place that is “important” to make sure that the driver is installed in is this:
/lib/modules/6.6.31+rpt-rpi-2712/
maybe you can manually remove the hailo_pci from there, and after that install the driver

OK, that actually worked to get a 4.18 driver running.

I deleted /lib/modules/6.6.31+rpt-rpi-2712/kernel/drivers/media/pci/hailo/hailo_pci.ko.xz, reinstalled hailort-pcie-driver_4.18.0_all.deb, and now at least hailortcli scan detects the device.

HOWEVER, I am still unable to run any networks.

$ hailortcli run yolov8s.hef
[HailoRT] [error] CHECK failed - max_desc_page_size given 16384 is bigger than hw max desc page size 4096

What does that mean?

Can you remove the driver:
sudo modprobe -r hailo_pci
and insert it back with forcing the max_page_desc_size:
sudo modprobe hailo_pci force_desc_page_size=4096

Thanks!
That finally works.

For anybody else coming to this thread for help, here is the full list of steps to get 4.18 working on a Raspberry Pi 5:

$ rm /lib/modules/6.6.31+rpt-rpi-2712/kernel/drivers/media/pci/hailo/hailo_pci.ko.xz
$ dpkg -i hailort-pcie-driver_4.18.0_all.deb
$ dpkg -i hailort_4.18.0_arm64.deb
$ reboot
$ modprobe -r hailo_pci
$ modprobe hailo_pci force_desc_page_size=4096
5 Likes

Just a note to why this happens. Raspberry Pi’s kernel includes v4.17.0 of the Hailo PCIe driver. That’s why you kept seeing that version until you manually removed its hailo_pcie.ko file.

See: linux/drivers/media/pci/hailo/common/hailo_pcie_version.h at rpi-6.6.y · raspberrypi/linux · GitHub

Thanks.
Do you have any insight into their plans (i.e. Rpi Foundation + Hailo) on managing this going forward?

As a workaround, one can install dkms with sudo apt install dkms and when installing hailort-pcie-driver_4.18.0_all.deb, choose the DKMS option. It looks like DKMS kernel modules have preference over in-tree ones, since I didn’t delete /lib/modules/6.6.31+rpt-rpi-2712/kernel/drivers/media/pci/hailo/hailo_pci.ko.xz, yet HailoRT 4.18 works fine for me.

3 Likes

Yeah, I did the same, installed sudo apt install dkms and it worked for me without, rm /lib/modules/6.6.31+rpt-rpi-2712/kernel/drivers/media/pci/hailo/hailo_pci.ko.xz, I forgot to mention earlier.

2 Likes

Hello @rogojin.
Can you tell me please, where you got the file hailort-pcie-driver_4.18.0_all.deb ?

This file can be downloaded from the developer zone, but the best advice that we can give is to use the official hailo_all package.
Please see this topic: