[PATCH 0/3] uio/dma-buf: Give UIO users access to DMA addresses.

Thomas Petazzoni thomas.petazzoni at bootlin.com
Mon Apr 14 19:21:25 UTC 2025


Hello Andrew,

On Mon, 14 Apr 2025 12:08:44 -0500
Andrew Davis <afd at ti.com> wrote:

> "UIO is a broken legacy mess, so let's add more broken things
> to it as broken + broken => still broken, so no harm done", am I
> getting that right?

Who says UIO is a "broken legacy mess"? Only you says so. I don't see
any indication anywhere in the kernel tree suggesting that UIO is
considered a broken legacy mess.

Keep in mind that when you're running code as root, you can load a
kernel module, which can do anything on the system security-wise. So
letting UIO expose MMIO registers of devices to userspace applications
running as root is not any worse than that.

> If your FPGA IP can do DMA then you should not be using UIO in
> the first place, see UIO docs:
> 
> > Please note that UIO is not an universal driver interface. Devices that
> > are already handled well by other kernel subsystems (like networking or
> > serial or USB) are no candidates for an UIO driver.  
> 
> The DMA subsystem already handles DMA devices, so write a DMA driver.

My FPGA IP block is not a DMA controller that would fit the dmaengine
kernel subsystem. It's a weird custom device that doesn't fit in any
existing subsystem, and that happens to do "peripheral DMA" (i.e the IP
block is DMA-capable itself, without relying on a separate DMA
controller). So this (very valid) recommendation from the UIO
documentation doesn't apply to my device.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com


More information about the dri-devel mailing list