mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 04:42:04 -04:00
msm: npu: remove asynchronous network execution support
Remove asynchronous network execution related code since it's not used. Change-Id: I9e9b54fddbbe9a0a1c0721983ae65e464fd49c0f Signed-off-by: Jilai Wang <quic_jilaiw@quicinc.com>
This commit is contained in:
parent
6cd9ac9ba6
commit
77f9dec046
3 changed files with 12 additions and 176 deletions
|
|
@ -243,19 +243,9 @@ struct npu_device {
|
|||
uint32_t hw_version;
|
||||
};
|
||||
|
||||
struct npu_kevent {
|
||||
struct list_head list;
|
||||
struct msm_npu_event evt;
|
||||
void *stats_buf;
|
||||
void __user *stats_buf_u;
|
||||
};
|
||||
|
||||
struct npu_client {
|
||||
struct npu_device *npu_dev;
|
||||
wait_queue_head_t wait;
|
||||
|
||||
struct mutex list_lock;
|
||||
struct list_head evt_list;
|
||||
struct list_head mapped_buffer_list;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -102,8 +102,6 @@ static int npu_exec_network(struct npu_client *client,
|
|||
unsigned long arg);
|
||||
static int npu_exec_network_v2(struct npu_client *client,
|
||||
unsigned long arg);
|
||||
static int npu_receive_event(struct npu_client *client,
|
||||
unsigned long arg);
|
||||
static int npu_set_fw_state(struct npu_client *client, uint32_t enable);
|
||||
static int npu_set_property(struct npu_client *client,
|
||||
unsigned long arg);
|
||||
|
|
@ -111,7 +109,6 @@ static int npu_get_property(struct npu_client *client,
|
|||
unsigned long arg);
|
||||
static long npu_ioctl(struct file *file, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
static __poll_t npu_poll(struct file *filp, struct poll_table_struct *p);
|
||||
static int npu_parse_dt_clock(struct npu_device *npu_dev);
|
||||
static int npu_parse_dt_regulator(struct npu_device *npu_dev);
|
||||
static int npu_of_parse_pwrlevels(struct npu_device *npu_dev,
|
||||
|
|
@ -223,7 +220,6 @@ static const struct file_operations npu_fops = {
|
|||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = npu_ioctl,
|
||||
#endif
|
||||
.poll = npu_poll,
|
||||
};
|
||||
|
||||
static const struct thermal_cooling_device_ops npu_cooling_ops = {
|
||||
|
|
@ -1215,9 +1211,7 @@ static int npu_open(struct inode *inode, struct file *file)
|
|||
return -ENOMEM;
|
||||
|
||||
client->npu_dev = npu_dev;
|
||||
init_waitqueue_head(&client->wait);
|
||||
mutex_init(&client->list_lock);
|
||||
INIT_LIST_HEAD(&client->evt_list);
|
||||
INIT_LIST_HEAD(&(client->mapped_buffer_list));
|
||||
file->private_data = client;
|
||||
|
||||
|
|
@ -1227,17 +1221,8 @@ static int npu_open(struct inode *inode, struct file *file)
|
|||
static int npu_close(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct npu_client *client = file->private_data;
|
||||
struct npu_kevent *kevent;
|
||||
|
||||
npu_host_cleanup_networks(client);
|
||||
|
||||
while (!list_empty(&client->evt_list)) {
|
||||
kevent = list_first_entry(&client->evt_list,
|
||||
struct npu_kevent, list);
|
||||
list_del(&kevent->list);
|
||||
kfree(kevent);
|
||||
}
|
||||
|
||||
mutex_destroy(&client->list_lock);
|
||||
kfree(client);
|
||||
return 0;
|
||||
|
|
@ -1559,57 +1544,6 @@ static int npu_exec_network_v2(struct npu_client *client,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int npu_process_kevent(struct npu_kevent *kevt)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
switch (kevt->evt.type) {
|
||||
case MSM_NPU_EVENT_TYPE_EXEC_V2_DONE:
|
||||
ret = copy_to_user(kevt->stats_buf_u,
|
||||
kevt->stats_buf,
|
||||
kevt->evt.u.exec_v2_done.stats_buf_size);
|
||||
if (ret) {
|
||||
pr_err("fail to copy to user\n");
|
||||
kevt->evt.u.exec_v2_done.stats_buf_size = 0;
|
||||
ret = -EFAULT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int npu_receive_event(struct npu_client *client,
|
||||
unsigned long arg)
|
||||
{
|
||||
void __user *argp = (void __user *)arg;
|
||||
struct npu_kevent *kevt;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&client->list_lock);
|
||||
if (list_empty(&client->evt_list)) {
|
||||
pr_err("event list is empty\n");
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
kevt = list_first_entry(&client->evt_list,
|
||||
struct npu_kevent, list);
|
||||
list_del(&kevt->list);
|
||||
npu_process_kevent(kevt);
|
||||
ret = copy_to_user(argp, &kevt->evt,
|
||||
sizeof(struct msm_npu_event));
|
||||
if (ret) {
|
||||
pr_err("fail to copy to user\n");
|
||||
ret = -EFAULT;
|
||||
}
|
||||
kfree(kevt);
|
||||
}
|
||||
mutex_unlock(&client->list_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int npu_set_fw_state(struct npu_client *client, uint32_t enable)
|
||||
{
|
||||
struct npu_device *npu_dev = client->npu_dev;
|
||||
|
|
@ -1761,9 +1695,6 @@ static long npu_ioctl(struct file *file, unsigned int cmd,
|
|||
case MSM_NPU_EXEC_NETWORK_V2:
|
||||
ret = npu_exec_network_v2(client, arg);
|
||||
break;
|
||||
case MSM_NPU_RECEIVE_EVENT:
|
||||
ret = npu_receive_event(client, arg);
|
||||
break;
|
||||
case MSM_NPU_SET_PROP:
|
||||
ret = npu_set_property(client, arg);
|
||||
break;
|
||||
|
|
@ -1777,23 +1708,6 @@ static long npu_ioctl(struct file *file, unsigned int cmd,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static __poll_t npu_poll(struct file *filp, struct poll_table_struct *p)
|
||||
{
|
||||
struct npu_client *client = filp->private_data;
|
||||
__poll_t mask = 0;
|
||||
|
||||
poll_wait(filp, &client->wait, p);
|
||||
|
||||
mutex_lock(&client->list_lock);
|
||||
if (!list_empty(&client->evt_list)) {
|
||||
pr_debug("poll cmd done\n");
|
||||
mask = EPOLLIN | EPOLLRDNORM;
|
||||
}
|
||||
mutex_unlock(&client->list_lock);
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Device Tree Parsing
|
||||
* -------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -53,10 +53,9 @@ static void host_session_msg_hdlr(struct npu_device *npu_dev);
|
|||
static void host_session_log_hdlr(struct npu_device *npu_dev);
|
||||
static int host_error_hdlr(struct npu_device *npu_dev, bool force);
|
||||
static int npu_send_network_cmd(struct npu_device *npu_dev,
|
||||
struct npu_network *network, void *cmd_ptr, bool async);
|
||||
struct npu_network *network, void *cmd_ptr);
|
||||
static int npu_send_misc_cmd(struct npu_device *npu_dev, uint32_t q_idx,
|
||||
void *cmd_ptr);
|
||||
static int npu_queue_event(struct npu_client *client, struct npu_kevent *evt);
|
||||
static int npu_notify_dsp(struct npu_device *npu_dev, bool pwr_up);
|
||||
static int npu_notify_aop(struct npu_device *npu_dev, bool on);
|
||||
static int update_dcvs_activity(struct npu_device *npu_dev, uint32_t activity);
|
||||
|
|
@ -349,7 +348,6 @@ static int host_error_hdlr(struct npu_device *npu_dev, bool force)
|
|||
{
|
||||
struct npu_host_ctx *host_ctx = &npu_dev->host_ctx;
|
||||
struct npu_network *network = NULL;
|
||||
struct npu_kevent kevt;
|
||||
int i;
|
||||
|
||||
if ((host_ctx->wdg_irq_sts == 0) && (host_ctx->err_irq_sts == 0)
|
||||
|
|
@ -370,18 +368,9 @@ static int host_error_hdlr(struct npu_device *npu_dev, bool force)
|
|||
if (network->is_valid && network->cmd_pending &&
|
||||
network->fw_error) {
|
||||
network->cmd_pending = false;
|
||||
if (network->cmd_async) {
|
||||
pr_debug("async cmd, queue ssr event\n");
|
||||
kevt.evt.type = MSM_NPU_EVENT_TYPE_SSR;
|
||||
kevt.evt.u.ssr.network_hdl =
|
||||
network->network_hdl;
|
||||
if (npu_queue_event(network->client, &kevt))
|
||||
pr_err("queue npu event failed\n");
|
||||
} else {
|
||||
pr_debug("complete network %llx\n",
|
||||
network->id);
|
||||
complete(&network->cmd_done);
|
||||
}
|
||||
pr_debug("complete network %llx\n",
|
||||
network->id);
|
||||
complete(&network->cmd_done);
|
||||
}
|
||||
}
|
||||
host_ctx->misc_pending = false;
|
||||
|
|
@ -702,31 +691,13 @@ static void free_network(struct npu_host_ctx *ctx, struct npu_client *client,
|
|||
* Function Definitions - IPC
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
static int npu_queue_event(struct npu_client *client, struct npu_kevent *evt)
|
||||
{
|
||||
struct npu_kevent *kevt = kmalloc(sizeof(*kevt), GFP_KERNEL);
|
||||
|
||||
if (!kevt)
|
||||
return -ENOMEM;
|
||||
|
||||
*kevt = *evt;
|
||||
INIT_LIST_HEAD(&kevt->list);
|
||||
mutex_lock(&client->list_lock);
|
||||
list_add_tail(&kevt->list, &client->evt_list);
|
||||
mutex_unlock(&client->list_lock);
|
||||
wake_up_interruptible(&client->wait);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg)
|
||||
{
|
||||
uint32_t msg_id;
|
||||
struct npu_network *network = NULL;
|
||||
struct npu_kevent kevt;
|
||||
struct npu_device *npu_dev = host_ctx->npu_dev;
|
||||
|
||||
memset(&kevt, 0, sizeof(kevt));
|
||||
msg_id = msg[1];
|
||||
switch (msg_id) {
|
||||
case NPU_IPC_MSG_EXECUTE_DONE:
|
||||
|
|
@ -765,18 +736,7 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg)
|
|||
network->cmd_pending = false;
|
||||
network->cmd_ret_status = exe_rsp_pkt->header.status;
|
||||
|
||||
if (!network->cmd_async) {
|
||||
complete(&network->cmd_done);
|
||||
} else {
|
||||
pr_debug("async cmd, queue event\n");
|
||||
kevt.evt.type = MSM_NPU_EVENT_TYPE_EXEC_DONE;
|
||||
kevt.evt.u.exec_done.network_hdl =
|
||||
exe_rsp_pkt->network_hdl;
|
||||
kevt.evt.u.exec_done.exec_result =
|
||||
exe_rsp_pkt->header.status;
|
||||
if (npu_queue_event(network->client, &kevt))
|
||||
pr_err("queue npu event failed\n");
|
||||
}
|
||||
complete(&network->cmd_done);
|
||||
network_put(network);
|
||||
|
||||
break;
|
||||
|
|
@ -820,22 +780,7 @@ static void app_msg_proc(struct npu_host_ctx *host_ctx, uint32_t *msg)
|
|||
network->stats_buf_size = stats_size;
|
||||
network->cmd_pending = false;
|
||||
network->cmd_ret_status = exe_rsp_pkt->header.status;
|
||||
|
||||
if (network->cmd_async) {
|
||||
pr_debug("async cmd, queue event\n");
|
||||
kevt.evt.type = MSM_NPU_EVENT_TYPE_EXEC_V2_DONE;
|
||||
kevt.evt.u.exec_v2_done.network_hdl =
|
||||
exe_rsp_pkt->network_hdl;
|
||||
kevt.evt.u.exec_v2_done.exec_result =
|
||||
exe_rsp_pkt->header.status;
|
||||
kevt.evt.u.exec_v2_done.stats_buf_size = stats_size;
|
||||
kevt.stats_buf = network->stats_buf;
|
||||
kevt.stats_buf_u = network->stats_buf_u;
|
||||
if (npu_queue_event(network->client, &kevt))
|
||||
pr_err("queue npu event failed\n");
|
||||
} else {
|
||||
complete(&network->cmd_done);
|
||||
}
|
||||
complete(&network->cmd_done);
|
||||
network_put(network);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1131,7 +1076,7 @@ int32_t npu_host_unmap_buf(struct npu_client *client,
|
|||
}
|
||||
|
||||
static int npu_send_network_cmd(struct npu_device *npu_dev,
|
||||
struct npu_network *network, void *cmd_ptr, bool async)
|
||||
struct npu_network *network, void *cmd_ptr)
|
||||
{
|
||||
struct npu_host_ctx *host_ctx = &npu_dev->host_ctx;
|
||||
int ret = 0;
|
||||
|
|
@ -1147,7 +1092,6 @@ static int npu_send_network_cmd(struct npu_device *npu_dev,
|
|||
pr_debug("Send cmd %d network id %lld\n",
|
||||
((struct ipc_cmd_header_pkt *)cmd_ptr)->cmd_type,
|
||||
network->id);
|
||||
network->cmd_async = async;
|
||||
network->cmd_ret_status = 0;
|
||||
network->cmd_pending = true;
|
||||
network->trans_id = ((struct ipc_cmd_header_pkt *)cmd_ptr)->trans_id;
|
||||
|
|
@ -1504,7 +1448,7 @@ int32_t npu_host_load_network(struct npu_client *client,
|
|||
set_perf_mode(npu_dev);
|
||||
/* NPU_IPC_CMD_LOAD will go onto IPC_QUEUE_APPS_EXEC */
|
||||
reinit_completion(&network->cmd_done);
|
||||
ret = npu_send_network_cmd(npu_dev, network, &load_packet, false);
|
||||
ret = npu_send_network_cmd(npu_dev, network, &load_packet);
|
||||
if (ret) {
|
||||
pr_err("NPU_IPC_CMD_LOAD sent failed: %d\n", ret);
|
||||
goto error_free_network;
|
||||
|
|
@ -1622,7 +1566,7 @@ int32_t npu_host_load_network_v2(struct npu_client *client,
|
|||
set_perf_mode(npu_dev);
|
||||
/* NPU_IPC_CMD_LOAD_V2 will go onto IPC_QUEUE_APPS_EXEC */
|
||||
reinit_completion(&network->cmd_done);
|
||||
ret = npu_send_network_cmd(npu_dev, network, load_packet, false);
|
||||
ret = npu_send_network_cmd(npu_dev, network, load_packet);
|
||||
if (ret) {
|
||||
pr_debug("NPU_IPC_CMD_LOAD_V2 sent failed: %d\n", ret);
|
||||
goto error_free_network;
|
||||
|
|
@ -1714,7 +1658,7 @@ int32_t npu_host_unload_network(struct npu_client *client,
|
|||
retry:
|
||||
/* NPU_IPC_CMD_UNLOAD will go onto IPC_QUEUE_APPS_EXEC */
|
||||
reinit_completion(&network->cmd_done);
|
||||
ret = npu_send_network_cmd(npu_dev, network, &unload_packet, false);
|
||||
ret = npu_send_network_cmd(npu_dev, network, &unload_packet);
|
||||
|
||||
if (ret) {
|
||||
pr_err("NPU_IPC_CMD_UNLOAD sent failed: %d\n", ret);
|
||||
|
|
@ -1791,7 +1735,6 @@ int32_t npu_host_exec_network(struct npu_client *client,
|
|||
int32_t ret;
|
||||
struct npu_network *network;
|
||||
struct npu_host_ctx *host_ctx = &npu_dev->host_ctx;
|
||||
bool async_ioctl = !!exec_ioctl->async;
|
||||
|
||||
mutex_lock(&host_ctx->lock);
|
||||
network = get_network_by_hdl(host_ctx, client,
|
||||
|
|
@ -1855,18 +1798,13 @@ int32_t npu_host_exec_network(struct npu_client *client,
|
|||
|
||||
/* Send it on the high priority queue */
|
||||
reinit_completion(&network->cmd_done);
|
||||
ret = npu_send_network_cmd(npu_dev, network, &exec_packet, async_ioctl);
|
||||
ret = npu_send_network_cmd(npu_dev, network, &exec_packet);
|
||||
|
||||
if (ret) {
|
||||
pr_err("NPU_IPC_CMD_EXECUTE sent failed: %d\n", ret);
|
||||
goto exec_done;
|
||||
}
|
||||
|
||||
if (async_ioctl) {
|
||||
pr_debug("Async ioctl, return now\n");
|
||||
goto exec_done;
|
||||
}
|
||||
|
||||
mutex_unlock(&host_ctx->lock);
|
||||
|
||||
ret = wait_for_completion_timeout(
|
||||
|
|
@ -1921,7 +1859,6 @@ int32_t npu_host_exec_network_v2(struct npu_client *client,
|
|||
struct npu_network *network;
|
||||
struct npu_host_ctx *host_ctx = &npu_dev->host_ctx;
|
||||
uint32_t num_patch_params, pkt_size;
|
||||
bool async_ioctl = !!exec_ioctl->async;
|
||||
int i;
|
||||
|
||||
mutex_lock(&host_ctx->lock);
|
||||
|
|
@ -1994,18 +1931,13 @@ int32_t npu_host_exec_network_v2(struct npu_client *client,
|
|||
|
||||
/* Send it on the high priority queue */
|
||||
reinit_completion(&network->cmd_done);
|
||||
ret = npu_send_network_cmd(npu_dev, network, exec_packet, async_ioctl);
|
||||
ret = npu_send_network_cmd(npu_dev, network, exec_packet);
|
||||
|
||||
if (ret) {
|
||||
pr_err("NPU_IPC_CMD_EXECUTE_V2 sent failed: %d\n", ret);
|
||||
goto free_exec_packet;
|
||||
}
|
||||
|
||||
if (async_ioctl) {
|
||||
pr_debug("Async ioctl, return now\n");
|
||||
goto free_exec_packet;
|
||||
}
|
||||
|
||||
mutex_unlock(&host_ctx->lock);
|
||||
|
||||
ret = wait_for_completion_timeout(
|
||||
|
|
|
|||
Loading…
Reference in a new issue