rproc_handle_devmem(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… rproc_handle_devmem(9) β€” the Kernel API Manual, bestie edition ✨

okay so real talk: this is a page from the Kernel API Manual, section 9 (kernel routines, iykyk). Buckle up πŸŽ€


🌸 NAME 🌸

rproc_handle_devmem β€” handles a devmem resource entry. that's the whole vibe, she does one thing and she does it πŸ’…


⭐ SYNOPSIS ⭐

int rproc_handle_devmem (struct rproc *rproc , void *ptr , int offset ,
       int avail );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • rproc β€” the remote processor handle 🫢 this is the whole context, the main character, the struct rproc * you're working on
  • ptr β€” the devmem resource entry itself, no cap
  • offset β€” where this resource entry sits, offset-wise πŸ“
  • avail β€” how much data is actually available β€” literally used for sanity checking the image, she's the vibe check for the firmware 🧚

πŸ’– DESCRIPTION πŸ’–

so remote processors commonly need to access certain on-chip peripherals. like, that's just their whole thing.

some of these remote processors access memory through an iommu device, and they might need us to configure their iommu before they can reach the on-chip peripherals they need. highkey a whole setup arc πŸ”₯

this resource entry is literally a request to map one of those peripheral devices.

these devmem entries carry the physical address of the device in the 'pa' member. if a specific device address is expected, then 'da' holds it β€” and jsyk, currently that's the only use case supported πŸ™ˆ (no other modes, periodt). 'len' holds the size of the physical region we need to map. πŸ“

currently we just "trust" those devmem entries to contain valid physical addresses. and by "trust" i mean we simply believe them 😭 but that's going to change: the plan is that implementations tell us the ranges of physical addresses the firmware is allowed to request, and we don't let firmwares request access to physical addresses outside those ranges. so it's giving security glow-up, coming soon ✨


πŸ‘‘ RETURN πŸ‘‘

0 on success, or an appropriate error code otherwise. that's it, that's the return πŸ’œ


🌈 SEE ALSO 🌈

Kernel file ./drivers/remoteproc/remoteproc_core.c, plus the whole friend group: rproc_da_to_va(9), rproc_find_carveout_by_name(9), rproc_check_carveout_da(9), rproc_handle_vdev(9), rproc_handle_trace(9), rproc_alloc_carveout(9), rproc_release_carveout(9), rproc_handle_carveout(9), rproc_add_carveout(9), rproc_mem_entry_init(9), rproc_of_resm_mem_entry_init(9), rproc_of_parse_firmware(9), rproc_alloc_registered_carveouts(9), rproc_resource_cleanup(9), rproc_trigger_recovery(9), rproc_crash_handler_work(9), rproc_boot(9), rproc_shutdown(9), rproc_detach(9), rproc_get_by_phandle(9), rproc_set_firmware(9), rproc_add(9), devm_rproc_add(9), rproc_type_release(9), rproc_alloc(9), rproc_free(9), rproc_put(9), rproc_del(9), devm_rproc_alloc(9), rproc_add_subdev(9), rproc_remove_subdev(9), rproc_get_by_child(9), rproc_report_crash(9). go read all of them, i'll wait πŸ“


ngl bestie the takeaway is: devmem entries carry pa, da and len, we currently trust them fully, and we're gonna stop trusting them. character development πŸ’€

byeeeee 🫢 this gem dropped in the ./drivers/remoteproc source tree, October 2026 (version energy: rproc_handle_devmem(9)), and that's the page, slay βœ¨πŸ’…πŸ’–

πŸ“¦ where this page comes from