aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
5 daysAdd -Werror flag to treat warnings as errorsHEADmastermainRajasekaran Kalidoss
This patch adds -Werror flag to treat warnings as errors. Signed-off-by: Rajasekaran Kalidoss <rajasekaran.kalidoss@arm.com> Change-Id: I46fa315b4b730d3cb8e0c2b351621fb188df875b
10 daysPrint useful build variables in CMakeLists fileRajasekaran Kalidoss
To make it easier to verify the settings used for a build, additional prints of useful cmake variables has been added to the CmakeLists.txt file. Change-Id: I38c176ddda49076e7555a8c9a38ce13d8ab9cf87 Signed-off-by: Rajasekaran Kalidoss <rajasekaran.kalidoss@arm.com>
12 daysChange remoteproc to map ROM as device memoryMikael Olsson
The ROM is memory attached to the remote processor and should be mapped as device memory rather than normal memory to ensure memory transactions are handled correctly. To ensure this, the remoteproc driver will now map the ROM as device memory. Change-Id: I1b5f1dcd7af06bb9e1656f653d65813f7af424c3 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-04-08Add additional error logging in NPU driverMikael Olsson
To make it easier to distinguish where an error occurred in the NPU driver, additional logging has been added to the error cases. Change-Id: I9d744e7adf3ba3098d456d1f3c2859aa0ce66de4 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-04-04Add IOCTL command names to driver library loggingMikael Olsson
Currently the driver library will log IOCTL commands as hexadecimal values, which makes it hard to know what command is being logged unless you know the command values. To make this easier, the driver library will now translate the command values into their respective names when logging. Change-Id: I7ef2f411b0261ea7819c1a7a6825422859031a25 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-02-29Fix deprecated options in kernel uncrustify configMikael Olsson
The uncrustify config for the kernel modules contain deprecated options that causes uncrustify to generate warnings. To resolve this, the deprecated options have been replaced with their new counterpart. Change-Id: I55428e42a4346aaee16e773e76eb92e7b1814b68 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-02-21Fix UAPI device type naming and validationMikael Olsson
The device types in the UAPI have been renamed to follow the UAPI namespacing and driver library validation has been added to ensure the driver library and UAPI device enum values match. The kernel and driver library version have been given a major bump for the introduction of the device type in the capabilities. Change-Id: Ib782b0bd7a8641db88521f8be399f709d2d73816 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-02-19Add suppression for non-zero index access in logdMikael Olsson
cppcheck generates a warning about the non-zero index access in the toCpu function. This is expected behavior so the warning has been suppressed. Change-Id: I852ca8f0b987215156edb826e643e3844e35049d Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-02-19Fix unnecessary string copy in logdMikael Olsson
To avoid making unnecessary copies of the path string, it will now use move semantics. Change-Id: Iecef1df1929cc9748b5a33f6bed088bfd785acce Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-02-19Fix unnecessary string copying in inference runnerMikael Olsson
To avoid copying strings unnecessarily in the inference runner the functions have been changed to take the strings as const reference rather than copying them. Change-Id: I173e37c7f7b08ada5d421bb9008a4bf36284f6c5 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-02-19Add NPU device type to capabilitiesMikael Olsson
In preparation to support the Linux kernel driver directly managing the NPU without a subsystem. A NPU device type has been added to the capabilities to be able to specify what kind of NPU is used. Change-Id: I45345b7d75d234f821d70b858453d3af2a99194e Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-02-12Rename macros and types to namespace their usageMikael Olsson
Macros and types have been renamed accordingly to namespace them by their usage in the new kernel driver source tree structure. This is done in a separate commit from the restructuring to avoid Git from seeing some of the moved files as new ones because they have been both moved and modified at the same time and thus losing the connection in the history. Change-Id: Icd4d8e8c76779479b5b46a55bf1d4f78a629c281 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
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>
2024-01-16Add Sparse and build test information to README24.02-rc124.02Mikael Olsson
To make it easier to build the driver stack, the README now specifies the minimum required Sparse version needed and how the driver stack has been build tested. Change-Id: I1676ff8333da0f752badbf366229bf3d65ee4657 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-01-16Fix inference cancellation behaviorMikael Olsson
There is currently a possible race when canceling an inference, where the inference may be the one currently running and a response will be sent later or the inference response is already in the mailbox queue. To handle these cases, the kernel will no longer process the inference response for an inference that has been marked as aborted or is in the process of being aborted. Change-Id: Ifcd86591b09075f994ed2e903cb11ba7c0ee0418 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2024-01-16Remove reject inference testMikael Olsson
Rejecting an inference is not supported so the test for rejecting an inference has been removed. Change-Id: Ia175559bb9945af0446aa8c3990760aa2208538b Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-12-20Change PMU event counter values to use 64-bitMikael Olsson
The PMU event counter value is an accumulation of 32-bit values during the inference and to ensure the total value fits in the rpmsg message and UAPI, the variable holding the value has been changed to 64-bit. The driver library, Python wrapper and inference runner have been changed accordingly to support the 64-bit values. Change-Id: I09a8e45eb75800c8a787f83abff5a3693148cc15 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-20Update documentation about UAPI license exception23.11-rc323.11Jonny Svärd
Add mention of UAPI being licensed with 'WITH Linux-syscall-note' exception to the README Add the Linux-syscall-note.txt license exception file Change-Id: I8f72d03fb87c8c00cbd75642b6407055e48a4021 Signed-off-by: Jonny Svärd <jonny.svaerd@arm.com>
2023-11-14Make all kernel module Sparse warnings into errors23.11-rc2Mikael Olsson
The CMake files for the kernel modules have been updated to treat all Sparse warnings as errors so that warnings cause the build to fail. Change-Id: I3682afc3beea7244bb6e0831b2baf48b95611dbc Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-14Fix NPU driver inference poll callback return typeMikael Olsson
The poll file operation function pointer is expected to return the __poll_t type but the currently implemented poll inference function returns an unsigned int. This breaks the type safety and causes Sparse to generate a warning. To resolve this, the return type has been changed to __poll_t and the function now uses with EPOLL constants that share the same type. Change-Id: I41dadb758c7c4b42b431d96a94c6b2cc9f960013 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-14Fix device id data ptr using 0 instead of NULLMikael Olsson
In some of the kernel modules, 0 is used instead of NULL to indicate that there is no data in the of_device_id struct. These instances have now been replaced with NULL instead. Change-Id: I14f4aabf266bb5144107e101006e257bb7876782 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-14Make internal functions static in kernel modulesMikael Olsson
Internal functions in some of the kernel modules were not marked as static and have now been fixed. Change-Id: Ibec000e4370f2438e7190a9178e05513fcccda26 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-14Fix iomem pointer usage with rproc_mem_entry_initMikael Olsson
The carveout memory is being mapped with one of the ioremap functions that returns a iomem pointer and should normally only be passed to functions that request iomem pointers because they shouldn't be dereferenced. Currently, the iomem pointer is passed to rproc_mem_entry_init that is expecting a normal pointer and Sparse is generating a warnings about this. However, rproc_mem_entry_init won't dereference the pointer and can handle any pointer type so the iomem attribute is cast away when setting up the mem entry and the io_mem flag is set to indicate a iomem pointer. To ensure that the mapping is correctly managed, the mapping and unmapping is now handled with the callback functions for rproc_mem_entry_init instead of holding onto the mapping forever. Change-Id: I511a9a16f110a23490141dd3db943244e0f978e2 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-06Ensure rpmsg channel name is null-terminated23.11-rc1Mikael Olsson
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>
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-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-06Fix type validation in the network create UAPIMikael Olsson
Currently, the network create UAPI will assume that any network type that isn't a buffer is an index. This means that the Linux kernel NPU driver will accept any network type value and the user won't get any feedback that they have specified an incorrect type. To resolve this, the Linux kernel NPU driver will now return -EINVAL if an unknown network type is given and a test has been added to validate this behavior. Change-Id: Ib7d9f5d5451897787981aae61a4e0a6650a73e05 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-03Add UAPI NPU driver version testMikael Olsson
A test has been added to verify that the UAPI to get the Linux kernel NPU driver version returns the expected value. Change-Id: Ib401c13100b52d6fedd41831fe9e4d2ace1c4a2c Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-03Remove out of date UAPI protocol version testMikael Olsson
The UAPI used in the protocol version test to request the Linux kernel NPU driver to get the protocol version, no longer exists so the test has been removed. Change-Id: I9b60e3a733bc59a7180d40dbf908ca093452db61 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-11-01Add Sparse checking to kernel module buildsMikael Olsson
Sparse is a semantic checker for C that can help find potential issues in the kernel module code. To make use of the tool, the CMake files for the kernel modules have been updated to enable the tool to run on all the kernel module source files before they are built. Change-Id: I114920448763b69eb0bdfb9ab6ec51ea8b940881 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-10-10Replace enum with fixed-width int in UAPI structsLedion Daja
In order to avoid struct layout misalignment issues between user and kernel space, raising from size of enum members being implementation- defined, the enum members of structs in the UAPI header file have now been replaced with fixed-width integers. Change-Id: I44a41c6d6669d116ca239da72676dd0539bf88b9 Signed-off-by: Ledion Daja <ledion.daja@arm.com>
2023-10-10Fix typos in UAPI type name commentsLedion Daja
Change-Id: I6405c2d5e614239af58e6f1e741e03ea8a19ba35 Signed-off-by: Ledion Daja <ledion.daja@arm.com>
2023-10-06Add -Werror to kernel module buildsMikael Olsson
To ensure that no compilation warnings goes unnoticed, the kernel modules are now built with the -Werror flag so all warnings are treated as errors. Change-Id: Id688052bd297e366ab7ca07c508ca697ca03431e Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-10-06Fix C90 declaration order warning in remoteprocMikael Olsson
A "declaration-after-statement" warning is generated when building the remoteproc driver because C90 doesn't allow variables to be declared after a statement in a scope. To resolve this, the order of the variables at the start of the problematic scope have been reordered to comply with C90. Change-Id: Id7fec564858168fd71cd10af9c99340691484b89 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-09-25Fix DMA configuration in NPU Linux kernel driverMikael Olsson
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>
2023-09-25Add resource table entry for address translationMikael Olsson
To avoid having to use a hardcoded memory map to translate between the Linux physical addresses to device addresses in the firmware, a new entry type has been added to the resource table that allows the NPU remoteproc driver to provide the memory map to the firmware. With this change, the device tree layout has been changed to wrap the ethosu-rproc node with an ethosu parent node that represents the NPU subsystem. This makes it possible to use the APIs provided by the Linux kernel to perform address translation etc. The "ethosu,dma-ranges" property has been removed from ethosu-proc because the ethosu parent node provides information for how to translate between the Linux Kernel physical addresses and device addresses with a "dma-ranges" property. Change-Id: I48719ee808a5e9391c5a3e967042d26dd92d5026 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-09-15Add support for new Juno FPGA reset controllerMikael Olsson
Support for a new reset controller that identifies itself with ID 0x20113 has been added in the Juno FPGA reset driver. The driver version has been given a minor version bump to indicate the new support. Change-Id: Ife21d8b2c97d68eea3c4780c4124aac136b36c0b Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-09-15Fix code style in Juno FPGA reset driverMikael Olsson
There were some places in the Juno FPGA reset driver that did not follow the Linux kernel code style which have now been fixed. Change-Id: I0316b23b99fde05068ba5e50442a6cb5b5ea8214 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-09-07Reduce mutex scope for NPU device IOCTL callsMikael Olsson
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>
2023-09-07Fix mailbox clean up on inference request failureMikael Olsson
When an inference request fails, the mailbox message registered for the request is not unregistered, causing the mailbox's IDR to be left with an entry for the message with a dangling pointer to the freed inference. The dangling pointer later causes the mailbox clean up to crash when it attempts to call the fail callback for the IDR entry. The clean up for a failed inference request has now been fixed so it unregisters the message from the mailbox. Change-Id: Ida8015c88afee9cad074289be4d65947854c9e6b Signed-off-by: Mikael Olsson <mikael.olsson@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-07Remove copy from user in network info IOCTL callMikael Olsson
The network info IOCTL call doesn't use any information from the user provided struct so there is no need to copy the struct to kernel space. Change-Id: I3f58a80ab9377e4ae39fc29068de6fd6bc3d539c 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-16Add command and error to IOCTL failure exceptionMikael Olsson
When an IOCTL call fails in the driver library, the failure exception only states "IOCTL failed" without any further information. To make it easier to see what IOCTL call failed and why, the exception will now include the command that failed and the reason for the failure. Change-Id: Ife4957d2c0d692b3fcdbdc72538690d50385d365 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-16Add error logs to network info response handlingMikael Olsson
To make it easier to detect why a network info request failed, logs have been added to the network info response error handling. Change-Id: I88d98e08501711912d10068344cef62634ac3889 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-16Add kernel network info description checksMikael Olsson
To ensure that the description string in the network info response is correctly null-terminated and that the string will fit into the UAPI struct. The kernel will now check for the null-termination and verify that the UAPI struct can hold the expected string size. Change-Id: I8097a04c6ee4e80f1ab62a66e7323d2462c2c23a Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2023-08-15Fix uninitialized return value from rpmsg callback23.08-rc223.08Mikael Olsson
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>