aboutsummaryrefslogtreecommitdiff
path: root/kernel/ethosu_buffer.c
AgeCommit message (Collapse)Author
2024-02-12Restructure kernel driver source treeMikael Olsson
As a first step to have a clearer separation of the different parts of the kernel driver, the source files have been placed into separate directories according to their purpose and the different parts are only allowed to use headers from another part in the include folder. Files have been renamed accordingly to namespace them by their purpose. Change-Id: I75e09ebf0002c99a22b6d4b09d34504d186c32b3 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-06Split DMA memory and buffer setup in kernel driverMikael Olsson
To allow the NPU kernel driver to allocate and use DMA memory internally without creating a buffer instance, the DMA memory management has been split out from the buffer code. Change-Id: I46fdeee51b5ef786a54b8e7c866d137d91222724 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-06Remove buffer capacity, offset and resize in UAPIMikael Olsson
The UAPI no longer supports the buffer capacity, offset and resize functionality. Instead, the UAPI now only accepts a fixed size given at the creation of the buffer. This change was made because the features were not used and made the buffer handling more complicated. The user knows how big buffers they need for their networks so they don't need resize support or partial buffer usage support by having separate size and capacity with an offset. Without these features, the buffer instance no longer needs any IOCTL call support so it has been removed. However, to still be able to check the size of a buffer from its file descriptor, seek support has been implemented so lseek and similar functions can be used to get the size. The driver library's clear function that previously only reset the size and offset values of the buffer will now clear the buffer content instead. These are breaking changes so the Linux kernel NPU driver version and the driver library version have been given major version bumps. All the tests and other applications affected by these changes have been updated accordingly. Change-Id: Ifc34cf04724a95853ad23fd7398dd286f73bcdab Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-01Decrease log verbosity in the kernel modulesLedion Daja
Changed several logs level from info to dbg and removed redundant or uninformative logging in order to reduce verbosity of the kernel modules. Change-Id: Ie9ff7f3ae6478007ea58547380b3ddfef5d280b4 Signed-off-by: Ledion Daja <ledion.daja@arm.com>
2023-09-07Initialize UAPI structs copied to user spaceMikael Olsson
To not leak any information from kernel space when IOCTL calls copy data from kernel space to user space, the source struct in the IOCTL calls is now initialized. Change-Id: I0825e82ccdb51ced747e160dd7385fa1ed227eaf Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-09-07Fix IOCTL calls returning the wrong valueMikael Olsson
In some cases, the IOCTL functions didn't update the return value variable so the wrong value was returned from the IOCTL calls. Change-Id: I56529f8fb03cec52dbc555d5ed3d4e68e4bfab70 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-11Clear inference related data before freeing itMikael Olsson
To not leave behind any data in memory from buffers, inferences and networks, the memory allocated for them is now cleared before it is freed. Change-Id: I68c221b190e78f9b4c5022016c38f4ced5e78166 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-02-02Create device for Ethos-U kernel driverKristofer Jonsson
When the Ethos-U kernel driver is probed it creates a /dev/ethosu<nr> device node, which user space use ioctl to communicate with. When the driver is removed the Ethos-U resources must live on until all open file handles have been closed. The rpmsg device can be removed for a number of reasons, for example if the firmware is stopped or the remoteproc driver is removed. To allow the remove to complete without waiting for all file handles to close, a new 'struct device' is created by the kernel driver. This device will be used to memory allocations and will live on until the last file handle has been closed. Change-Id: I790d8219960f25fe64f58c11a865eb65c7b08974
2023-02-02Break circulare dependency on struct ethosu_deviceKristofer Jonsson
The 'struct ethosu_device' has been passed as argument to classes. This creates a circular dependency dependency and it gives all classes full visibility to all resources in the device struct. This patch removes the circular dependency. Using device_lock() and device_unlock() to for synchronization. Change-Id: I8322e6530c72d7bd67f48f411b4f14b612be2706
2023-02-02Converting Ethos-U driver to rpmsgKristofer Jonsson
The Ethos-U kernel driver has been converted from a platform driver with a custom firmware interface into a rpmsg driver. Change-Id: I9ae449f5e79eb02924e6630611d0893e5fec86be
2022-06-30Improved logging22.08-rc222.08-rc122.08Kristofer Jonsson
Add logging class for driver library. Log severity can be configured using an environment variable. Add information to prints in kernel space. Change-Id: I19a1078869733746726515a6cafb79110314066d
2022-05-18Check size of buffer before allocatingPer Åstrand
Avoid undefined behaviour from calling dma_alloc_coherent with requested size=0 as reported by UBSAN. Change-Id: I1732759464f1d88259edeea099b1729f4ae6b86f
2022-03-14Network infoKristofer Jonsson
Add UAPI and core message that allows user space space to fetch information about network models built into the firmware. Change-Id: Ic92529bce3edd0a5499e691a566bd065da2a72ad
2021-11-15Verify that dma buffer fits in the mapped range21.11-rc321.11-rc2Per Åstrand
Change-Id: I1ad92264eb5dae672faf3f5b08a6f987148f629e
2020-08-27Initial commit20.08-rc220.08Kristofer Jonsson
Change-Id: I14b6becc908a0ac215769c32ee9c43db192ae6c8