aboutsummaryrefslogtreecommitdiff
path: root/kernel/ethosu_mailbox.h
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-06Change create network UAPI to take a user bufferMikael Olsson
To not allow the buffer for a network instance to be changed after creation, the create network UAPI will now take the network model data as a user buffer. The content of the user buffer is copied into an internally allocated DMA buffer that cannot be accessed by the user. This breaks the current API so the Linux kernel NPU driver version and the driver library version have been given major version bumps. All the tests, documentation and other applications affected by the changes have been updated accordingly. Change-Id: I25c785d75a24794c3db632e4abe5cfbb1c7ac190 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-09-07Fix wait for TX buffer blocking receive callbackMikael Olsson
Currently, the mailbox uses the rpmsg_send function to send messages, which will block for up to 15 seconds if there is no TX buffer available for the message. This is an issue because the device mutex is locked while waiting and the receive callback for messages uses the same mutex to prevent concurrent access so no received messages can be handled while waiting for a TX buffer. To resolve this, the mailbox has been changed to use the rpmsg_trysend function, which will return directly if there is no TX buffer available, together with a wait queue. While waiting in the queue to send the message, the device mutex is released to not block the receive callback and other users of the mutex. Change-Id: I34fbfd21167b49fb83744ab2473ab02632a809ee 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-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-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-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
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-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
2022-05-05Add support for inference cancellationDavide Grohmann
Send cancel inference messages to the ethosu subsystem to abort inference execution there. Also mark inference as aborted in the linux driver stack itself, so pending inference messages are not resent when resetting the firmware. Change-Id: I244c2b119fd7995d14e3859815abf2a00c7f0583
2022-04-04Reset firmwareKristofer Jonsson
Reset the firmware if it becomes unresponsive. Use ping to send keep alive requests. Only monitor ping and inference request messages. The other messages pass no resources to the firmware and can be cancelled without resetting the firmware. Change-Id: Ifbcc370f02d79a64f25598f11376a1dc84a7a066
2022-03-23Kernel watchdog timeoutKristofer Jonsson
Implement kernel watchdog that detects when firmware becomes unresponsive. Change-Id: I5c5b58a56a2ce629e1fd7cabae83b61823239ea6
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
2022-03-10Firmware resident modelKristofer Jonsson
Support referencing a network model by index that has been built into the firmware binary. Change-Id: Idd5294376ea82503dfeafe1203dcc0694d296dfe
2021-06-10Add support for handling capabilities requestsDavide Grohmann
Change-Id: Id5aa197312c88b0c448dc085d8477ed67da24724
2021-01-26Improve mailbox message handlingJonny Svärd
Introduce a 32b magic for each message. Verify the magic for all incoming messages. Add reset function - in case of protocol error, effectively reset/empty the incoming queue. Add an error message type and message Add version request/response Verify payload length of responses (when applicable) Change-Id: I8aadd4012024492533d52e2cdb38630fce5c36e2
2020-11-16Add PMU config to inference creationPer Åstrand
Add PMU configuration information to inference creation. Change-Id: Id8a69517a5d3e4822dbaf46f76cadb2700b3d981
2020-09-17Support inferences with multiple inputs and outputsKristofer Jonsson
Build flatbuffers library. Update network class to extract IFM and OFM dimensions from the tflite file. Update the uapi and core apis to support up to 16 IFM and OFM buffers per inference. Change-Id: I2f2f177aa4c2d5f9f50f23eb33c44e01ec2cbe09
2020-08-27Initial commit20.08-rc220.08Kristofer Jonsson
Change-Id: I14b6becc908a0ac215769c32ee9c43db192ae6c8