Hexagon SDK support for Dragonboard 820c

@parbatha We are trying on 5.7.

4.14 doesnt seem to be working

@Tatsumi

Blockquote On Wiki, latest kernel source code is acquired by branch “integration-linux-qcomlt”.
However mkbootimg uses initrd.img for kernel 4.14.0.
Is it correct?

Have you found the answer for this question? May I ask which version you have tried?

I am trying to use build 571 kernel and rootfs to test hexagon dsp. I followed instruction on wiki page.

When I execute the command: sh -c ‘echo start > /sys/devices/platform/adsp-pil/remoteproc/remoteproc0/state’ I got following error:

remoteproc remoteproc0: powering up adsp-pil
remoteproc remoteproc0: Direct firmware load for qcom/msm8996/adp.mbn failed with error -2
remoteproc remoteproc0: request_firmware failes: -2
remoteproc remoteproc0: Boot failed: -2
sh: 1: echo: echo: I/O error

Any ideas why this error occurs and how to fix it? Many thanks.

do you have adp.mbn in /lib/firmware/qcom/msm8996?

Hi Loic, I do not have that file. What i have are adsp.b00 adsp.b01 … adsp.b09 adsp.mdt adspr.jsn adspua.jsn

I am using the build 571 downloaded from here Linaro Snapshots

In the linux-board-support-package-r01700.1.zip file I do not see adp.mbn either. Where I can get this file?

Many thanks.

@vj-kumar May I ask which kernel version did you use?

I was trying to build kernel 5.4.28 and after enable CONFIG_QCOM_APR=y I got error as following:

drivers/soc/qcom/apr.o: In function apr_remove': /home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:704: undefined reference to qmi_handle_release’
drivers/soc/qcom/apr.o: In function servreg_ind_ack': /home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:202: undefined reference to qmi_txn_init’
/home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:213: undefined reference to qmi_send_request' /home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:224: undefined reference to qmi_txn_wait’
/home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:220: undefined reference to qmi_txn_cancel' drivers/soc/qcom/apr.o: In function apr_probe’:
/home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:622: undefined reference to qmi_handle_init' /home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:627: undefined reference to qmi_add_lookup’
/home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:633: undefined reference to qmi_txn_init' /home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:646: undefined reference to qmi_send_request’
/home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:658: undefined reference to qmi_txn_wait' /home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:680: undefined reference to qmi_handle_release’
/home/keeler/Downloads/820dev/kernel/drivers/soc/qcom/apr.c:653: undefined reference to qmi_txn_cancel' drivers/soc/qcom/apr.o:(.data+0x168): undefined reference to qmi_response_type_v01_ei’
drivers/soc/qcom/apr.o:(.data+0x248): undefined reference to `qmi_response_type_v01_ei’
Makefile:1076: recipe for target ‘vmlinux’ failed
make: *** [vmlinux] Error 1

Any idea how to fix this? If I set CONFIG_QCOM_APR=m then it built successfully.
Many thanks.

I would suggest to rely on latest snapshot and kernel (5.7). 5.4 is not in good shape for 820c.

It seems like the instructions here: https://github.com/96boards/documentation/wiki/Dragonboard-Hexagon-DSP#boot-the-remote-dsp is not up to date and 5.7 doesn’t have adsp defined in its device tree for 820c board. I was struggling to enable DSP with kernel 5.7.

Has anyone tried to setup hexagon DSP environment on 5.7 kernel successfully?

Hi Loic, I changed in dtsi to: firmware-name : lib/firmware/qcom/msm8996/adp.mdt and rebuilt the dts.

There is no firmware load error. but still have sh: 1: echo: echo: I/O error when execute sudo sh -c ‘echo start > /sys/devices/platform/adsp-pil/remoteproc/remoteproc0/state’

When I cat /sys/devices/platform/adsp-pil/remoteproc/remoteproc0/state the state is running. Does this mean I do not need to start the adsp-pil and is this the reason that it returns an error when I execute sudo sh -c ‘echo start > /sys/devices/platform/adsp-pil/remoteproc/remoteproc0/state’?

Sorry @Keeler, I have switched jobs and I no longer remember the version.

@Ajith_Kumaresh @ymj Can you help here?

Thanks,
Vijai Kumar K

I was trying to use kernel 5.7 as well. fastrpc and APR were not enabled by default. I set config_qcom_fastrpc and config_qcom_apr to y. I followed the instruction to build kernel and copy library etc. but I do not find adsp-pil folder in /sys/devices/platform.

I tried to copy adsp node from 5.4 device tree to 5.7. However, it failed to compile with following error:
Error: arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi:890.1-6 Label or path adsp not found

Did I miss anything? Anything else I need to set to use 5.7 to test hexagon DSP?

Many thanks in advance.

There is already adsp node in the dts of 4.7.

You should have:

/sys/devices/platform/soc/9300000.remoteproc

Once started it should give the remoteproc0:smd-edge subdirectory including remoteproc0:smd-edge.fastrpcsmd-apps-dsp.-1.-1

Moreover a /dev/fastrpc-adsp shoudl be created.

Hello Loic, Thank you for the reply. There is a 9300000.remoteproc folder and also the state is “running”.

I tried to sh -c 'echo start > /sys/devices/platform/soc/9300000.remoteproc/remoteproc/remoteproc0/state" I got the error:
sh1: 1: echo: echo: I/O error.

If i run getserial regardless. I got following error:
root@linaro-alip:/home/linaro# ./getserial
./getserial: /usr/lib/aarch64-linux-gnu/libadsprpc.so: no version information available (required by ./getserial)
hello getserial - fastrpc_apps_user.c:1580: Searching for fastrpc_shell_0 …hello getserial - fastrpc_apps_user.c:1603: open_shell failed with err 69 domain 0
hello getserial - fastrpc_apps_user.c:1736: Error 4b: adsp current process handle failed. domain 0
hello getserial - fastrpc_apps_user.c:1704: Error 0xffffffff: apps_dev_init failed for domain 0, errno No such file or directory
hello getserial - fastrpc_apps_user.c:1799: Error ffffffff: open dev -1 for domain 0 failed
Could not retrieve serial num

May I ask if the state is running does that mean the remoteproc is started? How can I fix the I/O error when I try to echo start to the state file?

Many thanks in advance.

You can not start since it’s already running (but you can stop and then start again).

If i run getserial regardless. I got following error:

Does it used to work?

maybe try strace ./getserial to retrieve more info about what happens

Hello Loic, Thank you for the reply.

It didn’t work before.

I tried strace ./getserial and i got following messages:
root@linaro-alip:/home/linaro# strace ./getserial
execve("./getserial", ["./getserial"], 0xffffc4cbb010 /* 19 vars /) = 0
brk(NULL) = 0x18c25000
faccessat(AT_FDCWD, “/etc/ld.so.preload”, R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/etc/ld.so.cache”, O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=95836, …}) = 0
mmap(NULL, 95836, PROT_READ, MAP_PRIVATE, 3, 0) = 0xffffb3154000
close(3) = 0
openat(AT_FDCWD, “/usr/lib/aarch64-linux-gnu/libadsprpc.so”, O_RDONLY|O_CLOEXEC) = 3
read(3, “\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\230\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=168352, ...}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb3197000 mmap(NULL, 239688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffffb3119000 mprotect(0xffffb313f000, 65536, PROT_NONE) = 0 mmap(0xffffb314f000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0xffffb314f000 mmap(0xffffb3152000, 6216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffffb3152000 close(3) = 0 openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\331\0\0\0\0\0\0”…, 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=628896, …}) = 0
mmap(NULL, 692344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffffb306f000
mprotect(0xffffb3108000, 61440, PROT_NONE) = 0
mmap(0xffffb3117000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x98000) = 0xffffb3117000
close(3) = 0
openat(AT_FDCWD, “/lib/aarch64-linux-gnu/libc.so.6”, O_RDONLY|O_CLOEXEC) = 3
read(3, “\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0(D\2\0\0\0\0\0”…, 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1429752, …}) = 0
mmap(NULL, 1502432, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffffb2f00000
mprotect(0xffffb3057000, 61440, PROT_NONE) = 0
mmap(0xffffb3066000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x156000) = 0xffffb3066000
mmap(0xffffb306c000, 11488, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffffb306c000
close(3) = 0
openat(AT_FDCWD, “/lib/aarch64-linux-gnu/libdl.so.2”, O_RDONLY|O_CLOEXEC) = 3
read(3, “\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\0\21\0\0\0\0\0\0”…, 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14560, …}) = 0
mmap(NULL, 78080, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffffb2eec000
mprotect(0xffffb2eef000, 61440, PROT_NONE) = 0
mmap(0xffffb2efe000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0xffffb2efe000
close(3) = 0
openat(AT_FDCWD, “/lib/aarch64-linux-gnu/libpthread.so.0”, O_RDONLY|O_CLOEXEC) = 3
read(3, “\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0Pu\0\0\0\0\0\0”…, 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=156168, …}) = 0
mmap(NULL, 193544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffffb2ebc000
mprotect(0xffffb2ed7000, 61440, PROT_NONE) = 0
mmap(0xffffb2ee6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a000) = 0xffffb2ee6000
mmap(0xffffb2ee8000, 13320, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffffb2ee8000
close(3) = 0
writev(2, [{iov_base="./getserial", iov_len=11}, {iov_base=": “, iov_len=2}, {iov_base=”/usr/lib/aarch64-linux-gnu/libad"…, iov_len=40}, {iov_base=": “, iov_len=2}, {iov_base=“no version information available”…, iov_len=58}, {iov_base=”\n", iov_len=1}], 6./getserial: /usr/lib/aarch64-linux-gnu/libadsprpc.so: no version information available (required by ./getserial)
) = 114
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb3195000
mprotect(0xffffb3066000, 12288, PROT_READ) = 0
mprotect(0xffffb2ee6000, 4096, PROT_READ) = 0
mprotect(0xffffb2efe000, 4096, PROT_READ) = 0
mprotect(0xffffb3117000, 4096, PROT_READ) = 0
mprotect(0xffffb314f000, 8192, PROT_READ) = 0
mprotect(0xffffb319b000, 4096, PROT_READ) = 0
munmap(0xffffb3154000, 95836) = 0
set_tid_address(0xffffb31958a0) = 5574
set_robust_list(0xffffb31958b0, 24) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0xffffb2ec2fd8, sa_mask=[], sa_flags=SA_SIGINFO}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0xffffb2ec3098, sa_mask=[], sa_flags=SA_RESTART|SA_SIGINFO}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192
1024, rlim_max=RLIM64_INFINITY}) = 0
brk(NULL) = 0x18c25000
brk(0x18c46000) = 0x18c46000
futex(0xffffb3151e48, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0xffffb3151e50, FUTEX_WAKE_PRIVATE, 2147483647) = 0
openat(AT_FDCWD, “/dev/fastrpc-adsp-secure”, O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/dev/fastrpc-adsp”, O_RDONLY|O_NONBLOCK) = 3
openat(AT_FDCWD, “/usr/lib/fastrpc_shell_0”, O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/vendor/dsp/fastrpc_shell_0”, O_RDONLY) = -1 ENOENT (No such file or directory)
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0xf3, 0), …}) = 0
ioctl(1, TCGETS, {B115200 opost isig icanon echo …}) = 0
openat(AT_FDCWD, “fastrpc_shell_0”, O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/rfsa/adsp/fastrpc_shell_0”, O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/lib/fastrpc_shell_0”, O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/dsp/fastrpc_shell_0”, O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/usr/share/fastrpc/fastrpc_shell_0”, O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, “/dsp/adsp/fastrpc_shell_0”, O_RDONLY) = -1 ENOENT (No such file or directory)
write(1, “hello getserial - fastrpc_apps_u”…, 160hello getserial - fastrpc_apps_user.c:1580: Searching for fastrpc_shell_0 …hello getserial - fastrpc_apps_user.c:1603: open_shell failed with err 69 domain 0
) = 160
write(1, “hello getserial - fastrpc_apps_u”…, 99hello getserial - fastrpc_apps_user.c:1736: Error 4b: adsp current process handle failed. domain 0
) = 99
ioctl(3, FASTRPC_IOCTL_INVOKE, 0xffffd7dea8c8) = 39
close(3) = 0
write(1, “hello getserial - fastrpc_apps_u”…, 129hello getserial - fastrpc_apps_user.c:1704: Error 0xffffffff: apps_dev_init failed for domain 0, errno No such file or directory
) = 129
write(1, “hello getserial - fastrpc_apps_u”…, 92hello getserial - fastrpc_apps_user.c:1799: Error ffffffff: open dev -1 for domain 0 failed
) = 92
write(1, “Could not retrieve serial num \n”, 31Could not retrieve serial num
) = 31
exit_group(-1) = ?
+++ exited with 255 +++

hi @Keeler

Kernel version used for the purpose was 4.14.

Not entirely sure, but I think the fastrpc_shell_0 application needs to be loaded on the dsp prior invoking getserial. And you don’t have this file… Have you tried other dsp application examples?

Hello Ymj, Thank you for the reply. May I ask if it was successful eventually on 4.14 to use DSP hardware? The problem I had with 4.14 was that fastrpc.c I copied from newer version (5.4) was not compatible with functions (dma_buf function) in 4.14 kernel. Many thanks in advance.

Yes on kernel 4.14, I was able to test example application matrix_multi on ADSP after loading adsp.mdt on boot-up. Though I believe, if you copy fastrpc driver from v5.4 that might need efforts on porting it to v4.14.

Hi ymj, Thank you for your reply. May I ask if there is anywhere else (other version kernel than 5.4) I can get fastrpc.c driver? Did you write yourself? Many thanks in advance.