Skip to content

Commit 145013f

Browse files
Weili Qianherbertx
authored andcommitted
crypto: hisilicon/hpre - mask cluster timeout error
The timeout threshold of the hpre cluster is 16ms. When the CPU and device share virtual address, page fault processing time may exceed the threshold. In the current test, there is a high probability that the cluster times out. However, the cluster is waiting for the completion of memory access, which is not an error, the device does not need to be reset. If an error occurs in the cluster, qm also reports the error. Therefore, the cluster timeout error of hpre can be masked. Fixes: d90fab0 ("crypto: hisilicon/qm - get error type from hardware registers") Signed-off-by: Weili Qian <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 5d2d1ee commit 145013f

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

drivers/crypto/hisilicon/hpre/hpre_main.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include <linux/uacce.h>
1414
#include "hpre.h"
1515

16-
#define HPRE_QM_ABNML_INT_MASK 0x100004
1716
#define HPRE_CTRL_CNT_CLR_CE_BIT BIT(0)
18-
#define HPRE_COMM_CNT_CLR_CE 0x0
1917
#define HPRE_CTRL_CNT_CLR_CE 0x301000
2018
#define HPRE_FSM_MAX_CNT 0x301008
2119
#define HPRE_VFG_AXQOS 0x30100c
@@ -42,7 +40,6 @@
4240
#define HPRE_HAC_INT_SET 0x301500
4341
#define HPRE_RNG_TIMEOUT_NUM 0x301A34
4442
#define HPRE_CORE_INT_ENABLE 0
45-
#define HPRE_CORE_INT_DISABLE GENMASK(21, 0)
4643
#define HPRE_RDCHN_INI_ST 0x301a00
4744
#define HPRE_CLSTR_BASE 0x302000
4845
#define HPRE_CORE_EN_OFFSET 0x04
@@ -66,7 +63,6 @@
6663
#define HPRE_CLSTR_ADDR_INTRVL 0x1000
6764
#define HPRE_CLUSTER_INQURY 0x100
6865
#define HPRE_CLSTR_ADDR_INQRY_RSLT 0x104
69-
#define HPRE_TIMEOUT_ABNML_BIT 6
7066
#define HPRE_PASID_EN_BIT 9
7167
#define HPRE_REG_RD_INTVRL_US 10
7268
#define HPRE_REG_RD_TMOUT_US 1000
@@ -203,9 +199,9 @@ static const struct hisi_qm_cap_info hpre_basic_info[] = {
203199
{HPRE_QM_RESET_MASK_CAP, 0x3128, 0, GENMASK(31, 0), 0x0, 0xC37, 0x6C37},
204200
{HPRE_QM_OOO_SHUTDOWN_MASK_CAP, 0x3128, 0, GENMASK(31, 0), 0x0, 0x4, 0x6C37},
205201
{HPRE_QM_CE_MASK_CAP, 0x312C, 0, GENMASK(31, 0), 0x0, 0x8, 0x8},
206-
{HPRE_NFE_MASK_CAP, 0x3130, 0, GENMASK(31, 0), 0x0, 0x3FFFFE, 0x1FFFFFE},
207-
{HPRE_RESET_MASK_CAP, 0x3134, 0, GENMASK(31, 0), 0x0, 0x3FFFFE, 0xBFFFFE},
208-
{HPRE_OOO_SHUTDOWN_MASK_CAP, 0x3134, 0, GENMASK(31, 0), 0x0, 0x22, 0xBFFFFE},
202+
{HPRE_NFE_MASK_CAP, 0x3130, 0, GENMASK(31, 0), 0x0, 0x3FFFFE, 0x1FFFC3E},
203+
{HPRE_RESET_MASK_CAP, 0x3134, 0, GENMASK(31, 0), 0x0, 0x3FFFFE, 0xBFFC3E},
204+
{HPRE_OOO_SHUTDOWN_MASK_CAP, 0x3134, 0, GENMASK(31, 0), 0x0, 0x22, 0xBFFC3E},
209205
{HPRE_CE_MASK_CAP, 0x3138, 0, GENMASK(31, 0), 0x0, 0x1, 0x1},
210206
{HPRE_CLUSTER_NUM_CAP, 0x313c, 20, GENMASK(3, 0), 0x0, 0x4, 0x1},
211207
{HPRE_CORE_TYPE_NUM_CAP, 0x313c, 16, GENMASK(3, 0), 0x0, 0x2, 0x2},
@@ -656,11 +652,6 @@ static int hpre_set_user_domain_and_cache(struct hisi_qm *qm)
656652
writel(HPRE_QM_USR_CFG_MASK, qm->io_base + QM_AWUSER_M_CFG_ENABLE);
657653
writel_relaxed(HPRE_QM_AXI_CFG_MASK, qm->io_base + QM_AXI_M_CFG);
658654

659-
/* HPRE need more time, we close this interrupt */
660-
val = readl_relaxed(qm->io_base + HPRE_QM_ABNML_INT_MASK);
661-
val |= BIT(HPRE_TIMEOUT_ABNML_BIT);
662-
writel_relaxed(val, qm->io_base + HPRE_QM_ABNML_INT_MASK);
663-
664655
if (qm->ver >= QM_HW_V3)
665656
writel(HPRE_RSA_ENB | HPRE_ECC_ENB,
666657
qm->io_base + HPRE_TYPES_ENB);
@@ -669,9 +660,7 @@ static int hpre_set_user_domain_and_cache(struct hisi_qm *qm)
669660

670661
writel(HPRE_QM_VFG_AX_MASK, qm->io_base + HPRE_VFG_AXCACHE);
671662
writel(0x0, qm->io_base + HPRE_BD_ENDIAN);
672-
writel(0x0, qm->io_base + HPRE_INT_MASK);
673663
writel(0x0, qm->io_base + HPRE_POISON_BYPASS);
674-
writel(0x0, qm->io_base + HPRE_COMM_CNT_CLR_CE);
675664
writel(0x0, qm->io_base + HPRE_ECC_BYPASS);
676665

677666
writel(HPRE_BD_USR_MASK, qm->io_base + HPRE_BD_ARUSR_CFG);
@@ -761,7 +750,7 @@ static void hpre_hw_error_disable(struct hisi_qm *qm)
761750

762751
static void hpre_hw_error_enable(struct hisi_qm *qm)
763752
{
764-
u32 ce, nfe;
753+
u32 ce, nfe, err_en;
765754

766755
ce = hisi_qm_get_hw_info(qm, hpre_basic_info, HPRE_CE_MASK_CAP, qm->cap_ver);
767756
nfe = hisi_qm_get_hw_info(qm, hpre_basic_info, HPRE_NFE_MASK_CAP, qm->cap_ver);
@@ -778,7 +767,8 @@ static void hpre_hw_error_enable(struct hisi_qm *qm)
778767
hpre_master_ooo_ctrl(qm, true);
779768

780769
/* enable hpre hw error interrupts */
781-
writel(HPRE_CORE_INT_ENABLE, qm->io_base + HPRE_INT_MASK);
770+
err_en = ce | nfe | HPRE_HAC_RAS_FE_ENABLE;
771+
writel(~err_en, qm->io_base + HPRE_INT_MASK);
782772
}
783773

784774
static inline struct hisi_qm *hpre_file_to_qm(struct hpre_debugfs_file *file)

0 commit comments

Comments
 (0)