aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-08-09Add version to driver library23.08-rc1Mikael Olsson
A version has been added to the driver library so users can check if they are compatible with the driver library in use. The Python wrapper has been updated accordingly to make the version information available. Change-Id: I8affbf7068c057f7103adf14c9e4a331d547fbcc Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-09Add kernel driver version check in driver libraryMikael Olsson
The driver library will now check that it's compatible with the kernel driver in use by checking the kernel driver's version. The kernel driver version has also been made available to the library users and the Python wrapper has been updated accordingly. Change-Id: Ieae8c0bfc323f945038e7264eceeab90c833f76d Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-09Add kernel driver version to UAPIMikael Olsson
The kernel driver's version is now exposed in the UAPI so the UAPI user can validate that they are compatible with the kernel driver in use. Change-Id: I52d096dfaedb8c3c1889d27a907626be96779ee7 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-09Add protocol version check during probingMikael Olsson
To ensure that the Linux kernel NPU driver and the firmware used are compatible, the NPU driver will now request and verify the protocol version when setting up the device during the probing. Change-Id: I13bca96bf6f98ca90dc79e11ae637c269c2a5eec Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-09Remove protocol version request IOCTL from UAPIMikael Olsson
The current implementation of the protocol version request IOCTL call doesn't return any version information and the protocol version is not needed by any userspace program as it's for the communication between the Linux kernel NPU driver and firmware. The IOCTL call has therefore been removed from the UAPI and the inference runner has been updated accordingly. Change-Id: I9ed09e55d9522996a182f237c8a6db2f45bc40a9 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-09Fix concurrent access to IDR in kernel driverMikael Olsson
The IDR instance must be protected against concurrent access and the device mutex in the kernel driver should be used to protect it. However, the device mutex is not locked when an inference is released or when the mailbox is cleared which means the IDR is not protected in these instances. To resolve this, the missing mutex locks have been added and the functions using the IDR instance have been updated to make it clearer that the device mutex is expected to be locked when called. Change-Id: Id0b314db556836c36663d6481806b7c113e55e5f Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-07Correct license in UAPI header fileJonny Svärd
Add missing `WITH Linux-syscall-note` to the ethosu.h UAPI header file Change-Id: Ie7abf81108d85faab963a262a27f93c02064e4dd Signed-off-by: Jonny Svärd <jonny.svaerd@arm.com>
2023-07-31Fix kernel driver probe not freeing endpointMikael Olsson
If an error occurs after the kernel driver probe has created a rpmsg endpoint, the endpoint is not freed during the clean up. Clean up code for the endpoint has now been added to resolve this. Change-Id: I9259713f2b7dcf4926e6f317c57f2791ab3463de Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-07-31Fix double free in kernel driver probe clean upMikael Olsson
If the probe function is past the NPU device registration when a failure occurs, the device instance will be freed twice causing a crash. This occurs because the device's release callback will free the device instance when the device is unregistered and then the probe clean up will attempt to free it again. To resolve this, the probe will now only directly free the device instance if the registration fails and otherwise let the device's release callback handle it. Change-Id: Iafe87e7ca44b91f8e0e2e870106a4b8c2a69dd8f Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-07-31Change NPU kernel driver to use async probingMikael Olsson
If the rpmsg channel to communicate with the subsystem is not available until after the NPU kernel driver has been registered, the driver's probe function will be called from the rpmsg message receive callback and block handling of any other messages until the probing is done. To avoid blocking the callback while performing the probing and to allow the probe to communicate with the subsystem, the kernel driver will now request that its probe function is called asynchronously. Change-Id: Iaeaa4a2322f6a76c0acd202e69b91a8beeb6114b Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-06-16Add type check when getting message by IDMikael Olsson
When the kernel driver handles incoming rpmsg messages, it uses the ID in the message header to find the corresponding mailbox message. The mailbox messages are stored as a generic message struct that is later cast to the specific message type. There is currently no type information stored in the generic message struct so only the ID is used to distinguish between the mailbox messages. This means if an incorrect ID is received that matches a mailbox message with a different type, the kernel driver will cast the message struct to the wrong type. Type information has now been added to the generic message struct and will be checked when trying to find the corresponding mailbox message so both the ID and type must be correct to find a matching message. Change-Id: Ifdbceea6ec4ae7078f424a32ce1ff5474bd22fef
2023-05-29Add device capabilities caching in kernel driverMikael Olsson
To not have to fetch the capabilities from the device for each time they are requested with the UAPI, the kernel driver will now fetch and save the capabilities during the device initialization and use the saved copy for the UAPI requests. With this change, the character device creation in the device initialization has been moved to be the last step so the capabilities are fetched and saved before the character device is created. Change-Id: I57956aedb983fbc1765d45906a1c6182e2cd5b96
2023-05-16Fix shared state race in mailbox message handling23.05-rc223.05Mikael Olsson
When IOCTL calls are handled and when sending messages to the mailbox, the device mutex is locked. However, when received mailbox messages are handled, the mutex is not locked so there are possible concurrent access races in shared states e.g. an inference's status may be updated while another IOCTL caller is reading it. To avoid these races, the mutex is now locked while messages received from the mailbox are handled. Change-Id: I4d51da542410ab02fb0f890c939269c642176b2c
2023-05-15Add rpmsg message magic check in kernel driverMikael Olsson
The kernel driver will now verify the magic value in an incoming message's header before any further processing of the message is performed to avoid trying to handle an invalid message. Change-Id: I7ae1cac19a6fe4b78316decff4ca2147175ee07a
2023-05-02Fix kernel driver not setting coherent DMA maskMikael Olsson
When the kernel driver creates the Ethos-U device, it doesn't setup the coherent DMA mask. This causes the kernel to generate a warning the first time any of the coherent DMA functions are used and the kernel will end up using a default DMA mask. To ensure that the device uses the correct DMA mask and to no longer get the warning, the kernel driver will now setup the DMA mask for the device. Change-Id: I92c67c85be1754970412da92161dbf1ec993bca3
2023-04-20Fix compiler flag passing in Python API CMake file23.05-rc1Mikael Olsson
To support cross-compilation of the driver library Swig C wrapper for the Python API, the CMake file must pass on the C and CXX flags that have been setup by the build environment so that the correct flags, include paths etc are used when building the wrapper. Change-Id: I6288016056c5a4eeef1162ea2a9afb1e3ab4b86a
2023-04-20Fix Python API CMake file ETHOS_U_DRIVER_LIB pathMikael Olsson
The ETHOS_U_DRIVER_LIB environment variable in the Python API CMake file specifies that the driver library archive will be found in a lib subdirectory in the build directory. This is incorrect as the archive will be put directly into the driver library directory and the CMake file has been updated accordingly. Change-Id: Ie296f89f7669d69f193d96d994ad8e1918e3d1eb
2023-04-20Fix license file path in Python API CMake fileMikael Olsson
The CMake file for the Python API, currently fails to copy the license file to the build directory because it incorrectly assumes that the file is in the Python API folder. The license file that should be used is in the top of the repository and the CMake file has been updated accordingly. Change-Id: Ia0131cc27abdf28d355c69a556229691901971e5
2023-03-24Minor formatting fixJonny Svärd
Change-Id: I64151321ac4a020045de5802beb29fe0013a5c3f
2023-03-24Update toolchain filesJonny Svärd
Add aarch64-none-linux-gnu toolchain file Change-Id: I04742a8e0478f31087ea9c0d5a7d62c7e07bf4f4
2023-02-15Add documentation about required Linux kernel version23.02-rc223.02Kristofer Jonsson
Change-Id: Id5349a7668ff7ce4d23730d98aa9bd5032a1ece2
2023-02-14Update documentation about AMP communicationKristofer Jonsson
Change-Id: I3d7926cb16b613f588ef33944546df394193160e
2023-02-08Removing core interface23.02-rc1Kristofer Jonsson
The Ethos-U kernel driver has been converted into a rpmsg driver and the ethosu_core_interface.h has been replaced by ethsou_core_rpmsg.h. Change-Id: If6db8c20cd88e950545eed561ed95c067157d061
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
2023-02-02Removing watchdog and resetKristofer Jonsson
Removing watchdog and firmware reset as a preparations for the migrations to rpmsg. Change-Id: Ic1053e3f4301ecadbde8c59dbaed437625a0a5ea
2023-02-02Add rpmsg capabilities to remoteprocKristofer Jonsson
Tie in mbox and reset driver and add support for virtio carveouts. Also move the reserved mem for device mem to the remoteproc node. Change-Id: I7e8878d32ae7c02d5b43198e45652e77f8ff79ca
2023-01-16Updating .gitignoreKristofer Jonsson
Change-Id: If27999db4f18355b571b67e5e5d663a703c3f6a3
2023-01-16Add rpmsg interfaceKristofer Jonsson
Change-Id: Id70e249448cea13cb9273d68c91080342d5c5973
2022-12-19Add custom cross compilation documentationJonny Svärd
Change-Id: I1ab89146bf897c4c35180ab09f08064511f573f8
2022-11-04Update README how to contribute22.11-rc222.11Kristofer Jonsson
Change-Id: I69d0acf67327424809397f5fcf236b99bc980d71
2022-10-25Added Python interface for Arm Ethos-U NPU driver library.22.11-rc1Kshitij Sisodia
Python `ethosu_driver` could be built as part of Arm Ethos-U Linux driver library CMake flow. See driver_library/python/README.md for more details. Change-Id: I177a890add5c13df9a839f4f43621f972afe5ab1 Signed-off-by: Kshitij Sisodia <kshitij.sisodia@arm.com>
2022-10-25Add list of files to be ignored from inclusive language scanningLedion Daja
Change-Id: Ib21a9692e0a8f78cf584ab6ee3fadc0568822e88
2022-09-08Add cancel inference testsDavide Grohmann
These tests are run with a special custom firmware Change-Id: I0dfcae1fbaa1287d4b52fd8f6c802bebb5248d3b
2022-08-29Add linux_driver_stack testsDavide Grohmann
Change-Id: I303f1424eb46576847312672f7ed5ac03c05aee1
2022-08-25Remove sgm775 supportDavide Grohmann
That platform has been replaced by Corstone-1000 Change-Id: I2dd6e190cbbc84c02f101bd6214c802585d8ca25
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-06-30Fix bug in inference releaseKristofer Jonsson
Once the inference file descriptor has been created the inference release must be handled by the file descriptor release callback. Change-Id: Ic514983e85821ea3893e11c5c682610f67d1ae31
2022-06-29Bug fix for queue capacity calculationKristofer Jonsson
Reduce queue capacity by one byte, else it will not be possible to distinguish between an empty and full queue. Change-Id: Ia243a7175833826dc816d536cc79ac5a252f3e3a
2022-06-29Return network info error codeKristofer Jonsson
The error code from the core side was not correctly propagated to user space. Change-Id: I40e502f8dc3a77de064f441beeb62603d013e318
2022-06-29Add missing padding to core interfaceKristofer Jonsson
The padding is important to separate the read- and write indices by at least one cache line, to prevent cache clean and invalidation to corrupt data for the remote CPU. Change-Id: I1d50ac6c63ef4cb3e11b0c293aefaac34ac8eb1f
2022-06-01reset controller driver for corstone1000 ESPer Åstrand
Add reset controller driver for external system. The driver is instantiated for each subsystem reset needed to control. Change-Id: I481e56124de30b807858ca3f5fe8f78fc18502ce
2022-05-24Update uapi definition for capability requestPer Åstrand
ETHOSU_IOCTL_CAPABILITIES_REQ is a read ioctl with a parameter. Change-Id: Ife20d4de86351053600e6c6ba174dc40896f0aef
2022-05-23Use ids for identifying messages sent to EthosU firmwareDavide Grohmann
Avoid to use pointers to kernel memory as identify messages, prior this change, if memory is reused that can lead to unexpected conflicts. Remove ref counting from capabilities and network_info since memory is freed in only one place. Finally, extract the capabilities code in its own files. Change-Id: I9ab7257f3ab85fa3347be65b3739e0daf9b5a441
2022-05-19Add sentinel entry to dt array22.05-rc322.05-rc222.05Per Åstrand
Change-Id: Ic5d98c108593a16034c7dbc18043bbee13c31833
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-05-18Replace usage of forbidden strncpy with strscpyDavide Grohmann
strscpy copies max destination size -1 chars and ensures NULL termination. It also return an error if the destination buffer is too small. Change-Id: I88e9e5020b2b26ca50c12ae845dad070855a8bde
2022-05-09Reset firmware when inference cancellation fails22.05-rc1Davide Grohmann
If an inference fails to be cancelled and it is still in a pending state, reset the whole firmware. Indeed the assumption is that something is at fault on the firmware side and it is not progressing. Change-Id: I2f568b2167d86cda3cb96a5e83551b018f5fc55d