Age | Commit message (Collapse) | Author |
|
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>
|
|
Currently when the rpmsg channel name is copied from the rpmsg device,
the full size of the name array is given to strncpy. This means if there
is no null-terminator in that size, the name will be left unterminated.
To ensure that the name is always null-terminated, the size given to
strncpy is now decreased by one and the name array is zero initialized.
Change-Id: I73b4b597f51a63e5dac23945735f307cb1035e25
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
|
|
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>
|
|
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>
|
|
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>
|
|
Currently, when the NPU driver allocates buffers for the NPU subsystem,
it does not provide DMA addresses that can be used by the subsystem.
Instead, the DMA address is set to the Linux Kernel physical address and
must be translated by the firmware before use.
The correct DMA address is not provided because the device instance
created by the NPU driver has not been DMA configured so it does not
know about the subsystem's address requirements.
To resolve this, the device will now inherit the DMA configuration from
the parent rproc device.
Change-Id: Ibcbf30e812e72ebf8672bbe9dde3a9f9abdaa417
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
|
|
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>
|
|
Instead of locking the device mutex for all IOCTL calls to the NPU
device, the mutex will now only be locked for the calls that have
resources that must be protected from concurrent access. IOCTL calls
that only copy static data do not need to lock the mutex.
The same device mutex is used for all concurrent access protection in
the driver, including the mailbox handling, so removing unnecessary
locking decreases the need to wait for the mutex.
Change-Id: Ic606fe0e1db4aa2e3d4e579ada74418491546468
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
|
|
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>
|
|
The variable used for the return value from the rpmsg callback to handle
mailbox messages isn't initialized when handling some message types.
To resolve this, the variable is now initialized by default.
Change-Id: I7862a6bc3479f03ca06536d94eb4478263e49b70
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
The Ethos-U kernel driver has been converted from a
platform driver with a custom firmware interface into a
rpmsg driver.
Change-Id: I9ae449f5e79eb02924e6630611d0893e5fec86be
|
|
Removing watchdog and firmware reset as a preparations for the
migrations to rpmsg.
Change-Id: Ic1053e3f4301ecadbde8c59dbaed437625a0a5ea
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Implement kernel watchdog that detects when firmware becomes
unresponsive.
Change-Id: I5c5b58a56a2ce629e1fd7cabae83b61823239ea6
|
|
Add UAPI and core message that allows user space space to fetch
information about network models built into the firmware.
Change-Id: Ic92529bce3edd0a5499e691a566bd065da2a72ad
|
|
Support referencing a network model by index that has been built into
the firmware binary.
Change-Id: Idd5294376ea82503dfeafe1203dcc0694d296dfe
|
|
Bump the hardcoded timeout value to allow for userspaces process to
be scheduled and receive the response from the capabilities request.
Change-Id: Ia2c8a0554870cf8470a2bb40bf8ed450c10f8446
|
|
Allocate a range of minor numbers and use the minor number as index
when creating the /dev/ethosu<nr> device node.
Change-Id: I76c2a3995ff5087e42a4e95945eb884a4bfb58f6
|
|
Change-Id: I2a5e5ca78bc80117938b706fc31767a8d668b931
|
|
Change-Id: Ia90e2d74c3e071c6e3de381cfada9a5a155d7529
|
|
Change-Id: Id5aa197312c88b0c448dc085d8477ed67da24724
|
|
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
|
|
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
|
|
Change-Id: I14b6becc908a0ac215769c32ee9c43db192ae6c8
|