aboutsummaryrefslogtreecommitdiff
path: root/kernel/ethosu_device.c
diff options
context:
space:
mode:
authorDavide Grohmann <davide.grohmann@arm.com>2022-03-23 12:48:45 +0100
committerDavide Grohmann <davide.grohmann@arm.com>2022-05-05 11:13:04 +0200
commit7e8f508765632c42cc44fd8ad704c9d90943ab32 (patch)
tree42dcfb929accf5470d6aa61810da20356c39eb75 /kernel/ethosu_device.c
parent82d225899bd3d4fd07d70cac80f50c1b288dc4a3 (diff)
downloadethos-u-linux-driver-stack-7e8f508765632c42cc44fd8ad704c9d90943ab32.tar.gz
Add support for inference cancellation
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
Diffstat (limited to 'kernel/ethosu_device.c')
-rw-r--r--kernel/ethosu_device.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/ethosu_device.c b/kernel/ethosu_device.c
index 316df6f..f66c2ac 100644
--- a/kernel/ethosu_device.c
+++ b/kernel/ethosu_device.c
@@ -27,6 +27,7 @@
#include "ethosu_buffer.h"
#include "ethosu_core_interface.h"
#include "ethosu_inference.h"
+#include "ethosu_cancel_inference.h"
#include "ethosu_network.h"
#include "ethosu_network_info.h"
#include "uapi/ethosu.h"
@@ -209,6 +210,7 @@ static int ethosu_handle_msg(struct ethosu_device *edev)
struct ethosu_core_msg_version version;
struct ethosu_core_msg_capabilities_rsp capabilities;
struct ethosu_core_network_info_rsp network_info;
+ struct ethosu_core_cancel_inference_rsp cancellation;
} data;
/* Read message */
@@ -254,6 +256,20 @@ static int ethosu_handle_msg(struct ethosu_device *edev)
ethosu_inference_rsp(edev, &data.inf);
break;
+ case ETHOSU_CORE_MSG_CANCEL_INFERENCE_RSP:
+ if (header.length != sizeof(data.cancellation)) {
+ dev_warn(edev->dev,
+ "Msg: Cancel Inference response of incorrect size. size=%u, expected=%zu\n", header.length,
+ sizeof(data.cancellation));
+ ret = -EBADMSG;
+ break;
+ }
+
+ dev_info(edev->dev,
+ "Msg: Cancel Inference response. user_arg=0x%llx, status=%u\n",
+ data.cancellation.user_arg, data.cancellation.status);
+ ethosu_cancel_inference_rsp(edev, &data.cancellation);
+ break;
case ETHOSU_CORE_MSG_VERSION_RSP:
if (header.length != sizeof(data.version)) {
dev_warn(edev->dev,