top | item 22795741

(no title)

unlinked_dll | 5 years ago

I almost certainly have no idea what I'm talking about but

Can I write a device driver using io_uring? As in talk to i2c endpoints instead of normal files?

discuss

order

Veserv|5 years ago

From what I understand and looking at the supported opcodes [0] io_uring allows submitting certain "system calls" (and some other auxiliary operations you would normally expect in an async API) asynchronously. So, if you can interact with your device driver using those system calls, then you should be able to do so. I am personally not familiar with Linux, so I am unsure if those system calls are sufficient for normal operation, but it lacks ioctl, so it is not sufficient for total replacement in all cases.

[0]: https://github.com/torvalds/linux/blob/master/include/uapi/l... search IORING_OP_

sly010|5 years ago

I don't know the answer to that question, but if you are developing an embedded project (and especially if it's a raspberry PI) you can mmap() the hardware I2C registers to userspace memory and use them directly. You will have to basically write the I2C driver in userspace and it won't be portable but it's not that hard and it will make for very low latency I2C communication. I had to do this once for latency.

Skunkleton|5 years ago

i2c and high performance async IO are pretty rarely overlapping requirements. I’m curious what your use case is?

asdfasgasdgasdg|5 years ago

I don't know anything either, but I assume not? With a device driver you'd be handling interrupts directly by registering an interrupt service routine and all that good stuff. io_uring is a user->kernel API because userspace doesn't handle those interrupts directly. Instead, device driver ISRs fill buffers and what have you, then kernel notifies user via io_uring that data is ready.

shuss|5 years ago

Nope. io_uring is an API that helps with asynchronous I/O.

unlinked_dll|5 years ago

That's kind of my question. I want async I/O with a device, can io_uring help?