aboutsummaryrefslogtreecommitdiff
path: root/kernel/rpmsg/ethosu_rpmsg_mailbox.c
diff options
context:
space:
mode:
authorMikael Olsson <mikael.olsson@arm.com>2024-02-12 09:56:56 +0100
committerMikael Olsson <mikael.olsson@arm.com>2024-02-12 13:28:26 +0100
commit16be28550f0906e2bfff20b94dd373f59b4a2ccf (patch)
tree72ac8fa23cccacc5db2f4e08e31659eaed60ad51 /kernel/rpmsg/ethosu_rpmsg_mailbox.c
parentd4ad9e55cb8e17a4a42b3a94c64e6bc48529b26e (diff)
downloadethos-u-linux-driver-stack-16be28550f0906e2bfff20b94dd373f59b4a2ccf.tar.gz
Rename macros and types to namespace their usage
Macros and types have been renamed accordingly to namespace them by their usage in the new kernel driver source tree structure. This is done in a separate commit from the restructuring to avoid Git from seeing some of the moved files as new ones because they have been both moved and modified at the same time and thus losing the connection in the history. Change-Id: Icd4d8e8c76779479b5b46a55bf1d4f78a629c281 Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Diffstat (limited to 'kernel/rpmsg/ethosu_rpmsg_mailbox.c')
-rw-r--r--kernel/rpmsg/ethosu_rpmsg_mailbox.c157
1 files changed, 80 insertions, 77 deletions
diff --git a/kernel/rpmsg/ethosu_rpmsg_mailbox.c b/kernel/rpmsg/ethosu_rpmsg_mailbox.c
index 11ac414..e1dc2a9 100644
--- a/kernel/rpmsg/ethosu_rpmsg_mailbox.c
+++ b/kernel/rpmsg/ethosu_rpmsg_mailbox.c
@@ -65,7 +65,7 @@
*
* Return: 0 on success, else error code.
*/
-static int ethosu_send_locked(struct ethosu_mailbox *mbox,
+static int ethosu_send_locked(struct ethosu_rpmsg_mailbox *mbox,
void *data,
size_t length)
{
@@ -124,15 +124,15 @@ static int ethosu_send_locked(struct ethosu_mailbox *mbox,
return ret;
}
-static void ethosu_core_buffer_dma_mem_set(struct ethosu_dma_mem *dma_mem,
- struct ethosu_core_buffer *cbuf)
+static void ethosu_rpmsg_buffer_dma_mem_set(struct ethosu_dma_mem *dma_mem,
+ struct ethosu_rpmsg_buffer *cbuf)
{
cbuf->ptr = (uint32_t)dma_mem->dma_addr;
cbuf->size = (uint32_t)dma_mem->size;
}
-int ethosu_mailbox_register(struct ethosu_mailbox *mbox,
- struct ethosu_mailbox_msg *msg)
+int ethosu_rpmsg_mailbox_register(struct ethosu_rpmsg_mailbox *mbox,
+ struct ethosu_rpmsg_mailbox_msg *msg)
{
WARN_ON_ONCE(!mutex_is_locked(&mbox->dev->mutex));
msg->id = idr_alloc_cyclic(&mbox->msg_idr, msg, 0, INT_MAX, GFP_KERNEL);
@@ -142,21 +142,24 @@ int ethosu_mailbox_register(struct ethosu_mailbox *mbox,
return 0;
}
-void ethosu_mailbox_deregister(struct ethosu_mailbox *mbox,
- struct ethosu_mailbox_msg *msg)
+void ethosu_rpmsg_mailbox_deregister(struct ethosu_rpmsg_mailbox *mbox,
+ struct ethosu_rpmsg_mailbox_msg *msg)
{
WARN_ON_ONCE(!mutex_is_locked(&mbox->dev->mutex));
idr_remove(&mbox->msg_idr, msg->id);
}
-struct ethosu_mailbox_msg *ethosu_mailbox_find(struct ethosu_mailbox *mbox,
- int msg_id,
- uint32_t msg_type)
+struct ethosu_rpmsg_mailbox_msg *ethosu_rpmsg_mailbox_find(
+ struct ethosu_rpmsg_mailbox *mbox,
+ int msg_id,
+ uint32_t msg_type)
{
- struct ethosu_mailbox_msg *ptr;
+ struct ethosu_rpmsg_mailbox_msg *ptr;
WARN_ON_ONCE(!mutex_is_locked(&mbox->dev->mutex));
- ptr = (struct ethosu_mailbox_msg *)idr_find(&mbox->msg_idr, msg_id);
+ ptr =
+ (struct ethosu_rpmsg_mailbox_msg *)idr_find(&mbox->msg_idr,
+ msg_id);
if (ptr == NULL)
return ERR_PTR(-ENOENT);
@@ -167,9 +170,9 @@ struct ethosu_mailbox_msg *ethosu_mailbox_find(struct ethosu_mailbox *mbox,
return ptr;
}
-void ethosu_mailbox_fail(struct ethosu_mailbox *mbox)
+void ethosu_rpmsg_mailbox_fail(struct ethosu_rpmsg_mailbox *mbox)
{
- struct ethosu_mailbox_msg *cur;
+ struct ethosu_rpmsg_mailbox_msg *cur;
int id;
WARN_ON_ONCE(!mutex_is_locked(&mbox->dev->mutex));
@@ -178,37 +181,37 @@ void ethosu_mailbox_fail(struct ethosu_mailbox *mbox)
}
}
-int ethosu_mailbox_ping(struct ethosu_mailbox *mbox)
+int ethosu_rpmsg_mailbox_ping(struct ethosu_rpmsg_mailbox *mbox)
{
- struct ethosu_core_rpmsg rpmsg = {
+ struct ethosu_rpmsg rpmsg = {
.header = {
- .magic = ETHOSU_CORE_MSG_MAGIC,
- .type = ETHOSU_CORE_MSG_PING,
+ .magic = ETHOSU_RPMSG_MAGIC,
+ .type = ETHOSU_RPMSG_PING,
}
};
return ethosu_send_locked(mbox, &rpmsg, sizeof(rpmsg.header));
}
-int ethosu_mailbox_pong(struct ethosu_mailbox *mbox)
+int ethosu_rpmsg_mailbox_pong(struct ethosu_rpmsg_mailbox *mbox)
{
- struct ethosu_core_rpmsg rpmsg = {
+ struct ethosu_rpmsg rpmsg = {
.header = {
- .magic = ETHOSU_CORE_MSG_MAGIC,
- .type = ETHOSU_CORE_MSG_PONG,
+ .magic = ETHOSU_RPMSG_MAGIC,
+ .type = ETHOSU_RPMSG_PONG,
}
};
return ethosu_send_locked(mbox, &rpmsg, sizeof(rpmsg.header));
}
-int ethosu_mailbox_version_request(struct ethosu_mailbox *mbox,
- struct ethosu_mailbox_msg *msg)
+int ethosu_rpmsg_mailbox_version_request(struct ethosu_rpmsg_mailbox *mbox,
+ struct ethosu_rpmsg_mailbox_msg *msg)
{
- struct ethosu_core_rpmsg rpmsg = {
+ struct ethosu_rpmsg rpmsg = {
.header = {
- .magic = ETHOSU_CORE_MSG_MAGIC,
- .type = ETHOSU_CORE_MSG_VERSION_REQ,
+ .magic = ETHOSU_RPMSG_MAGIC,
+ .type = ETHOSU_RPMSG_VERSION_REQ,
.msg_id = msg->id
}
};
@@ -218,13 +221,13 @@ int ethosu_mailbox_version_request(struct ethosu_mailbox *mbox,
return ethosu_send_locked(mbox, &rpmsg, sizeof(rpmsg.header));
}
-int ethosu_mailbox_capabilities_request(struct ethosu_mailbox *mbox,
- struct ethosu_mailbox_msg *msg)
+int ethosu_rpmsg_mailbox_capabilities_request(struct ethosu_rpmsg_mailbox *mbox,
+ struct ethosu_rpmsg_mailbox_msg *msg)
{
- struct ethosu_core_rpmsg rpmsg = {
+ struct ethosu_rpmsg rpmsg = {
.header = {
- .magic = ETHOSU_CORE_MSG_MAGIC,
- .type = ETHOSU_CORE_MSG_CAPABILITIES_REQ,
+ .magic = ETHOSU_RPMSG_MAGIC,
+ .type = ETHOSU_RPMSG_CAPABILITIES_REQ,
.msg_id = msg->id
}
};
@@ -234,31 +237,31 @@ int ethosu_mailbox_capabilities_request(struct ethosu_mailbox *mbox,
return ethosu_send_locked(mbox, &rpmsg, sizeof(rpmsg.header));
}
-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)
+int ethosu_rpmsg_mailbox_inference(struct ethosu_rpmsg_mailbox *mbox,
+ struct ethosu_rpmsg_mailbox_msg *msg,
+ uint32_t ifm_count,
+ struct ethosu_buffer **ifm,
+ uint32_t ofm_count,
+ struct ethosu_buffer **ofm,
+ struct ethosu_rpmsg_network *network,
+ uint8_t *pmu_event_config,
+ uint8_t pmu_event_config_count,
+ uint8_t pmu_cycle_counter_enable)
{
- struct ethosu_core_rpmsg rpmsg = {
+ struct ethosu_rpmsg rpmsg = {
.header = {
- .magic = ETHOSU_CORE_MSG_MAGIC,
- .type = ETHOSU_CORE_MSG_INFERENCE_REQ,
+ .magic = ETHOSU_RPMSG_MAGIC,
+ .type = ETHOSU_RPMSG_INFERENCE_REQ,
.msg_id = msg->id
}
};
- struct ethosu_core_msg_inference_req *inf_req = &rpmsg.inf_req;
+ struct ethosu_rpmsg_inference_req *inf_req = &rpmsg.inf_req;
uint32_t i;
msg->type = rpmsg.header.type;
/* Verify that the uapi and core has the same number of pmus */
- if (pmu_event_config_count != ETHOSU_CORE_PMU_MAX) {
+ if (pmu_event_config_count != ETHOSU_RPMSG_PMU_MAX) {
dev_err(mbox->dev, "PMU count misconfigured.");
return -EINVAL;
@@ -269,22 +272,22 @@ int ethosu_mailbox_inference(struct ethosu_mailbox *mbox,
inf_req->pmu_cycle_counter_enable = pmu_cycle_counter_enable;
for (i = 0; i < ifm_count; i++)
- ethosu_core_buffer_dma_mem_set(ifm[i]->dma_mem,
- &inf_req->ifm[i]);
+ ethosu_rpmsg_buffer_dma_mem_set(ifm[i]->dma_mem,
+ &inf_req->ifm[i]);
for (i = 0; i < ofm_count; i++)
- ethosu_core_buffer_dma_mem_set(ofm[i]->dma_mem,
- &inf_req->ofm[i]);
+ ethosu_rpmsg_buffer_dma_mem_set(ofm[i]->dma_mem,
+ &inf_req->ofm[i]);
- for (i = 0; i < ETHOSU_CORE_PMU_MAX; i++)
+ for (i = 0; i < ETHOSU_RPMSG_PMU_MAX; i++)
inf_req->pmu_event_config[i] = pmu_event_config[i];
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);
+ inf_req->network.type = ETHOSU_RPMSG_NETWORK_BUFFER;
+ ethosu_rpmsg_buffer_dma_mem_set(network->dma_mem,
+ &inf_req->network.buffer);
} else {
- inf_req->network.type = ETHOSU_CORE_NETWORK_INDEX;
+ inf_req->network.type = ETHOSU_RPMSG_NETWORK_INDEX;
inf_req->network.index = network->index;
}
@@ -292,27 +295,27 @@ int ethosu_mailbox_inference(struct ethosu_mailbox *mbox,
sizeof(rpmsg.header) + sizeof(rpmsg.inf_req));
}
-int ethosu_mailbox_network_info_request(struct ethosu_mailbox *mbox,
- struct ethosu_mailbox_msg *msg,
- struct ethosu_network *network)
+int ethosu_rpmsg_mailbox_network_info_request(struct ethosu_rpmsg_mailbox *mbox,
+ struct ethosu_rpmsg_mailbox_msg *msg,
+ struct ethosu_rpmsg_network *network)
{
- struct ethosu_core_rpmsg rpmsg = {
+ struct ethosu_rpmsg rpmsg = {
.header = {
- .magic = ETHOSU_CORE_MSG_MAGIC,
- .type = ETHOSU_CORE_MSG_NETWORK_INFO_REQ,
+ .magic = ETHOSU_RPMSG_MAGIC,
+ .type = ETHOSU_RPMSG_NETWORK_INFO_REQ,
.msg_id = msg->id
}
};
- struct ethosu_core_msg_network_info_req *info_req = &rpmsg.net_info_req;
+ struct ethosu_rpmsg_network_info_req *info_req = &rpmsg.net_info_req;
msg->type = rpmsg.header.type;
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);
+ info_req->network.type = ETHOSU_RPMSG_NETWORK_BUFFER;
+ ethosu_rpmsg_buffer_dma_mem_set(network->dma_mem,
+ &info_req->network.buffer);
} else {
- info_req->network.type = ETHOSU_CORE_NETWORK_INDEX;
+ info_req->network.type = ETHOSU_RPMSG_NETWORK_INDEX;
info_req->network.index = network->index;
}
@@ -321,15 +324,15 @@ int ethosu_mailbox_network_info_request(struct ethosu_mailbox *mbox,
sizeof(rpmsg.net_info_req));
}
-int ethosu_mailbox_cancel_inference(struct ethosu_mailbox *mbox,
- struct ethosu_mailbox_msg *msg,
- int inference_handle)
+int ethosu_rpmsg_mailbox_cancel_inference(struct ethosu_rpmsg_mailbox *mbox,
+ struct ethosu_rpmsg_mailbox_msg *msg,
+ int inference_handle)
{
- struct ethosu_core_rpmsg rpmsg = {
+ struct ethosu_rpmsg rpmsg = {
.header = {
- .magic = ETHOSU_CORE_MSG_MAGIC,
+ .magic = ETHOSU_RPMSG_MAGIC,
.type =
- ETHOSU_CORE_MSG_CANCEL_INFERENCE_REQ,
+ ETHOSU_RPMSG_CANCEL_INFERENCE_REQ,
.msg_id = msg->id
},
.cancel_req = {
@@ -344,9 +347,9 @@ int ethosu_mailbox_cancel_inference(struct ethosu_mailbox *mbox,
sizeof(rpmsg.cancel_req));
}
-int ethosu_mailbox_init(struct ethosu_mailbox *mbox,
- struct device *dev,
- struct rpmsg_endpoint *ept)
+int ethosu_rpmsg_mailbox_init(struct ethosu_rpmsg_mailbox *mbox,
+ struct device *dev,
+ struct rpmsg_endpoint *ept)
{
mbox->dev = dev;
mbox->ept = ept;
@@ -356,7 +359,7 @@ int ethosu_mailbox_init(struct ethosu_mailbox *mbox,
return 0;
}
-void ethosu_mailbox_deinit(struct ethosu_mailbox *mbox)
+void ethosu_rpmsg_mailbox_deinit(struct ethosu_rpmsg_mailbox *mbox)
{
atomic_set(&mbox->done, 1);
wake_up_all(&mbox->send_queue);