提交 c1c37291 编写于 作者: W Weili Qian 提交者: Zheng Zengkai

crypto: hisilicon/qm - add UACCE_CMD_QM_SET_QP_INFO support

mainline inclusion
from mainline-v6.1-rc1
commit c832da79
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5T7AD
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c832da79cbf9448e7ece097c3a93996b4c74a83e

----------------------------------------------------------------------

To be compatible with accelerator devices of different
versions, 'UACCE_CMD_QM_SET_QP_INFO' ioctl is added to obtain
queue information in userspace, including queue depth and buffer
description size.
Signed-off-by: NWeili Qian <qianweili@huawei.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NJiangshui Yang <yangjiangshui@h-partners.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: NYang Shen <shenyang39@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 cc81982b
......@@ -3431,6 +3431,7 @@ static long hisi_qm_uacce_ioctl(struct uacce_queue *q, unsigned int cmd,
unsigned long arg)
{
struct hisi_qp *qp = q->priv;
struct hisi_qp_info qp_info;
struct hisi_qp_ctx qp_ctx;
if (cmd == UACCE_CMD_QM_SET_QP_CTX) {
......@@ -3447,11 +3448,25 @@ static long hisi_qm_uacce_ioctl(struct uacce_queue *q, unsigned int cmd,
if (copy_to_user((void __user *)arg, &qp_ctx,
sizeof(struct hisi_qp_ctx)))
return -EFAULT;
} else {
return -EINVAL;
return 0;
} else if (cmd == UACCE_CMD_QM_SET_QP_INFO) {
if (copy_from_user(&qp_info, (void __user *)arg,
sizeof(struct hisi_qp_info)))
return -EFAULT;
qp_info.sqe_size = qp->qm->sqe_size;
qp_info.sq_depth = qp->sq_depth;
qp_info.cq_depth = qp->cq_depth;
if (copy_to_user((void __user *)arg, &qp_info,
sizeof(struct hisi_qp_info)))
return -EFAULT;
return 0;
}
return 0;
return -EINVAL;
}
static const struct uacce_ops uacce_qm_ops = {
......
......@@ -14,11 +14,26 @@ struct hisi_qp_ctx {
__u16 qc_type;
};
/**
* struct hisi_qp_info - User data for hisi qp.
* @sqe_size: Submission queue element size
* @sq_depth: The number of sqe
* @cq_depth: The number of cqe
* @reserved: Reserved data
*/
struct hisi_qp_info {
__u32 sqe_size;
__u16 sq_depth;
__u16 cq_depth;
__u64 reserved;
};
#define HISI_QM_API_VER_BASE "hisi_qm_v1"
#define HISI_QM_API_VER2_BASE "hisi_qm_v2"
#define HISI_QM_API_VER3_BASE "hisi_qm_v3"
/* UACCE_CMD_QM_SET_QP_CTX: Set qp algorithm type */
#define UACCE_CMD_QM_SET_QP_CTX _IOWR('H', 10, struct hisi_qp_ctx)
/* UACCE_CMD_QM_SET_QP_INFO: Set qp depth and BD size */
#define UACCE_CMD_QM_SET_QP_INFO _IOWR('H', 11, struct hisi_qp_info)
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册