aboutsummaryrefslogtreecommitdiff
path: root/kernel/ethosu_mailbox.c
diff options
context:
space:
mode:
authorMikael Olsson <mikael.olsson@arm.com>2023-10-30 11:10:56 +0100
committerMikael Olsson <mikael.olsson@arm.com>2023-11-06 09:36:00 +0100
commitc081e5954cd92165b139488e76bdfef1402acee6 (patch)
tree32bc237c124e21f12287150cba040c87c8e8b7e3 /kernel/ethosu_mailbox.c
parent9c999fdd40c0bf2ae420f6f3bfe013dc6baa73c1 (diff)
downloadethos-u-linux-driver-stack-c081e5954cd92165b139488e76bdfef1402acee6.tar.gz
Change create network UAPI to take a user buffer
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 Olsson <mikael.olsson@arm.com>
Diffstat (limited to 'kernel/ethosu_mailbox.c')
-rw-r--r--kernel/ethosu_mailbox.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/ethosu_mailbox.c b/kernel/ethosu_mailbox.c
index 9b9cd18..005e83e 100644
--- a/kernel/ethosu_mailbox.c
+++ b/kernel/ethosu_mailbox.c
@@ -239,8 +239,7 @@ int ethosu_mailbox_inference(struct ethosu_mailbox *mbox,
struct ethosu_buffer **ifm,
uint32_t ofm_count,
struct ethosu_buffer **ofm,
- struct ethosu_buffer *network,
- uint32_t network_index,
+ struct ethosu_network *network,
uint8_t *pmu_event_config,
uint8_t pmu_event_config_count,
uint8_t pmu_cycle_counter_enable)
@@ -279,13 +278,13 @@ int ethosu_mailbox_inference(struct ethosu_mailbox *mbox,
for (i = 0; i < ETHOSU_CORE_PMU_MAX; i++)
inf_req->pmu_event_config[i] = pmu_event_config[i];
- if (network != NULL) {
+ if (network->dma_mem != NULL) {
inf_req->network.type = ETHOSU_CORE_NETWORK_BUFFER;
ethosu_core_buffer_dma_mem_set(network->dma_mem,
&inf_req->network.buffer);
} else {
inf_req->network.type = ETHOSU_CORE_NETWORK_INDEX;
- inf_req->network.index = network_index;
+ inf_req->network.index = network->index;
}
return ethosu_send_locked(mbox, &rpmsg,
@@ -294,8 +293,7 @@ int ethosu_mailbox_inference(struct ethosu_mailbox *mbox,
int ethosu_mailbox_network_info_request(struct ethosu_mailbox *mbox,
struct ethosu_mailbox_msg *msg,
- struct ethosu_buffer *network,
- uint32_t network_index)
+ struct ethosu_network *network)
{
struct ethosu_core_rpmsg rpmsg = {
.header = {
@@ -308,13 +306,13 @@ int ethosu_mailbox_network_info_request(struct ethosu_mailbox *mbox,
msg->type = rpmsg.header.type;
- if (network != NULL) {
+ if (network->dma_mem != NULL) {
info_req->network.type = ETHOSU_CORE_NETWORK_BUFFER;
ethosu_core_buffer_dma_mem_set(network->dma_mem,
&info_req->network.buffer);
} else {
info_req->network.type = ETHOSU_CORE_NETWORK_INDEX;
- info_req->network.index = network_index;
+ info_req->network.index = network->index;
}
return ethosu_send_locked(mbox, &rpmsg,