Calculator example fail to execute on hexagon dsp db410 debian 20.02 release

Hi,

I am using the dragonboard 410, and running hexagon sdk 3.4.3 calculator example on dsp, but it fails to execute on dsp, linaro debian 20.02 release.

Posting the details here:

Link-documentation used:

Release: Linaro 20.02, prebuilt images (with fastrpc) Linaro Releases

Sysfs:

linaro@linaro-developer:~/dsp/UbuntuARM_Debug_aarch64/ship$ cat /sys/devices/platform/soc/4080000.remoteproc/remoteproc/remoteproc0/state

running

linaro@linaro-developer:~/dsp/UbuntuARM_Debug_aarch64/ship$ cat /sys/devices/platform/soc/4080000.remoteproc/remoteproc/remoteproc0/firmware

qcom/msm8916/mba.mbn

dmesg kernel log:

[ 5.181848] remoteproc remoteproc0: 4080000.remoteproc is available

[ 5.247314] remoteproc remoteproc0: powering up 4080000.remoteproc

[ 5.255968] remoteproc remoteproc0: Booting fw image qcom/msm8916/mba.mbn, size 230272

[ 5.303826] msm 1a00000.mdss: 1a00000.mdss supply vdd not found, using dummy regulator

[ 5.319341] qcom-q6v5-mss 4080000.remoteproc: MBA booted, loading mpss

[ 5.480057] remoteproc remoteproc1: a204000.wcnss is available

[ 5.509067] remoteproc remoteproc1: powering up a204000.wcnss

[ 5.523370] remoteproc remoteproc1: Booting fw image qcom/msm8916/wcnss.mdt, size 7260

[ 6.156328] qcom_wcnss_ctrl remoteproc1:smd-edge.WCNSS_CTRL.-1.-1: WCNSS Version 1.5 1.2

Strace logs:

write(1, “src/rpcmem_android.c:134:stat Fa”…, 49src/rpcmem_android.c:134:stat Failed on /dev/ion ) = 49

write(1, “\n- starting calculator test”, 27

  • starting calculator test) = 27

write(1, “\n”, 1

) = 1

newfstatat(AT_FDCWD, “/dev/ion”, 0xfffffd6612e0, 0) = -1 ENOENT (No such file or directory)

write(1, “src/rpcmem_android.c:134:stat Fa”…, 49src/rpcmem_android.c:134:stat Failed on /dev/ion ) = 49

write(1, “- allocate 56 bytes from ION hea”…, 34- allocate 56 bytes from ION heap

) = 34

write(1, “- creating sequence of numbers f”…, 44- creating sequence of numbers from 0 to 13

) = 44

write(1, “- compute sum on the DSP”, 24- compute sum on the DSP) = 24

write(1, “\n”, 1

) = 1

openat(AT_FDCWD, “/dev/fastrpc-adsp”, O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)

openat(AT_FDCWD, “/etc/localtime”, O_RDONLY|O_CLOEXEC) = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=127, …}) = 0

fstat(3, {st_mode=S_IFREG|0644, st_size=127, …}) = 0

read(3, “TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0”…, 4096) = 127

lseek(3, -71, SEEK_CUR) = 56

read(3, “TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0”…, 4096) = 71

close(3) = 0

socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3

connect(3, {sa_family=AF_UNIX, sun_path="/dev/log"}, 110) = 0

sendto(3, "<11>Feb 21 06:07:20 calculator: "…, 76, MSG_NOSIGNAL, NULL, 0) = 76

openat(AT_FDCWD, “/dev/fastrpc-adsp”, O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)

sendto(3, "<11>Feb 21 06:07:20 calculator: "…, 76, MSG_NOSIGNAL, NULL, 0) = 76

futex(0xffffb977b688, FUTEX_WAKE_PRIVATE, 2147483647) = 0

sendto(3, "<11>Feb 21 06:07:20 calculator: "…, 129, MSG_NOSIGNAL, NULL, 0) = 129

sendto(3, "<11>Feb 21 06:07:20 calculator: "…, 77, MSG_NOSIGNAL, NULL, 0) = 77

sendto(3, "<11>Feb 21 06:07:20 calculator: "…, 149, MSG_NOSIGNAL, NULL, 0) = 149

sendto(3, "<11>Feb 21 06:07:20 calculator: "…, 129, MSG_NOSIGNAL, NULL, 0) = 129

sendto(3, "<11>Feb 21 06:07:20 calculator: "…, 77, MSG_NOSIGNAL, NULL, 0) = 77

write(1, “Error: compute on DSP failed”, 28Error: compute on DSP failed) = 28

write(1, “\n”, 1

) = 1

write(1, “\nusage: ./calculator <1/0 run lo”…, 54

usage: ./calculator <1/0 run locally>

) = 54

sendto(3, "<11>Feb 21 06:07:20 calculator: "…, 61, MSG_NOSIGNAL, NULL, 0) = 61

exit_group(1) = ?

+++ exited with 1 +++


Please guide.

-Amit

That’s something interesting right there. You’re running debian 20.02, yet it looks like there is stuff in that example that is expecting Android, which you are definitely not running.

Or more in particular, it is expecting the ion driver for Android. My guess is that you could get past this error by rebuilding the kernel with ion support enabled, since it is part up upstream kernel. Should be enough to add “CONFIG_ION=y”.

Not sure about the fastrpc-adsp error, probably something similar, maybe a missing driver.

With Debian 20.02, you don’t need to rebuild the kernel, the only patch you need is a devicetree one to enable fastrpc support: loic.poulain/linux.git - [no description]

You can also patch the devicetree at runtime instead (on the target):

# git clone https://github.com/96boards/dt-update.git
# cd dt-update
# make
# sudo ./scripts/db410c/enable-fastrpc.sh
# sudo reboot

Then you should have a /dev/fastrpc-adsp device

Also make sure you have installed correct modem firmware (r1036.1). This firmware should offer a new fastrpcsmd-apps-dsp endpoint to communicate with the dsp:

# ls -al /sys/class/remoteproc/remoteproc0/remoteproc0\:smd-edge/
[...]
drwxr-xr-x  4 root root    0 Mar 11 08:48 remoteproc0:smd-edge.fastrpcsmd-apps-dsp.-1.-1
[...]

Hi Loic,
tried this dts update (debian 20.02) without rebuilding kernel and reboot,
/dev/fastrpc-adsp is still not found.
Logs below:
Thanks,
Amit


linaro@linaro-alip:~$ ls -la /dev/f
fd/ full fuse
linaro@linaro-alip:~$ dmesg | grep -i fast
[ 2.559852] random: fast init done
linaro@linaro-alip:~$ dmesg | grep -i rpc
[ 0.249005] RPC: Registered named UNIX socket transport module.
[ 0.249026] RPC: Registered udp transport module.
[ 0.249040] RPC: Registered tcp transport module.
[ 0.249053] RPC: Registered tcp NFSv4.1 backchannel transport module.
linaro@linaro-alip:~$ dmesg | grep -i remote
[ 5.666816] remoteproc remoteproc0: 4080000.remoteproc is available
[ 6.591332] remoteproc remoteproc1: a204000.wcnss is available
[ 6.597803] remoteproc remoteproc1: powering up a204000.wcnss
[ 6.602703] remoteproc remoteproc1: Booting fw image qcom/msm8916/wcnss.mdt, size 7260
[ 7.275702] remoteproc remoteproc1: remote processor a204000.wcnss is now up
[ 7.476334] qcom_wcnss_ctrl remoteproc1:smd-edge.WCNSS_CTRL.-1.-1: WCNSS Version 1.5 1.2
[ 7.602233] remoteproc remoteproc0: powering up 4080000.remoteproc
[ 7.605034] remoteproc remoteproc0: Booting fw image qcom/msm8916/mba.mbn, size 230272
[ 7.647919] qcom-q6v5-mss 4080000.remoteproc: MBA booted, loading mpss
[ 7.933140] remoteproc remoteproc0: remote processor 4080000.remoteproc is now up
linaro@linaro-alip:~$ ls -al /sys/class/remoteproc/remoteproc0/remoteproc0:smd-edge/
total 0
drwxr-xr-x 14 root root 0 Mar 12 11:10 .
drwxr-xr-x 4 root root 0 Mar 12 11:10 …
lrwxrwxrwx 1 root root 0 Mar 12 11:20 of_node → …/…/…/…/…/…/…/firmware/devicetree/base/soc/remoteproc@4080000/smd-edge
drwxr-xr-x 2 root root 0 Mar 12 11:20 power
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.apr_apps2.-1.-1
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.apr_audio_svc.-1.-1
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.DIAG.-1.-1
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.DIAG_2.-1.-1
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.DIAG_2_CMD.-1.-1
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.DIAG_CMD.-1.-1
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.DIAG_CNTL.-1.-1
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.IPCRTR.-1.-1
drwxr-xr-x 4 root root 0 Mar 12 11:10 remoteproc0:smd-edge.rpmsg_chrdev.0.0
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.SSM_RTR_MODEM_APPS.-1.-1
drwxr-xr-x 3 root root 0 Mar 12 11:10 remoteproc0:smd-edge.sys_mon.-1.-1
-r–r–r-- 1 root root 4096 Mar 12 11:20 rpmsg_name
-rw-r–r-- 1 root root 4096 Mar 12 11:10 uevent
linaro@linaro-alip:~$ grep -i fast /boot/config-5.4.0-qcomlt-arm64
CONFIG_HAVE_FAST_GUP=y
CONFIG_QCOM_FASTRPC=y
CONFIG_GPIOLIB_FASTPATH_LIMIT=512
CONFIG_ARCH_HAS_FAST_MULTIPLIER=y
linaro@linaro-alip:~$ lsmod
Module Size Used by
aes_neon_blk 32768 1
bnep 32768 2
btqcomsmd 20480 0
btqca 20480 1 btqcomsmd
bluetooth 651264 24 btqca,btqcomsmd,bnep
ecdh_generic 16384 2 bluetooth
wcn36xx 73728 0
ecc 32768 1 ecdh_generic
qrtr_smd 20480 0
venus_enc 28672 0
venus_dec 36864 0
crct10dif_ce 16384 1
smsc75xx 49152 0
adv7511 36864 0
cec 53248 1 adv7511
qcom_wcnss_pil 24576 0
snd_soc_lpass_apq8016 20480 0
snd_soc_msm8916_digital 61440 0
snd_soc_msm8916_analog 45056 0
snd_soc_lpass_cpu 24576 1 snd_soc_lpass_apq8016
snd_soc_lpass_platform 20480 1 snd_soc_lpass_cpu
qcom_q6v5_mss 28672 0
snd_soc_apq8016_sbc 16384 0
qcom_sysmon 20480 2 qcom_wcnss_pil,qcom_q6v5_mss
qcom_q6v5 16384 1 qcom_q6v5_mss
qmi_helpers 28672 1 qcom_sysmon
qcom_camss 135168 0
msm 774144 0
qcom_common 16384 2 qcom_wcnss_pil,qcom_q6v5_mss
venus_core 81920 2 venus_dec,venus_enc
qcom_glink_smem 16384 1 qcom_common
videobuf2_dma_sg 24576 3 qcom_camss,venus_dec,venus_enc
qcom_rng 16384 0
v4l2_fwnode 28672 1 qcom_camss
v4l2_mem2mem 32768 3 venus_dec,venus_core,venus_enc
videobuf2_memops 20480 1 videobuf2_dma_sg
videobuf2_v4l2 32768 4 qcom_camss,venus_dec,venus_enc,v4l2_mem2mem
videobuf2_common 53248 6 qcom_camss,venus_dec,videobuf2_v4l2,venus_core,venus_enc,v4l2_mem2mem
mdt_loader 16384 4 qcom_wcnss_pil,msm,qcom_q6v5_mss,venus_core
socinfo 20480 0
videodev 262144 8 v4l2_fwnode,qcom_camss,venus_dec,videobuf2_v4l2,videobuf2_common,venus_core,venus_enc,v4l2_mem2mem
mc 61440 5 videodev,qcom_camss,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem
rpmsg_char 20480 0
rmtfs_mem 20480 2
qrtr 20480 9 qrtr_smd
ip_tables 32768 0
x_tables 49152 1 ip_tables
rtc_pm8xxx 20480 1
linaro@linaro-alip:~$


did you install r1036.1 firmware package (as explained in the wiki)?

Yes, copied following chipcode r1036.1, binaries from: modem_proc\build\ms\bin\EAAAANGZ
efs1.bin efs2.bin efs3.bin efs_image_meta.bin mba.mbn mcfg_hw.mbn mcfg_sw.mbn qdsp6sw.mbn
to : /lib/firmware/qcom/msm8916/ and also to /lib/firmware/modem/

Yes this is the right location, you must reboot after that. But you should copy also the modem* files (modem.mb0, …, modem.mdt)

Rebooted many times already. Not found: “/dev/fastrpc-adsp”.
Help needed to resolve.

Couldn’t find any modem bins with chipcode.
Rootfs used linaro 20.02–linaro-buster-alip-dragonboard-410c-660.img.gz

$ ls /lib/firmware/qcom/msm8916/
efs1.bin efs_image_meta.bin mcfg_sw.mbn modem.b02 modem.b19 modem.b24 modem.mdt wcnss.b01 wcnss.b06 wcnss.b11
efs2.bin mba.mbn modem.b00 modem.b07 modem.b20 modem.b25 qdsp6sw.mbn wcnss.b02 wcnss.b09 wcnss.mdt
efs3.bin mcfg_hw.mbn modem.b01 modem.b17 modem.b23 modem.b27 wcnss.b00 wcnss.b04 wcnss.b10.

Then should probably ask qcom for the right package. It is supposed to released it publicly at some point.

Hi Loic,
I think “/dev/fastrpc-adsp” should be enabled after dts and kernel changes at linaro 20.02 release. Plz, confirm the patches.
I shall check for modem bins with qualcomm.
Thanks,
Amit

Yes bu if firmware does not expose the right ‘smd-edge’ node (fastrpcsmd-apps-dsp.-1), the device is not created.

Hi Loic,
Executing calculator example on dsp is success after updating the modem fw to r1036.1.
Thanks,
Amit


linaro@linaro-alip:~/calculator_ship$ sudo ./calculator 0 5
src/rpcmem_android.c:134:stat Failed on /dev/ion

  • starting calculator test
    src/rpcmem_android.c:134:stat Failed on /dev/ion - allocate 20 bytes from ION heap
  • creating sequence of numbers from 0 to 4
  • compute sum on the DSP
  • sum = 10
  • success