Skip to content
  1. Jan 16, 2024
    • Mikael's avatar
      Add Sparse and build test information to README · 09cdc30b
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      2 tags
      09cdc30b
    • Mikael's avatar
      Fix inference cancellation behavior · 6d5e2d28
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      6d5e2d28
    • Mikael's avatar
      Remove reject inference test · 3918eeab
      Mikael authored
      
      
      Rejecting an inference is not supported so the test for rejecting an
      inference has been removed.
      
      Change-Id: Ia175559bb9945af0446aa8c3990760aa2208538b
      Signed-off-by: Mikael's avatarMikael Olsson <mikael.olsson@arm.com>
      3918eeab
  2. Dec 20, 2023
    • Mikael's avatar
      Change PMU event counter values to use 64-bit · e87446c9
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      e87446c9
  3. Nov 20, 2023
  4. Nov 14, 2023
    • Mikael's avatar
      Make all kernel module Sparse warnings into errors · 47e9bd01
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      23.11-rc2
      47e9bd01
    • Mikael's avatar
      Fix NPU driver inference poll callback return type · b6824310
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      b6824310
    • Mikael's avatar
      Fix device id data ptr using 0 instead of NULL · c4ec925d
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      c4ec925d
    • Mikael's avatar
      Make internal functions static in kernel modules · 404a536f
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      404a536f
    • Mikael's avatar
      Fix iomem pointer usage with rproc_mem_entry_init · 9f176ba0
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      9f176ba0
  5. Nov 06, 2023
    • Mikael's avatar
      Ensure rpmsg channel name is null-terminated · 9fdbf1e0
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      23.11-rc1
      9fdbf1e0
    • Mikael's avatar
      Change create network UAPI to take a user buffer · c081e595
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      c081e595
    • Mikael's avatar
      Split DMA memory and buffer setup in kernel driver · 9c999fdd
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      9c999fdd
    • Mikael's avatar
      Remove buffer capacity, offset and resize in UAPI · 07545150
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      07545150
    • Mikael's avatar
      Fix type validation in the network create UAPI · 45d47991
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      45d47991
  6. Nov 03, 2023
  7. Nov 01, 2023
  8. Oct 10, 2023
  9. Oct 06, 2023
    • Mikael's avatar
      Add -Werror to kernel module builds · 6e0778ab
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      6e0778ab
    • Mikael's avatar
      Fix C90 declaration order warning in remoteproc · f1b23f3b
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      f1b23f3b
  10. Sep 25, 2023
    • Mikael's avatar
      Fix DMA configuration in NPU Linux kernel driver · 53d224ab
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      53d224ab
    • Mikael's avatar
      Add resource table entry for address translation · 9d0ea8bc
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      9d0ea8bc
  11. Sep 15, 2023
  12. Sep 07, 2023
    • Mikael's avatar
      Fix wait for TX buffer blocking receive callback · 6fb238f4
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      6fb238f4
    • Mikael's avatar
      Reduce mutex scope for NPU device IOCTL calls · 18257600
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      18257600
    • Mikael's avatar
      Fix mailbox clean up on inference request failure · 27fe8e06
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      27fe8e06
    • Mikael's avatar
      Initialize UAPI structs copied to user space · ec90223e
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      ec90223e
    • Mikael's avatar
      Remove copy from user in network info IOCTL call · 52c563d3
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      52c563d3
    • Mikael's avatar
      Fix IOCTL calls returning the wrong value · 891156d2
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      891156d2
  13. Aug 16, 2023
  14. Aug 15, 2023
  15. Aug 11, 2023
  16. Aug 09, 2023
    • Mikael's avatar
      Add version to driver library · e9c3f076
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      23.08-rc1
      e9c3f076
    • Mikael's avatar
      Add kernel driver version check in driver library · 308e7f13
      Mikael authored
      
      
      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's avatarMikael Olsson <mikael.olsson@arm.com>
      308e7f13
Loading