Upstreaming Strategy
Current Status
Section titled “Current Status”KDAL is developed out-of-tree under GPL-2.0-only, the kernel’s own
licence, since 2026-12-03 (KDAL #61): LICENSE is the GPL version 2,
every C source starts with its SPDX line, the module declares
MODULE_LICENSE("GPL"), and the userspace ABI header
include/kdal/ioctl.h is GPL-2.0-only WITH Linux-syscall-note, as the
kernel’s UAPI headers are. Before that the repository said GPLv3 while the
module and the compiler said version 2. Upstreaming still needs community
review. This page outlines the engineering practices meant to keep that
path open.
Design Principles
Section titled “Design Principles”Minimal public API
Section titled “Minimal public API”The user-kernel ABI consists of 6 ioctl commands (5 dispatched;
KDAL_IOCTL_POLL_EVENT is defined but returns -ENOTTY), plus read and
write on /dev/kdal and read-only debugfs files. No new system calls, no
new filesystem types, no new socket families.
Linux kernel coding style
Section titled “Linux kernel coding style”All code follows checkpatch.pl guidelines:
- Tabs for indentation, 80-column soft limit
/* C89 comments */in kernel codekdal_*prefix for global symbols (the module exports none: noEXPORT_SYMBOL)- Proper
gotoerror unwinding
Standard kernel APIs only
Section titled “Standard kernel APIs only”| KDAL usage | Kernel API |
|---|---|
| Character device | misc_register() / misc_deregister() |
| Debug interface | debugfs_create_dir() / debugfs_create_file() |
| Synchronisation | struct mutex / mutex_lock() / mutex_unlock() |
| Linked lists | struct list_head / list_for_each_entry_safe() |
| Memory | kmalloc() / kfree() / kzalloc() |
| User copy | copy_to_user() / copy_from_user() |
| Events | DECLARE_WAIT_QUEUE_HEAD / wake_up_interruptible() (woken on each event; nothing waits on it yet) |
No custom allocators, no out-of-tree dependencies.
Backend isolation
Section titled “Backend isolation”Platform-specific code lives exclusively under src/backends/. The core and
driver layers never reference SoC registers, DMA engines, or bus controllers
directly. The core can be reviewed independently of any hardware.
Versioned ABI
Section titled “Versioned ABI”KDAL_IOCTL_GET_VERSION returns major/minor/patch. Any ABI change increments
the version. Userspace tools check compatibility:
struct kdal_ioctl_version ver;ioctl(fd, KDAL_IOCTL_GET_VERSION, &ver);if (ver.major != EXPECTED_MAJOR) { /* incompatible */ }Upstreaming Checklist
Section titled “Upstreaming Checklist”- Settle the licence as GPL-2.0-only, with SPDX lines on every C file (KDAL #61)
- Pass
checkpatch.pl --stricton all files - Pass
sparsewith zero warnings - Achieve
cppcheckclean run - Write
Documentation/driver-api/kdal.rstin kernel docs format - Submit to
linux-kernel@vger.kernel.orgas RFC patch series - Address reviewer feedback (expect 3–5 revision cycles)
- Find a subsystem maintainer willing to sponsor
Patch Series Structure
Section titled “Patch Series Structure”Recommended submission order:
- Headers -
include/kdal/: types, API contracts, ioctl definitions - Core -
src/core/: lifecycle, registry, events, chardev, debugfs - QEMU backend -
src/backends/qemu/: reference implementation - Example drivers -
src/drivers/example/: UART, I2C, SPI, GPU - Tests -
tests/kunit/: in-kernel test suite - Documentation - kernel
Documentation/format
Timeline
Section titled “Timeline”| Phase | Gate |
|---|---|
| Out-of-tree validation | Thesis defense |
| Community RFC | Post-defense, after real hardware results |
| Formal submission | After 1–2 RFC revision cycles |
| Acceptance | Depends on maintainer bandwidth |