From: Siew Chin Lim <elly.siew.chin....@intel.com> commit cda742d28bc9236a17b2eb89b09e15925ba64c24 from https://github.com/altera-opensource/linux-socfpga.git socfpga-6.1.68-lts.
Change INTEL_SIP_SMC_FCS_GET_PROVISION_DATA's SMC call to async from sync to avoid long runtime which may cause the watchdog timeout issue. Signed-off-by: Richard Gong <richard.g...@intel.com> Signed-off-by: Siew Chin Lim <elly.siew.chin....@intel.com> Signed-off-by: Liwei Song <liwei.s...@windriver.com> --- drivers/crypto/intel_fcs_main.c | 60 +++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/drivers/crypto/intel_fcs_main.c b/drivers/crypto/intel_fcs_main.c index 05ca55ca1032..94bee786ee51 100644 --- a/drivers/crypto/intel_fcs_main.c +++ b/drivers/crypto/intel_fcs_main.c @@ -688,33 +688,59 @@ static long fcs_ioctl(struct file *file, unsigned int cmd, } msg->command = COMMAND_FCS_GET_PROVISION_DATA; - msg->payload = s_buf; - msg->payload_length = data->com_paras.gp_data.size; - priv->client.receive_cb = fcs_data_callback; + msg->payload = NULL; + msg->payload_length = 0; + priv->client.receive_cb = fcs_vab_callback; ret = fcs_request_service(priv, (void *)msg, FCS_REQUEST_TIMEOUT); if (!ret && !priv->status) { - if (!priv->kbuf) { - dev_err(dev, "failure on kbuf\n"); - fcs_close_services(priv, s_buf, NULL); - return -EFAULT; - } - data->com_paras.gp_data.size = priv->size; - ret = copy_to_user(data->com_paras.gp_data.addr, - priv->kbuf, priv->size); - if (ret) { - dev_err(dev, "failure on copy_to_user\n"); - fcs_close_services(priv, s_buf, NULL); - return -EFAULT; + /* to query the complete status */ + msg->arg[0] = ASYNC_POLL_SERVICE; + msg->payload = s_buf; + msg->payload_length = data->com_paras.gp_data.size; + msg->command = COMMAND_POLL_SERVICE_STATUS_ASYNC; + priv->client.receive_cb = fcs_data_callback; + + timeout = 100; + while (timeout != 0) { + ret = fcs_request_service(priv, (void *)msg, + FCS_REQUEST_TIMEOUT); + dev_dbg(dev, "request service ret=%d\n", ret); + + if (!ret && !priv->status) { + if (priv->size) { + if (!priv->kbuf) { + dev_err(dev, "failure on kbuf\n"); + fcs_close_services(priv, s_buf, NULL); + return -EFAULT; + } + + data->com_paras.gp_data.size = priv->size; + ret = copy_to_user(data->com_paras.gp_data.addr, + priv->kbuf, priv->size); + if (ret) { + dev_err(dev, "failure on copy_to_user\n"); + fcs_close_services(priv, s_buf, NULL); + return -EFAULT; + } + break; + } + } else { + data->com_paras.gp_data.addr = NULL; + data->com_paras.gp_data.size = 0; + break; + } + timeout--; + mdelay(500); } - data->status = 0; } else { data->com_paras.gp_data.addr = NULL; data->com_paras.gp_data.size = 0; - data->status = priv->status; } + data->status = priv->status; + if (copy_to_user((void __user *)arg, data, sizeof(*data))) { dev_err(dev, "failure on copy_to_user\n"); fcs_close_services(priv, s_buf, NULL); -- 2.35.5
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#14057): https://lists.yoctoproject.org/g/linux-yocto/message/14057 Mute This Topic: https://lists.yoctoproject.org/mt/106736320/21656 Mute #18015689699-2:https://lists.yoctoproject.org/g/linux-yocto/mutehashtag/18015689699-2 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-