Skip to content

Commit 3176637

Browse files
tsk-lieacuiherbertx
authored andcommitted
crypto: hisilicon - remove codes of directly report device errors through MSI
The hardware device can be configured to report directly through MSI, but this method will not go through RAS, configure all hardware errors that should be processed by driver to NFE. Signed-off-by: Shukun Tan <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 5308f66 commit 3176637

File tree

5 files changed

+13
-48
lines changed

5 files changed

+13
-48
lines changed

drivers/crypto/hisilicon/hpre/hpre_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ static const struct hisi_qm_err_ini hpre_err_ini = {
730730
.ce = QM_BASE_CE,
731731
.nfe = QM_BASE_NFE | QM_ACC_DO_TASK_TIMEOUT,
732732
.fe = 0,
733-
.msi = QM_DB_RANDOM_INVALID,
734733
.ecc_2bits_mask = HPRE_CORE_ECC_2BIT_ERR |
735734
HPRE_OOO_ECC_2BIT_ERR,
736735
.msi_wr_port = HPRE_WR_MSI_PORT,

drivers/crypto/hisilicon/qm.c

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ struct hisi_qm_hw_ops {
313313
u8 cmd, u16 index, u8 priority);
314314
u32 (*get_irq_num)(struct hisi_qm *qm);
315315
int (*debug_init)(struct hisi_qm *qm);
316-
void (*hw_error_init)(struct hisi_qm *qm, u32 ce, u32 nfe, u32 fe,
317-
u32 msi);
316+
void (*hw_error_init)(struct hisi_qm *qm, u32 ce, u32 nfe, u32 fe);
318317
void (*hw_error_uninit)(struct hisi_qm *qm);
319318
pci_ers_result_t (*hw_error_handle)(struct hisi_qm *qm);
320319
};
@@ -707,26 +706,6 @@ static irqreturn_t qm_aeq_irq(int irq, void *data)
707706

708707
static irqreturn_t qm_abnormal_irq(int irq, void *data)
709708
{
710-
const struct hisi_qm_hw_error *err = qm_hw_error;
711-
struct hisi_qm *qm = data;
712-
struct device *dev = &qm->pdev->dev;
713-
u32 error_status, tmp;
714-
715-
/* read err sts */
716-
tmp = readl(qm->io_base + QM_ABNORMAL_INT_STATUS);
717-
error_status = qm->msi_mask & tmp;
718-
719-
while (err->msg) {
720-
if (err->int_msk & error_status)
721-
dev_err(dev, "%s [error status=0x%x] found\n",
722-
err->msg, err->int_msk);
723-
724-
err++;
725-
}
726-
727-
/* clear err sts */
728-
writel(error_status, qm->io_base + QM_ABNORMAL_INT_SOURCE);
729-
730709
return IRQ_HANDLED;
731710
}
732711

@@ -1116,38 +1095,28 @@ static int qm_create_debugfs_file(struct hisi_qm *qm, enum qm_debug_file index)
11161095
return 0;
11171096
}
11181097

1119-
static void qm_hw_error_init_v1(struct hisi_qm *qm, u32 ce, u32 nfe, u32 fe,
1120-
u32 msi)
1098+
static void qm_hw_error_init_v1(struct hisi_qm *qm, u32 ce, u32 nfe, u32 fe)
11211099
{
11221100
writel(QM_ABNORMAL_INT_MASK_VALUE, qm->io_base + QM_ABNORMAL_INT_MASK);
11231101
}
11241102

1125-
static void qm_hw_error_init_v2(struct hisi_qm *qm, u32 ce, u32 nfe, u32 fe,
1126-
u32 msi)
1103+
static void qm_hw_error_init_v2(struct hisi_qm *qm, u32 ce, u32 nfe, u32 fe)
11271104
{
1128-
u32 irq_enable = ce | nfe | fe | msi;
1105+
u32 irq_enable = ce | nfe | fe;
11291106
u32 irq_unmask = ~irq_enable;
1130-
u32 error_status;
11311107

11321108
qm->error_mask = ce | nfe | fe;
1133-
qm->msi_mask = msi;
11341109

11351110
/* clear QM hw residual error source */
1136-
error_status = readl(qm->io_base + QM_ABNORMAL_INT_STATUS);
1137-
if (error_status) {
1138-
error_status &= qm->error_mask;
1139-
writel(error_status, qm->io_base + QM_ABNORMAL_INT_SOURCE);
1140-
}
1111+
writel(QM_ABNORMAL_INT_SOURCE_CLR,
1112+
qm->io_base + QM_ABNORMAL_INT_SOURCE);
11411113

11421114
/* configure error type */
11431115
writel(ce, qm->io_base + QM_RAS_CE_ENABLE);
11441116
writel(QM_RAS_CE_TIMES_PER_IRQ, qm->io_base + QM_RAS_CE_THRESHOLD);
11451117
writel(nfe, qm->io_base + QM_RAS_NFE_ENABLE);
11461118
writel(fe, qm->io_base + QM_RAS_FE_ENABLE);
11471119

1148-
/* use RAS irq default, so only set QM_RAS_MSI_INT_SEL for MSI */
1149-
writel(msi, qm->io_base + QM_RAS_MSI_INT_SEL);
1150-
11511120
irq_unmask &= readl(qm->io_base + QM_ABNORMAL_INT_MASK);
11521121
writel(irq_unmask, qm->io_base + QM_ABNORMAL_INT_MASK);
11531122
}
@@ -1207,9 +1176,11 @@ static pci_ers_result_t qm_hw_error_handle_v2(struct hisi_qm *qm)
12071176
qm->err_status.is_qm_ecc_mbit = true;
12081177

12091178
qm_log_hw_error(qm, error_status);
1210-
1211-
/* clear err sts */
1212-
writel(error_status, qm->io_base + QM_ABNORMAL_INT_SOURCE);
1179+
if (error_status == QM_DB_RANDOM_INVALID) {
1180+
writel(error_status, qm->io_base +
1181+
QM_ABNORMAL_INT_SOURCE);
1182+
return PCI_ERS_RESULT_RECOVERED;
1183+
}
12131184

12141185
return PCI_ERS_RESULT_NEED_RESET;
12151186
}
@@ -2476,8 +2447,7 @@ static void qm_hw_error_init(struct hisi_qm *qm)
24762447
return;
24772448
}
24782449

2479-
qm->ops->hw_error_init(qm, err_info->ce, err_info->nfe,
2480-
err_info->fe, err_info->msi);
2450+
qm->ops->hw_error_init(qm, err_info->ce, err_info->nfe, err_info->fe);
24812451
}
24822452

24832453
static void qm_hw_error_uninit(struct hisi_qm *qm)

drivers/crypto/hisilicon/qm.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
#define QM_BASE_NFE (QM_AXI_RRESP | QM_AXI_BRESP | QM_ECC_MBIT | \
7676
QM_ACC_GET_TASK_TIMEOUT | QM_DB_TIMEOUT | \
77-
QM_OF_FIFO_OF)
77+
QM_OF_FIFO_OF | QM_DB_RANDOM_INVALID)
7878
#define QM_BASE_CE QM_ECC_1BIT
7979

8080
#define QM_Q_DEPTH 1024
@@ -158,7 +158,6 @@ struct hisi_qm_err_info {
158158
u32 ce;
159159
u32 nfe;
160160
u32 fe;
161-
u32 msi;
162161
};
163162

164163
struct hisi_qm_err_status {
@@ -224,7 +223,6 @@ struct hisi_qm {
224223
struct qm_debug debug;
225224

226225
u32 error_mask;
227-
u32 msi_mask;
228226

229227
struct workqueue_struct *wq;
230228
struct work_struct work;

drivers/crypto/hisilicon/sec2/sec_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,6 @@ static const struct hisi_qm_err_ini sec_err_ini = {
682682
.nfe = QM_BASE_NFE | QM_ACC_DO_TASK_TIMEOUT |
683683
QM_ACC_WB_NOT_READY_TIMEOUT,
684684
.fe = 0,
685-
.msi = QM_DB_RANDOM_INVALID,
686685
.ecc_2bits_mask = SEC_CORE_INT_STATUS_M_ECC,
687686
.msi_wr_port = BIT(0),
688687
.acpi_rst = "SRST",

drivers/crypto/hisilicon/zip/zip_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@ static const struct hisi_qm_err_ini hisi_zip_err_ini = {
643643
.nfe = QM_BASE_NFE |
644644
QM_ACC_WB_NOT_READY_TIMEOUT,
645645
.fe = 0,
646-
.msi = QM_DB_RANDOM_INVALID,
647646
.ecc_2bits_mask = HZIP_CORE_INT_STATUS_M_ECC,
648647
.msi_wr_port = HZIP_WR_PORT,
649648
.acpi_rst = "ZRST",

0 commit comments

Comments
 (0)