Mastodon Politics, Power, and Science: NPU
Showing posts with label NPU. Show all posts
Showing posts with label NPU. Show all posts

Thursday, November 26, 2026

Debugging the Hexagon V73 NPU on Snapdragon X Elite (X1E80100) Linux

J. Rogers, SE Ohio

Getting the Qualcomm Hexagon V73 NPU running on mainline Linux on a commercial Snapdragon X Elite laptop (Dell Latitude 7455, running Arch/Omarchy) is an exercise in separating kernel plumbing, FastRPC process domains, and firmware signature boundaries.
Tonight, instead of guessing at high-level AI frameworks, we stripped the stack down to its lowest layers and traced every syscall and RPC return code from the kernel up. Here is what actually happens under the hood—and what works today.

1. The Hardware & Kernel Plumbing Works Out of the Box
At the lowest level, mainline Linux on x1e80100 already brings up the Compute DSP (CDSP) cleanly:
  • The remoteproc subsystem boots the CDSP (32300000.remoteproc) using the OEM qccdsp8380.mbn firmware.
  • Character devices /dev/fastrpc-cdsp, /dev/fastrpc-cdsp-secure, and /dev/dma_heap/system are present and active.
  • The userspace FastRPC listener daemon (cdsprpcd) attaches to domain 3 (attachguestos and adsp_default_listener) without errors.

2. Signed Process Domains (-U 0) Are Live on the NPU
Running Qualcomm’s low-level FastRPC diagnostic suite (fastrpc_test) in Signed Process Domain mode (-U 0) proves that the Hexagon V73 NPU is actively executing code and sharing dma_heap / ION buffers with the ARM64 Oryon CPU:
text
Allocate 4000 bytes from ION heap
Creating sequence of numbers from 0 to 999
Compute sum on domain 3

Call calculator_sum on the DSP
Sum = 499500

Call calculator_max on the DSP
Max value = 999
[PASS] libcalculator.so
[PASS] libmultithreading.so
Use code with caution.
  • libcalculator.so and libmultithreading.so both pass. The CPU allocates a buffer in dma_heap, passes it over FastRPC to the Hexagon V73 NPU, and reads back the computed sum (499500) and max (999).
  • libhap_example.so fails with 0x4e (ENOSYS): The older Android HAP_mem_map_dmahandle ioctl is unsupported on mainline Linux dma_heap, which is expected.

3. Why Unsigned PDs (-U 1) and QNN HTP (libQnnHtpV73Skel.so) Fail
When moving from Qualcomm’s pre-signed test libraries to custom DSP code or QAIRT’s QnnHtp backend, two distinct errors appear depending on which Process Domain mode you request:
A. Unsigned Process Domain (-U 1) Fails With 0x8000054f
Even after generating a device-specific testsig-0xd2b85295.so for the SoC serial number (3535520405 / 0xd2b85295), strace on fastrpc_test -d 3 -U 1 revealed the exact point of failure:
text
openat(AT_FDCWD, "/dev/fastrpc-cdsp-secure", O_RDONLY|O_NONBLOCK) = 7
openat(AT_FDCWD, "/usr/lib/rfsa/adsp/cdsp/fastrpc_shell_unsigned_3", O_RDONLY) = 8
ioctl(7, FASTRPC_IOCTL_INIT_CREATE, 0xffffeeb64c00) = 18446744071562069327
Use code with caution.
That return value (0xffffffff8000054f -> 0x8000054f) is AEE_EQURTBADASID (an ASID allocation failure inside adsp_process_group_create_mpd_attrs on the CDSP). Crucially, FASTRPC_IOCTL_INIT_CREATE fails inside the CDSP firmware before userspace ever searches for or loads testsig-*.so.
As tracked in qualcomm/fastrpc Issue #400, 0x8000054f occurs when the CDSP boot firmware (qccdsp8380.mbn) and the DSP userland shells (fastrpc_shell_unsigned_3) come from mismatched firmware builds—or when the OEM CDSP image restricts unsigned shell creation.
B. Signed Process Domain (-U 0) Fails With 0x80000406 on HTP Skels
Forcing QAIRT’s QnnHtp device creation into Signed PD mode (QNN_HTP_DEVICE_CONFIG_OPTION_SIGNEDPD) gets past FASTRPC_IOCTL_INIT_CREATE—the session opens—but immediately fails when loading the HTP skeleton library:
text
<E> DspTransport.openSession qnn_open failed, 0x80000406, prio 100
<E> IDspTransport: Unable to load lib 0x80000406
Use code with caution.
0x80000406 is AEE_EUNABLETOLOAD:
  • QAIRT’s Linux libQnnHtpV73Skel.so ships in hexagon-v73/unsigned/ without a production CDSP ELF signature, so Signed PD rejects it.
  • Windows ARM64 OEM Driver Packs (.cab) include libQnnHtpV73SkelDrv.so signed via a Windows Authenticode .cat catalog (qcnspmcdm8380.cat). The Linux CDSP loader does not parse Windows .cat catalogs—it verifies embedded Qualcomm MBN/ELF hash segments—so it rejects the Windows .so as well.

4. Where Things Stand for X1E80100 Linux Developers
  1. The Silicon Works: On x1e80100 Linux, /dev/fastrpc-cdsp + cdsprpcd + dma_heap is functional today for properly signed Linux CDSP binaries.
  2. Matched Firmware Is Critical for User PDs: Recent community testing in qualcomm/fastrpc Issue #377 demonstrated that pairing a matched CDSP.HT.2.9.c1-00075 firmware and DSP shell set with QAIRT 2.48 resolves 0x8000054f and runs Llama-3.2-1B on X1E80100 Linux at ~195 tok/s.
  3. Zero-Copy CPU + GPU Is Unblocked: While CDSP firmware/signature parity catches up across OEM laptops, the Oryon CPU (NEON/i8mm) and Adreno X1-85 GPU (Mesa Turnip Vulkan) already share dma_heap buffers cleanly with zero firmware gates.

Debugging the Hexagon V73 NPU on Snapdragon X Elite (X1E80100) Linux

J. Rogers, SE Ohio Getting the Qualcomm Hexagon V73 NPU running on mainline Linux on a commercial Snapdragon X Elite laptop (Dell Latitude 7...