aboutsummaryrefslogtreecommitdiff
path: root/kernel/include/rpmsg
diff options
context:
space:
mode:
authorMikael Olsson <mikael.olsson@arm.com>2024-02-07 11:22:26 +0100
committerMikael Olsson <mikael.olsson@arm.com>2024-02-12 13:04:41 +0100
commitd4ad9e55cb8e17a4a42b3a94c64e6bc48529b26e (patch)
tree9084d770574bc2a278ddfa121985ac030f711daa /kernel/include/rpmsg
parent09cdc30b3b3a52176cd02518c07d5f44c1ce8dd1 (diff)
downloadethos-u-linux-driver-stack-d4ad9e55cb8e17a4a42b3a94c64e6bc48529b26e.tar.gz
Restructure kernel driver source tree
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>
Diffstat (limited to 'kernel/include/rpmsg')
-rw-r--r--kernel/include/rpmsg/ethosu_rpmsg.h248
-rw-r--r--kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h71
-rw-r--r--kernel/include/rpmsg/ethosu_rpmsg_capabilities.h63
-rw-r--r--kernel/include/rpmsg/ethosu_rpmsg_inference.h124
-rw-r--r--kernel/include/rpmsg/ethosu_rpmsg_mailbox.h194
-rw-r--r--kernel/include/rpmsg/ethosu_rpmsg_network.h84
-rw-r--r--kernel/include/rpmsg/ethosu_rpmsg_network_info.h72
-rw-r--r--kernel/include/rpmsg/ethosu_rpmsg_version.h59
8 files changed, 915 insertions, 0 deletions
diff --git a/kernel/include/rpmsg/ethosu_rpmsg.h b/kernel/include/rpmsg/ethosu_rpmsg.h
new file mode 100644
index 0000000..c1923c2
--- /dev/null
+++ b/kernel/include/rpmsg/ethosu_rpmsg.h
@@ -0,0 +1,248 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2020-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#ifndef ETHOSU_CORE_RPMSG_H
+#define ETHOSU_CORE_RPMSG_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <stdint.h>
+#endif
+
+#ifdef __cplusplus
+namespace EthosU {
+#endif
+
+/** Maximum number of IFM/OFM buffers per inference */
+#define ETHOSU_CORE_BUFFER_MAX 16
+
+/** Maximum number of PMU counters to be returned for inference */
+#define ETHOSU_CORE_PMU_MAX 8
+
+#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_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_CAPABILITIES_REQ,
+ ETHOSU_CORE_MSG_CAPABILITIES_RSP,
+ ETHOSU_CORE_MSG_NETWORK_INFO_REQ,
+ ETHOSU_CORE_MSG_NETWORK_INFO_RSP,
+ ETHOSU_CORE_MSG_CANCEL_INFERENCE_REQ,
+ ETHOSU_CORE_MSG_CANCEL_INFERENCE_RSP,
+ ETHOSU_CORE_MSG_MAX
+};
+
+/**
+ * struct ethosu_core_msg_header - Message header
+ */
+struct ethosu_core_msg_header {
+ uint32_t magic;
+ uint32_t type;
+ uint64_t msg_id;
+};
+
+/**
+ * enum ethosu_core_status - Status
+ */
+enum ethosu_core_status {
+ ETHOSU_CORE_STATUS_OK,
+ ETHOSU_CORE_STATUS_ERROR,
+ ETHOSU_CORE_STATUS_RUNNING,
+ ETHOSU_CORE_STATUS_REJECTED,
+ ETHOSU_CORE_STATUS_ABORTED,
+ ETHOSU_CORE_STATUS_ABORTING,
+};
+
+/**
+ * struct ethosu_core_buffer - Buffer descriptor
+ *
+ * Pointer and size to a buffer within the Ethos-U address space.
+ */
+struct ethosu_core_buffer {
+ uint32_t ptr;
+ uint32_t size;
+};
+
+/**
+ * enum ethosu_core_network_type - Network buffer type
+ */
+enum ethosu_core_network_type {
+ ETHOSU_CORE_NETWORK_BUFFER = 1,
+ ETHOSU_CORE_NETWORK_INDEX
+};
+
+/**
+ * struct ethosu_core_network_buffer - Network buffer
+ */
+struct ethosu_core_network_buffer {
+ uint32_t type;
+ union {
+ struct ethosu_core_buffer buffer;
+ uint32_t index;
+ };
+};
+
+/**
+ * struct ethosu_core_msg_inference_req - Inference request
+ */
+struct ethosu_core_msg_inference_req {
+ uint32_t ifm_count;
+ struct ethosu_core_buffer ifm[ETHOSU_CORE_BUFFER_MAX];
+ uint32_t ofm_count;
+ struct ethosu_core_buffer ofm[ETHOSU_CORE_BUFFER_MAX];
+ struct ethosu_core_network_buffer network;
+ uint8_t pmu_event_config[ETHOSU_CORE_PMU_MAX];
+ uint32_t pmu_cycle_counter_enable;
+};
+
+/**
+ * struct ethosu_core_msg_inference_rsp - Inference response
+ */
+struct ethosu_core_msg_inference_rsp {
+ uint32_t ofm_count;
+ uint32_t ofm_size[ETHOSU_CORE_BUFFER_MAX];
+ uint32_t status;
+ uint8_t pmu_event_config[ETHOSU_CORE_PMU_MAX];
+ uint64_t pmu_event_count[ETHOSU_CORE_PMU_MAX];
+ uint32_t pmu_cycle_counter_enable;
+ uint64_t pmu_cycle_counter_count;
+};
+
+/**
+ * struct ethosu_core_msg_network_info_req - Network information request
+ */
+struct ethosu_core_msg_network_info_req {
+ struct ethosu_core_network_buffer network;
+};
+
+/**
+ * struct ethosu_core_msg_network_info_rsp - Network information response
+ */
+struct ethosu_core_msg_network_info_rsp {
+ char desc[32];
+ uint32_t ifm_count;
+ uint32_t ifm_size[ETHOSU_CORE_BUFFER_MAX];
+ uint32_t ofm_count;
+ uint32_t ofm_size[ETHOSU_CORE_BUFFER_MAX];
+ uint32_t status;
+};
+
+/**
+ * struct ethosu_core_msg_version_rsp - Message protocol version
+ */
+struct ethosu_core_msg_version_rsp {
+ uint8_t major;
+ uint8_t minor;
+ uint8_t patch;
+ uint8_t _reserved;
+};
+
+/**
+ * struct ethosu_core_msg_capabilities_rsp - Message capabilities response
+ */
+struct ethosu_core_msg_capabilities_rsp {
+ uint32_t version_status;
+ uint32_t version_minor;
+ uint32_t version_major;
+ uint32_t product_major;
+ uint32_t arch_patch_rev;
+ uint32_t arch_minor_rev;
+ uint32_t arch_major_rev;
+ uint32_t driver_patch_rev;
+ uint32_t driver_minor_rev;
+ uint32_t driver_major_rev;
+ uint32_t macs_per_cc;
+ uint32_t cmd_stream_version;
+ uint32_t custom_dma;
+};
+
+/**
+ * struct ethosu_core_msg_cancel_inference_req - Message cancel inference
+ * request
+ */
+struct ethosu_core_msg_cancel_inference_req {
+ uint64_t inference_handle;
+};
+
+/**
+ * struct ethosu_core_msg_cancel_inference_rsp - Message cancel inference
+ * response
+ */
+struct ethosu_core_msg_cancel_inference_rsp {
+ uint32_t status;
+};
+
+/**
+ * enum ethosu_core_err_type - Error types
+ */
+enum ethosu_core_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];
+};
+
+/**
+ * struct ethosu_core_rpmsg - Rpmsg message
+ */
+struct ethosu_core_rpmsg {
+ struct ethosu_core_msg_header header;
+ union {
+ struct ethosu_core_msg_inference_req inf_req;
+ struct ethosu_core_msg_inference_rsp inf_rsp;
+ struct ethosu_core_msg_network_info_req net_info_req;
+ struct ethosu_core_msg_network_info_rsp net_info_rsp;
+ struct ethosu_core_msg_capabilities_rsp cap_rsp;
+ struct ethosu_core_msg_cancel_inference_req cancel_req;
+ struct ethosu_core_msg_cancel_inference_rsp cancel_rsp;
+ struct ethosu_core_msg_version_rsp version_rsp;
+ struct ethosu_core_msg_err error;
+ };
+};
+
+#ifdef __cplusplus
+} /*namespace EthosU */
+#endif
+
+#endif /* ETHOSU_CORE_RPMSG_H */
diff --git a/kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h b/kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h
new file mode 100644
index 0000000..1d6cc03
--- /dev/null
+++ b/kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h
@@ -0,0 +1,71 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#ifndef ETHOSU_CANCEL_INFERENCE_H
+#define ETHOSU_CANCEL_INFERENCE_H
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+
+#include <rpmsg/ethosu_rpmsg_mailbox.h>
+#include <uapi/ethosu.h>
+
+#include <linux/types.h>
+#include <linux/completion.h>
+
+/****************************************************************************
+ * Types
+ ****************************************************************************/
+
+struct ethosu_core_msg_cancel_inference_rsp;
+struct ethosu_inference;
+struct ethosu_uapi_cancel_inference_status;
+
+struct ethosu_cancel_inference {
+ struct device *dev;
+ struct ethosu_inference *inf;
+ struct ethosu_uapi_cancel_inference_status *uapi;
+ struct completion done;
+ struct ethosu_mailbox_msg msg;
+ int errno;
+};
+
+/****************************************************************************
+ * Functions
+ ****************************************************************************/
+
+/**
+ * ethosu_cancel_inference_request() - Send cancel inference request
+ *
+ * Return: 0 on success, error code otherwise.
+ */
+int ethosu_cancel_inference_request(struct device *dev,
+ struct ethosu_mailbox *mailbox,
+ struct ethosu_inference *inf,
+ struct ethosu_uapi_cancel_inference_status *uapi);
+
+/**
+ * ethosu_cancel_inference_rsp() - Handle cancel inference response
+ */
+void ethosu_cancel_inference_rsp(struct ethosu_mailbox *mailbox,
+ int msg_id,
+ struct ethosu_core_msg_cancel_inference_rsp *rsp);
+
+#endif /* ETHOSU_CANCEL_INFERENCE_H */
diff --git a/kernel/include/rpmsg/ethosu_rpmsg_capabilities.h b/kernel/include/rpmsg/ethosu_rpmsg_capabilities.h
new file mode 100644
index 0000000..aefdbaa
--- /dev/null
+++ b/kernel/include/rpmsg/ethosu_rpmsg_capabilities.h
@@ -0,0 +1,63 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#ifndef ETHOSU_CAPABILITIES_H
+#define ETHOSU_CAPABILITIES_H
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+
+#include <rpmsg/ethosu_rpmsg_mailbox.h>
+
+#include <linux/types.h>
+#include <linux/completion.h>
+
+/****************************************************************************
+ * Types
+ ****************************************************************************/
+
+struct ethosu_core_msg_capabilities_rsp;
+struct ethosu_device;
+struct ethosu_uapi_device_capabilities;
+
+/**
+ * struct ethosu_capabilities - Capabilities internal struct
+ */
+struct ethosu_capabilities {
+ struct device *dev;
+ struct completion done;
+ struct ethosu_uapi_device_capabilities *uapi;
+ struct ethosu_mailbox_msg msg;
+ int errno;
+};
+
+/****************************************************************************
+ * Functions
+ ****************************************************************************/
+
+int ethosu_capabilities_request(struct device *dev,
+ struct ethosu_mailbox *mailbox,
+ struct ethosu_uapi_device_capabilities *uapi);
+
+void ethosu_capability_rsp(struct ethosu_mailbox *mailbox,
+ int msg_id,
+ struct ethosu_core_msg_capabilities_rsp *rsp);
+
+#endif
diff --git a/kernel/include/rpmsg/ethosu_rpmsg_inference.h b/kernel/include/rpmsg/ethosu_rpmsg_inference.h
new file mode 100644
index 0000000..8bdfb8a
--- /dev/null
+++ b/kernel/include/rpmsg/ethosu_rpmsg_inference.h
@@ -0,0 +1,124 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2020, 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#ifndef ETHOSU_INFERENCE_H
+#define ETHOSU_INFERENCE_H
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+
+#include <rpmsg/ethosu_rpmsg_mailbox.h>
+#include <uapi/ethosu.h>
+
+#include <linux/kref.h>
+#include <linux/types.h>
+
+/****************************************************************************
+ * Types
+ ****************************************************************************/
+
+struct ethosu_buffer;
+struct ethosu_core_msg_inference_rsp;
+struct ethosu_network;
+struct ethosu_uapi_inference_create;
+struct file;
+
+/**
+ * struct ethosu_inference - Inference struct
+ * @edev: Arm Ethos-U device
+ * @file: File handle
+ * @kref: Reference counter
+ * @waitq: Wait queue
+ * @done: Wait condition is done
+ * @ifm: Pointer to IFM buffer
+ * @ofm: Pointer to OFM buffer
+ * @net: Pointer to network
+ * @status: Inference status
+ * @pmu_event_config: PMU event configuration
+ * @pmu_event_count: PMU event count after inference
+ * @pmu_cycle_counter_enable: PMU cycle counter config
+ * @pmu_cycle_counter_count: PMU cycle counter count after inference
+ * @msg: Mailbox message
+ */
+struct ethosu_inference {
+ struct device *dev;
+ struct ethosu_mailbox *mailbox;
+ struct file *file;
+ struct kref kref;
+ wait_queue_head_t waitq;
+ bool done;
+ uint32_t ifm_count;
+ struct ethosu_buffer *ifm[ETHOSU_FD_MAX];
+ uint32_t ofm_count;
+ struct ethosu_buffer *ofm[ETHOSU_FD_MAX];
+ struct ethosu_network *net;
+ enum ethosu_uapi_status status;
+ uint8_t pmu_event_config[ETHOSU_PMU_EVENT_MAX];
+ uint64_t pmu_event_count[ETHOSU_PMU_EVENT_MAX];
+ uint32_t pmu_cycle_counter_enable;
+ uint64_t pmu_cycle_counter_count;
+ struct ethosu_mailbox_msg msg;
+};
+
+/****************************************************************************
+ * Functions
+ ****************************************************************************/
+
+/**
+ * ethosu_inference_create() - Create inference
+ *
+ * This function must be called in the context of a user space process.
+ *
+ * Return: fd on success, else error code.
+ */
+int ethosu_inference_create(struct device *dev,
+ struct ethosu_mailbox *mailbox,
+ struct ethosu_network *net,
+ struct ethosu_uapi_inference_create *uapi);
+
+/**
+ * ethosu_inference_get_from_fd() - Get inference handle from fd
+ *
+ * This function must be called from a user space context.
+ *
+ * Return: Pointer on success, else ERR_PTR.
+ */
+struct ethosu_inference *ethosu_inference_get_from_fd(int fd);
+
+/**
+ * ethosu_inference_get() - Get inference
+ */
+void ethosu_inference_get(struct ethosu_inference *inf);
+
+/**
+ * ethosu_inference_put() - Put inference
+ *
+ * Return: 1 if object was removed, else 0.
+ */
+int ethosu_inference_put(struct ethosu_inference *inf);
+
+/**
+ * ethosu_inference_rsp() - Handle inference response
+ */
+void ethosu_inference_rsp(struct ethosu_mailbox *mailbox,
+ int msg_id,
+ struct ethosu_core_msg_inference_rsp *rsp);
+
+#endif /* ETHOSU_INFERENCE_H */
diff --git a/kernel/include/rpmsg/ethosu_rpmsg_mailbox.h b/kernel/include/rpmsg/ethosu_rpmsg_mailbox.h
new file mode 100644
index 0000000..66eb172
--- /dev/null
+++ b/kernel/include/rpmsg/ethosu_rpmsg_mailbox.h
@@ -0,0 +1,194 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2020-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#ifndef ETHOSU_MAILBOX_H
+#define ETHOSU_MAILBOX_H
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+#include <rpmsg/ethosu_rpmsg.h>
+
+#include <linux/types.h>
+#include <linux/mailbox_client.h>
+#include <linux/wait.h>
+#include <linux/idr.h>
+
+/****************************************************************************
+ * Types
+ ****************************************************************************/
+
+struct device;
+struct ethosu_buffer;
+struct ethosu_core_msg;
+struct ethosu_core_queue;
+struct ethosu_device;
+struct ethosu_network;
+struct resource;
+
+typedef void (*ethosu_mailbox_cb)(void *user_arg);
+
+struct ethosu_mailbox {
+ struct device *dev;
+ struct rpmsg_endpoint *ept;
+ struct idr msg_idr;
+ atomic_t done;
+ wait_queue_head_t send_queue;
+};
+
+/**
+ * struct ethosu_mailbox_msg - Mailbox message
+ * @id: Message id
+ * @type: Message request type
+ * @fail: Message failure callback
+ *
+ * The fail callback will be called with the device mutex locked
+ */
+struct ethosu_mailbox_msg {
+ int id;
+ uint32_t type;
+ void (*fail)(struct ethosu_mailbox_msg *msg);
+};
+
+/****************************************************************************
+ * Functions
+ ****************************************************************************/
+
+/**
+ * ethosu_mailbox_init() - Initialize mailbox
+ *
+ * Return: 0 on success, else error code.
+ */
+int ethosu_mailbox_init(struct ethosu_mailbox *mbox,
+ struct device *dev,
+ struct rpmsg_endpoint *ept);
+
+/**
+ * ethosu_mailbox_deinit() - Deinitialize mailbox
+ */
+void ethosu_mailbox_deinit(struct ethosu_mailbox *mbox);
+
+/**
+ * ethosu_mailbox_register() - Register the ethosu_mailbox_msg in ethosu_mailbox
+ *
+ * Context: Must be called with the device mutex locked
+ *
+ * Return: 0 on success, else error code.
+ */
+int ethosu_mailbox_register(struct ethosu_mailbox *mbox,
+ struct ethosu_mailbox_msg *msg);
+
+/**
+ * ethosu_mailbox_free_id() - Free the id of the ethosu_mailbox_msg
+ *
+ * Context: Must be called with the device mutex locked
+ */
+void ethosu_mailbox_deregister(struct ethosu_mailbox *mbox,
+ struct ethosu_mailbox_msg *msg);
+
+/**
+ * ethosu_mailbox_find() - Find mailbox message
+ *
+ * Context: Must be called with the device mutex locked
+ *
+ * Return: a valid pointer on success, otherwise an error ptr.
+ */
+struct ethosu_mailbox_msg *ethosu_mailbox_find(struct ethosu_mailbox *mbox,
+ int msg_id,
+ uint32_t msg_type);
+
+/**
+ * ethosu_mailbox_fail() - Fail mailbox messages
+ *
+ * Call fail() callback on all messages in pending list.
+ *
+ * Context: Must be called with the device mutex locked
+ */
+void ethosu_mailbox_fail(struct ethosu_mailbox *mbox);
+
+/**
+ * ethosu_mailbox_reset() - Reset to end of queue
+ */
+void ethosu_mailbox_reset(struct ethosu_mailbox *mbox);
+
+/**
+ * ethosu_mailbox_ping() - Send ping message
+ *
+ * Return: 0 on success, else error code.
+ */
+int ethosu_mailbox_ping(struct ethosu_mailbox *mbox);
+
+/**
+ * ethosu_mailbox_pong() - Send pong response
+ *
+ * Return: 0 on success, else error code.
+ */
+int ethosu_mailbox_pong(struct ethosu_mailbox *mbox);
+
+/**
+ * ethosu_mailbox_version_request() - Send protocol version request
+ *
+ * Return: 0 on succes, else error code
+ */
+int ethosu_mailbox_version_request(struct ethosu_mailbox *mbox,
+ struct ethosu_mailbox_msg *msg);
+
+/**
+ * ethosu_mailbox_capabilities_request() - Send capabilities request
+ *
+ * Return: 0 on success, else error code.
+ */
+int ethosu_mailbox_capabilities_request(struct ethosu_mailbox *mbox,
+ struct ethosu_mailbox_msg *msg);
+
+/**
+ * ethosu_mailbox_inference() - Send inference
+ *
+ * Return: 0 on success, else error code.
+ */
+int ethosu_mailbox_inference(struct ethosu_mailbox *mbox,
+ struct ethosu_mailbox_msg *msg,
+ uint32_t ifm_count,
+ struct ethosu_buffer **ifm,
+ uint32_t ofm_count,
+ struct ethosu_buffer **ofm,
+ struct ethosu_network *network,
+ uint8_t *pmu_event_config,
+ uint8_t pmu_event_config_count,
+ uint8_t pmu_cycle_counter_enable);
+
+/**
+ * ethosu_mailbox_network_info_request() - Send network info request
+ *
+ * Return: 0 on success, else error code.
+ */
+int ethosu_mailbox_network_info_request(struct ethosu_mailbox *mbox,
+ struct ethosu_mailbox_msg *msg,
+ struct ethosu_network *network);
+
+/**
+ * ethosu_mailbox_cancel_inference() - Send inference cancellation
+ *
+ * Return: 0 on success, else error code.
+ */
+int ethosu_mailbox_cancel_inference(struct ethosu_mailbox *mbox,
+ struct ethosu_mailbox_msg *msg,
+ int inference_handle);
+
+#endif /* ETHOSU_MAILBOX_H */
diff --git a/kernel/include/rpmsg/ethosu_rpmsg_network.h b/kernel/include/rpmsg/ethosu_rpmsg_network.h
new file mode 100644
index 0000000..269018a
--- /dev/null
+++ b/kernel/include/rpmsg/ethosu_rpmsg_network.h
@@ -0,0 +1,84 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2020, 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#ifndef ETHOSU_NETWORK_H
+#define ETHOSU_NETWORK_H
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+
+#include <linux/kref.h>
+#include <linux/types.h>
+
+/****************************************************************************
+ * Types
+ ****************************************************************************/
+
+struct ethosu_buffer;
+struct ethosu_uapi_network_create;
+struct device;
+struct file;
+
+struct ethosu_network {
+ struct device *dev;
+ struct ethosu_mailbox *mailbox;
+ struct file *file;
+ struct kref kref;
+ struct ethosu_dma_mem *dma_mem;
+ uint32_t index;
+};
+
+/****************************************************************************
+ * Functions
+ ****************************************************************************/
+
+/**
+ * ethosu_network_create() - Create network
+ *
+ * This function must be called in the context of a user space process.
+ *
+ * Return: fd on success, else error code.
+ */
+int ethosu_network_create(struct device *dev,
+ struct ethosu_mailbox *mailbox,
+ struct ethosu_uapi_network_create *uapi);
+
+/**
+ * ethosu_network_get_from_fd() - Get network handle from fd
+ *
+ * This function must be called from a user space context.
+ *
+ * Return: Pointer on success, else ERR_PTR.
+ */
+struct ethosu_network *ethosu_network_get_from_fd(int fd);
+
+/**
+ * ethosu_network_get() - Get network
+ */
+void ethosu_network_get(struct ethosu_network *net);
+
+/**
+ * ethosu_network_put() - Put network
+ *
+ * Return: 1 if object was removed, else 0.
+ */
+int ethosu_network_put(struct ethosu_network *net);
+
+#endif /* ETHOSU_NETWORK_H */
diff --git a/kernel/include/rpmsg/ethosu_rpmsg_network_info.h b/kernel/include/rpmsg/ethosu_rpmsg_network_info.h
new file mode 100644
index 0000000..aaa3733
--- /dev/null
+++ b/kernel/include/rpmsg/ethosu_rpmsg_network_info.h
@@ -0,0 +1,72 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#ifndef ETHOSU_NETWORK_INFO_H
+#define ETHOSU_NETWORK_INFO_H
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+
+#include <rpmsg/ethosu_rpmsg_mailbox.h>
+
+#include <linux/types.h>
+#include <linux/completion.h>
+
+/****************************************************************************
+ * Types
+ ****************************************************************************/
+
+struct ethosu_core_msg_network_info_rsp;
+struct ethosu_network;
+struct ethosu_uapi_network_info;
+
+struct ethosu_network_info {
+ struct device *dev;
+ struct ethosu_network *net;
+ struct ethosu_uapi_network_info *uapi;
+ struct completion done;
+ int errno;
+ struct ethosu_mailbox_msg msg;
+};
+
+/****************************************************************************
+ * Functions
+ ****************************************************************************/
+
+/**
+ * ethosu_network_info_request() - Send a network info request
+ *
+ * This function must be called in the context of a user space process.
+ *
+ * Return: 0 on success, .
+ */
+int ethosu_network_info_request(struct device *dev,
+ struct ethosu_mailbox *mailbox,
+ struct ethosu_network *net,
+ struct ethosu_uapi_network_info *uapi);
+
+/**
+ * ethosu_network_info_rsp() - Handle network info response.
+ */
+void ethosu_network_info_rsp(struct ethosu_mailbox *mailbox,
+ int msg_id,
+ struct ethosu_core_msg_network_info_rsp *rsp);
+
+#endif /* ETHOSU_NETWORK_INFO_H */
diff --git a/kernel/include/rpmsg/ethosu_rpmsg_version.h b/kernel/include/rpmsg/ethosu_rpmsg_version.h
new file mode 100644
index 0000000..755a3d5
--- /dev/null
+++ b/kernel/include/rpmsg/ethosu_rpmsg_version.h
@@ -0,0 +1,59 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2023-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#ifndef ETHOSU_VERSION_H
+#define ETHOSU_VERSION_H
+
+/****************************************************************************
+ * Includes
+ ****************************************************************************/
+
+#include <rpmsg/ethosu_rpmsg_mailbox.h>
+
+#include <linux/types.h>
+#include <linux/completion.h>
+
+/****************************************************************************
+ * Types
+ ****************************************************************************/
+
+struct ethosu_core_msg_version_rsp;
+
+/**
+ * struct ethosu_version - Protocol version internal struct
+ */
+struct ethosu_version {
+ struct device *dev;
+ struct completion done;
+ struct ethosu_mailbox_msg msg;
+ int errno;
+};
+
+/****************************************************************************
+ * Functions
+ ****************************************************************************/
+
+void ethosu_version_rsp(struct ethosu_mailbox *mailbox,
+ int msg_id,
+ struct ethosu_core_msg_version_rsp *rsp);
+
+int ethosu_version_check_request(struct device *dev,
+ struct ethosu_mailbox *mailbox);
+
+#endif /* ETHOSU_VERSION_H */