The msg id will be removed unpredictable when one thread call
ethosu_rpmsg_register and another thread call ethosu_rpmsg_deregister
at the same time. So add write_lock in ethosu_rpmsg_register and
ethosu_rpmsg_deregister, add read_lock in ethosu_rpmsg_find.
Signed-off-by: Feng Guo <feng.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
This patch updates the interface for printing hex dump to avoid too much
journalctl logs.
Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Fix coverity Issue CID 24233199-24233208,24233210,22841322
1. The index will out-of-bounds when rsp->ifm_count or rsp->ofm_count
is larger than ETHOSU_CORE_BUFFER_MAX, so add checking for these two
counters.
2. Add return value checking for wait_for_completion_interruptible.
Signed-off-by: Feng Guo <feng.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Fix implicit conversion from enumeration type 'enum ethosu_core_status'
to different enumeration type 'enum ethosu_uapi_status'.
Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
The wrong structure name causes memory overflow issue, this patch fixes
it.
Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Add core message that allows user space to fetch information about
network models built into the firmware.
Support referencing a network model by index that has been built into
the firmwae binary.
Signed-off-by: Kristofer Jonsson <kristofer.jonsson@arm.com>
Signed-off-by: Alison Wang <alison.wang@nxp.com>
ETHOSU_IOCTL_CAPABILITIES_REQ is a read ioctl with a parameter.
Signed-off-by: Per Åstrand <per.astrand@arm.com>
Signed-off-by: Alison Wang <alison.wang@nxp.com>
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 since memory is freed in only one
place.
Finally, extract the capabilities code in its own files.
Signed-off-by: Davide Grohmann <davide.grohmann@arm.com>
Signed-off-by: Kristofer Jonsson <kristofer.jonsson@arm.com>
Signed-off-by: Alison Wang <alison.wang@nxp.com>
Avoid undefined behaviour from calling dma_alloc_coherent with
requested size=0 as reported by UBSAN.
Signed-off-by: Per Åstrand <per.astrand@arm.com>
Signed-off-by: Alison Wang <alison.wang@nxp.com>
M33 firmware will be loaded when ethosu device opens, and driver
shouldn't send msg to M33 before M33 boot up.
Signed-off-by: Feng Guo <feng.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Rpmsg is used for the communication mechanism between Cortex-A and
Cortex-M for ethos-u driver.
Signed-off-by: Lei Xu <lei.xu@nxp.com>
Signed-off-by: Alison Wang <alison.wang@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
This Linux drvier is to provide an example of how a rich operating
system like Linux can dispatch inferences to an Arm Cortex-M subsystem,
consisting of an Arm Cortex-M and an Arm Ethos-U NPU.
The code is from link: https://git.mlplatform.org/ml/ethos-u/ethos-u-linux-driver-stack.git. Tag: 22.02.
Signed-off-by: Kristofer Jonsson <kristofer.jonsson@arm.com>
Signed-off-by: Per Astrand <per.astrand@arm.com>
Signed-off-by: Jonny Svärd <jonny.svaerd@arm.com>
Signed-off-by: Lior Dekel <Lior.dekel@arm.com>
Signed-off-by: Henrik Hoglind <henrik.hoglind@arm.com>
Signed-off-by: Davide Grohmann <davide.grohmann@arm.com>
Signed-off-by: Alison Wang <alison.wang@nxp.com>