On 3/28/2024 1:03 AM, yfliu2008 wrote:
Dear experts,
I am wondering if we can have an Userspace IO alike component added to NuttX
kernel? It can help exposing video frame buffers or neural network
accelerators alike devices to user land services. Often kernel has little to do
with such devices and their management are offloaded to user land.
I think that this is already fully supported. Video frame buffers are
matured have been in use by NX and LVGL for years.
General shared memory device support is also provided by standard POSIX
shared memory interfaces.
Guess that we may need following things in NuttX kernel:
Have "CONFIG_ARCH_UIO_VBASE" alike Kconfig items added to give virtual addresse
for devices memory in user space.
Have "up_addrenv_map(), up_addrenv_unmap()" alike interfaces added to
encapsulate MMU mapping operations of different chip architectures. These are used by UIO
component to a.
I am VERY opposed to adding non-standard, non-portable application
interfaces. That is forbidden in a POSIX OS (unless there is no
option). Standard shard memory access is already supported as are
interfaces for all devices that have dedicated memory to be shared.
If we allow non-standard application interfaces into the we are, in the
long run, destroying the OS.
Have UIO framework added which exposes an "uio_register_device()" interface
to BSP so that to instantiate different UIO devices with specific device path,
address range and IRQ data.
Then userland apps can use standard file operation interfaces to access the UIO
devices in a portable manner. We proabably can start with simpler devices with
only one memory range and one IRQ.
You are proposing that the application control the virtual address
space? That is a really bad idea. The OS should (and does) control the
virtual address space)
I am unsure if some one have some considerations or there is better route in
NuttX kernel mode for such things? If so, please feel free to teach me.
Comments are highly welcomed.
A kernel-based solution that uses only POSIX interfaces (like shared
memory interfaces or IOCTLs) would be preferable.