aboutsummaryrefslogtreecommitdiff
path: root/kernel/ethosu_core_interface.h
diff options
context:
space:
mode:
authorJonny Svärd <jonny.svaerd@arm.com>2021-01-14 19:53:17 +0100
committerJonny Svärd <jonny.svaerd@arm.com>2021-01-26 15:42:49 +0100
commit7c24c770be3b3e25822cf7c45619ee20ed61c172 (patch)
tree1d04dd3708100e444e3f8c1e19e61899d75a61f7 /kernel/ethosu_core_interface.h
parent9d8d92cc3ce5fd5ced815a7334b8d500eec42a27 (diff)
downloadethos-u-linux-driver-stack-7c24c770be3b3e25822cf7c45619ee20ed61c172.tar.gz
Improve mailbox message handling
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
Diffstat (limited to 'kernel/ethosu_core_interface.h')
-rw-r--r--kernel/ethosu_core_interface.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/kernel/ethosu_core_interface.h b/kernel/ethosu_core_interface.h
index 86e10ac..a3a21e0 100644
--- a/kernel/ethosu_core_interface.h
+++ b/kernel/ethosu_core_interface.h
@@ -33,16 +33,24 @@
/** Maximum number of PMU counters to be returned for inference */
#define ETHOSU_CORE_PMU_MAX 4
+#define ETHOSU_CORE_MSG_MAGIC 0x41457631
+#define ETHOSU_CORE_MSG_VERSION_MAJOR 0
+#define ETHOSU_CORE_MSG_VERSION_MINOR 2
+#define ETHOSU_CORE_MSG_VERSION_PATCH 0
+
/**
* enum ethosu_core_msg_type - Message types
*
* Types for the messages sent between the host and the core subsystem.
*/
enum ethosu_core_msg_type {
- ETHOSU_CORE_MSG_PING = 1,
+ ETHOSU_CORE_MSG_ERR = 1,
+ ETHOSU_CORE_MSG_PING,
ETHOSU_CORE_MSG_PONG,
ETHOSU_CORE_MSG_INFERENCE_REQ,
ETHOSU_CORE_MSG_INFERENCE_RSP,
+ ETHOSU_CORE_MSG_VERSION_REQ,
+ ETHOSU_CORE_MSG_VERSION_RSP,
ETHOSU_CORE_MSG_MAX
};
@@ -50,6 +58,7 @@ enum ethosu_core_msg_type {
* struct ethosu_core_msg - Message header
*/
struct ethosu_core_msg {
+ uint32_t magic;
uint32_t type;
uint32_t length;
};
@@ -105,4 +114,34 @@ struct ethosu_core_inference_rsp {
uint64_t pmu_cycle_counter_count;
};
+/**
+ * struct ethosu_core_msg_verson - Message protocol version
+ */
+struct ethosu_core_msg_version {
+ uint8_t major;
+ uint8_t minor;
+ uint8_t patch;
+ uint8_t _reserved;
+};
+
+/**
+ * enum ethosu_core_msg_err_type - Error types
+ */
+enum ethosu_core_msg_err_type {
+ ETHOSU_CORE_MSG_ERR_GENERIC = 0,
+ ETHOSU_CORE_MSG_ERR_UNSUPPORTED_TYPE,
+ ETHOSU_CORE_MSG_ERR_INVALID_PAYLOAD,
+ ETHOSU_CORE_MSG_ERR_INVALID_SIZE,
+ ETHOSU_CORE_MSG_ERR_INVALID_MAGIC,
+ ETHOSU_CORE_MSG_ERR_MAX
+};
+
+/**
+ * struct ethosu_core_msg_err - Error message struct
+ */
+struct ethosu_core_msg_err {
+ uint32_t type; /* optional use of extra error code */
+ char msg[128];
+};
+
#endif