Skip to content

Migrate to dmdrvi 2.0 (64-bit I/O contract) - #1

Merged
JohnAmadis merged 1 commit into
mainfrom
feature/dmdrvi-2.0-migration
Sep 26, 2026
Merged

JohnAmadis merged 1 commit into
mainfrom
feature/dmdrvi-2.0-migration

Conversation

@JaxCalder

Copy link
Copy Markdown
Contributor

Summary

  • Bumps every DIF registration in src/dmdma.c (_create, _free, _open, _close, _read, _write, _ioctl, _flush, _stat) from dmod_dmdrvi_dif_api_declaration(1.0, ...) to 2.0, matching the ecosystem-wide cutover in dmdrvi.h.
  • _read/_write: signature updated to the 2.0 contract (offset -> dmdrvi_offset_t, return type -> dmdrvi_ssize_t), with explicit -EINVAL (negative offset) and -EOVERFLOW (size > INT64_MAX) guards added. dmdma's DMA streams are not byte-addressable (all I/O is driven through _ioctl), so these remain stubs that return 0 after validation - behavior is otherwise unchanged.
  • _stat: version bump only. stat->size was already assigned without a truncating cast (stat->size = 0;), so no further change was needed for the dmdrvi_size_t field-type widening.
  • _open already declared and used the dev_num parameter required by both the 1.0 and 2.0 contract - no signature drift found here (unlike the pre-existing bug fixed in dmclk's migration).
  • No _path_ready or _friend_changed implementation exists in this driver, so nothing to migrate there.
  • Grepped the whole repo (including tests/) for other DIF call sites or uint32_t offset/size usage tied to the interface; found none outside src/dmdma.c.

Part of choco-technologies/dmod-ecosystem#8.

Test plan

  • rm -rf ~/.cache/dmod/dmf-get/{manifests,packages}/* to avoid a stale pre-2.0 dmdrvi manifest
  • cmake -S . -B /tmp/build_dmdma_test -DDMOD_TOOLS_NAME=arch/x86_64 -DDMOD_MODULE_VERSION=0.0.1
  • Confirmed fetched dmdrvi.h shows dmod_dmdrvi_dif(2.0, ...) for all DIF functions (not 1.0)
  • cmake --build /tmp/build_dmdma_test --target dmdma completed with [100%] Built target dmdma, no new compiler warnings (only a pre-existing harmless linker note)
  • Maintainer to validate on real STM32F4/F7 hardware

Bumps every DIF registration to the 2.0 interface version dmdrvi.h now
requires. The functional changes are in _read/_write (offset ->
dmdrvi_offset_t, return type -> dmdrvi_ssize_t, with explicit
-EOVERFLOW/-EINVAL guards). dmdma's _read/_write are stubs (DMA streams
are driven entirely through ioctl(), not byte addressing), so only the
signature and validation guards changed; the stub behavior (return 0)
is preserved. _stat already stored size as an unsigned type with no
truncating cast, so it required no change beyond the version bump.

_open already carried the dev_num parameter required by both the 1.0
and 2.0 contract, so no drift bug was found there (unlike dmclk).

Part of choco-technologies/dmod-ecosystem#8.
@JohnAmadis
JohnAmadis merged commit 040bb4e into main Sep 26, 2026
3 checks passed
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