Skip to content

feat(hardware): add Linux UIO physical MMIO backend - #577

Draft
Ivan-VHS wants to merge 4 commits into
mainfrom
feat/linux-uio-hardware-backend
Draft

Ivan-VHS wants to merge 4 commits into
mainfrom
feat/linux-uio-hardware-backend

Conversation

@Ivan-VHS

@Ivan-VHS Ivan-VHS commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the first physical transport behind Reaper's checked native MMIO API.

  • Adds a Linux UIO adapter for explicitly selected /dev/uioN character devices and map indices.
  • Verifies the opened character device major/minor against /sys/class/uio/uioN/dev.
  • Verifies sysfs physical base, map size and page offset against the board/project grant before mmap.
  • Uses a bounded mapping (64 MiB maximum), a selected mmap map index, volatile width-specific accesses, endian conversion and CPU I/O barriers for x86, ARMv7+/AArch64 and RISC-V.
  • Restricts each callback to the configured physical base/size and independently enforces the transport read/write capability mask.
  • Defaults to read-only unless REAPER_HW_CAP_MMIO_WRITE is explicitly granted and the OS allows a writable UIO node.
  • Adds an unprivileged file-backed mmap test harness; CI does not touch physical devices.
  • Integrates the adapter in CMake, installs its public header/library, and documents device setup, C usage and limitations.

Safety and trust boundary

No /dev/mem fallback, arbitrary physical address mapping, board flashing, bootloader writes, kernel module loading, probe discovery, SWD/JTAG, interrupt registration or DMA implementation is added.

The UIO kernel driver is responsible for reserving the physical resource and selecting correct memory attributes. Device-node permissions are the effective host privilege boundary. The config capability mask is a host-supplied grant, not a cryptographic project authorization broker. Board-specific hardware-in-the-loop qualification remains required.

Verification

The new Linux-only CTest target is native-hardware-uio. Its temporary-file backing checks MMIO mapping, width, endian, ordering, read-only write denial, range bounds and device-path rejection. The dedicated workflow now configures/builds that target and runs the test alongside the Reaper Hardware Workspace source conformance suite.

Comment thread src/hardware_uio.c
strncmp(path, prefix, sizeof prefix - 1U) != 0)
return false;

cursor = path + sizeof prefix - 1U;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants