Skip to content

FAQ

QEMU provides a deterministic, reproducible environment that eliminates hardware variance during architecture validation. Every developer gets the exact same execution environment regardless of whether they have physical hardware. The QEMU aarch64 virt machine matches the target ISA (ARM64). Moving a driver to real hardware by swapping only the backend is the design goal; today the example drivers call the QEMU backend themselves, so they would change.

Why not support every device class immediately?

Section titled “Why not support every device class immediately?”

The first milestone validates the abstraction boundary, not device coverage. Starting with four classes (UART, I2C, SPI, GPU) proves the framework handles both simple serial peripherals and complex accelerators. Adding GPIO, NPU, or others later exercises only the porting guide - the core remains unchanged.

Portability depends on stable interfaces, not on absorbing device details into a monolithic framework. The core is about 1,000 lines managing lifecycle, registry, and events. All hardware logic lives in drivers and backends. This keeps the trusted surface small and auditable.

  • Faster iteration without kernel patch review cycles
  • A licence of KDAL’s own choosing (in-tree code must be GPLv2-compatible; KDAL’s files do not yet carry one consistent licence)
  • Easy deployment via insmod without kernel rebuilds
  • Clear separation for thesis evaluation

The architecture is designed for future upstreaming - see Upstreaming.

How does device selection work for userspace?

Section titled “How does device selection work for userspace?”

KDAL exposes a single /dev/kdal character device. Userspace selects a device via the KDAL_IOCTL_SELECT_DEV ioctl, which stores the selection in per-fd state (file->private_data). Subsequent read()/write() calls route to the selected device’s driver. Multiple processes can open /dev/kdal independently, each with their own device selection.

Why misc_register instead of a custom major number?

Section titled “Why misc_register instead of a custom major number?”

Automatic minor number allocation avoids conflicts with other drivers and simplifies deployment.

The QEMU backend allocates a 4096-byte ring buffer per device, balancing memory usage with throughput for emulated I/O. Real hardware backends use DMA buffers or MMIO regions instead.

Why are KUnit tests separate from integration tests?

Section titled “Why are KUnit tests separate from integration tests?”

KUnit tests run inside the kernel and test internal APIs without userspace. Integration tests run from userspace and exercise the full ioctl path. Both are needed: KUnit catches internal regressions, integration tests validate the end-to-end contract.

How do I build the userspace tool without kernel headers?

Section titled “How do I build the userspace tool without kernel headers?”

The tool mirrors ioctl ABI definitions locally and does not depend on kernel headers:

Terminal window
./scripts/dev/build.sh --variant release kdality
  1. Add the class enum to include/kdal/types.h
  2. Create a driver under src/drivers/example/
  3. Wire init/exit into src/core/kdal.c
  4. Add KUnit tests
  5. Update kdality (kdalctl.c) to display the new class name

CI builds and tests the module on Linux 6.18; the local scripts use 6.6.80. The API surface (misc_register, debugfs, copy_to_user/copy_from_user, mutex, list_head) has been stable since Linux 4.x, so backporting is straightforward.

.kdh (KDAL Device Header) files are declarative descriptions of a hardware device - register maps, signal definitions, capabilities, and power states. .kdc (KDAL Driver Code) files contain imperative event handlers that implement driver logic. Together they separate what a device is from how it behaves.

The compiler (kdalc) reads a .kdc file plus its .kdh header, then runs four pipeline stages:

  1. Lexer - tokenises source into 80+ token types
  2. Parser - builds an arena-allocated AST via recursive descent
  3. Semantic analysis - resolves symbols (register access modes are checked by kdality lint, as warnings, not here)
  4. Code generation - emits kernel C + Makefile.kbuild; the generated module does not build yet (open finding O7)

The aim is a driver of a few dozen lines of intent instead of the kernel boilerplate around it (no measurement yet). The compiler emits the platform_driver registration, OF match table and devm_* resource calls; the generated module does not build yet (O7). New programmers can focus on driver logic rather than kernel API minutiae.

Not yet: that is the goal. A .kdc file uses high-level constructs like probe { ... }, on read(DEV.DATA) { ... } and write(DEV.CTRL, 0x01), and the compiler generates the module’s C, but until open finding O7 is fixed that C does not build without changes by hand.

Create a .kdh file anywhere the compiler can find it (or in lang/stdlib/), following the format in the Language Specification. A minimal .kdh file declares a device name and a register map (capabilities are optional). Then import it from your .kdc with an alias, import "mydevice.kdh" as DEV;, and name its registers as DEV.<register>: without the alias, accesses are not checked.