ikwzm/udmabuf ? reverse-engineered prompt

Reverse engineered prompt

Build me a Linux kernel module for an FPGA or embedded board that gives user programs a shared DMA buffer they can map from user space.

I want to be able to load it with a buffer size, get a device like /dev/udmabuf0, and then open it, mmap it, or read and write it like a normal file. It should also expose the physical address in sysfs so another driver or a user space device app can use it for DMA. If possible, let me turn cache handling on and off when opening the device, and support flushing or invalidating the cache too.

Please make it work cleanly with module parameters, support creating a few buffers, and include the basic build and install setup for a modern Linux kernel. If you need to check current kernel docs or examples, go ahead and look them up online.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab