Skip to content

Introduction

KDAL (Kernel Device Abstraction Layer) is a hardware-agnostic, pluggable abstraction framework inside the Linux kernel that lets developers write portable device drivers and accelerator backends once and run them on any embedded platform.

Device driver development in embedded Linux is tightly coupled to specific SoCs, kernel versions, and vendor BSPs:

  • Drivers are most of the Linux kernel’s code
  • Vendor BSPs duplicate driver logic for each SoC variant
  • Porting a driver across platforms means rewriting its hardware access
  • GPU/NPU accelerator integration is even more fragmented

KDAL separates what a device looks like (registers, signals, capabilities) from how the driver behaves (event handlers). It introduces a domain-specific language (DSL) with two file types:

File type Extension Purpose
Device Header .kdh Declares registers, signals, power states, capabilities
Driver Code .kdc Implements event handlers (probe, read, write, signal, power)

The KDAL compiler (kdalc) reads the .kdc file and the headers it imports and generates the module’s C. The generated module does not build yet (open finding O7 in KDAL’s docs/open-findings-20261121.md).

Checked Register Access

Register access modes (ro/wo/rw) are declared in the header, and kdality lint warns about a write to a read-only register (W003). The compiler does not reject it yet.

Backend Agnostic

A design goal: one driver across QEMU, MMIO, platform devices, Device Tree and VirtIO. Today the example drivers use the QEMU backend.

Not Turing-Complete

No recursion, no heap, no pointers. Loop bounds should be constants (a bound that may not be one is warned about).

Full Toolchain

Compiler, CLI tool, VS Code extension, Vim plugin, standard library of 7 device headers, and CMake modules (7 installed).

flowchart TB US["User space<br/>kdality (CLI), testapp and benchmark (tests/userspace),<br/>kdaltest (tests/integration)<br/>(implemented)"] CP["Control plane: src/core/<br/>chardev.c: /dev/kdal, ioctl dispatch<br/>debugfs.c: introspection and the demand report"] CORE["Core runtime: src/core/<br/>registry, event, power, demand, kdal, module"] DRV["Example drivers: src/drivers/example/<br/>uart, i2c, spi, gpu (accelerator ops)"] BE["Backends: src/backends/<br/>generic: devicetree, platdev, socglue<br/>qemu: qemubackend, virtioio, virtioaccel, mmio"] HW["Devices: MMIO, platform devices,<br/>device tree nodes, virtio"] US -->|ioctl, read, write| CP CP --> CORE CORE --> DRV DRV --> BE BE --> HW classDef observed stroke:#0ca30c,stroke-width:2px classDef implemented stroke:#fab219,stroke-width:2px class CP,CORE,DRV,BE observed class US implemented

The same diagram as KDAL’s README (key: Start here, Reading the diagrams): green parts are built into kdal.ko, which CI loads and tests with its KUnit suites; the user-space programs build, but CI does not run them against the module.

Platform Architecture Status
Linux (QEMU aarch64) ARM64 Primary target: module and KUnit in CI (Linux 6.18)
Linux (native x86_64) x86_64 Development host
Linux (RISC-V) riscv64 Host tools only (release archive); module not tested
macOS (Apple Silicon) ARM64 Toolchain only