1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019 HiSilicon Limited. */
6 #include <linux/list.h>
7 #include <linux/hisi_acc_qm.h>
9 #define HPRE_SQE_SIZE sizeof(struct hpre_sqe)
10 #define HPRE_PF_DEF_Q_NUM 64
11 #define HPRE_PF_DEF_Q_BASE 0
14 * type used in qm sqc DW6.
15 * 0 - Algorithm which has been supported in V2, like RSA, DH and so on;
16 * 1 - ECC algorithm in V3.
18 #define HPRE_V2_ALG_TYPE 0
19 #define HPRE_V3_ECC_ALG_TYPE 1
29 enum hpre_ctrl_dbgfs_file {
35 enum hpre_dfx_dbgfs_file {
46 #define HPRE_DEBUGFS_FILE_NUM (HPRE_DEBUG_FILE_NUM + HPRE_CLUSTERS_NUM_MAX - 1)
48 struct hpre_debugfs_file {
50 enum hpre_ctrl_dbgfs_file type;
52 struct hpre_debug *debug;
57 enum hpre_dfx_dbgfs_file type;
61 * One HPRE controller has one PF and multiple VFs, some global configurations
62 * which PF has need this structure.
63 * Just relevant for PF.
66 struct hpre_dfx dfx[HPRE_DFX_FILE_NUM];
67 struct hpre_debugfs_file files[HPRE_DEBUGFS_FILE_NUM];
72 struct hpre_debug debug;
77 HPRE_ALG_NC_NCRT = 0x0,
78 HPRE_ALG_NC_CRT = 0x1,
79 HPRE_ALG_KG_STD = 0x2,
80 HPRE_ALG_KG_CRT = 0x3,
83 HPRE_ALG_ECC_MUL = 0xD,
84 /* shared by x25519 and x448, but x448 is not supported now */
85 HPRE_ALG_CURVE25519_MUL = 0x10,
99 #define _HPRE_SQE_ALIGN_EXT 7
100 __le32 rsvd1[_HPRE_SQE_ALIGN_EXT];
103 struct hisi_qp *hpre_create_qp(u8 type);
104 int hpre_algs_register(struct hisi_qm *qm);
105 void hpre_algs_unregister(struct hisi_qm *qm);
106 bool hpre_check_alg_support(struct hisi_qm *qm, u32 alg);