提交 64e80c8f 编写于 作者: H Hui Tang 提交者: Herbert Xu

crypto: hisilicon/hpre - fix PASID setting on kunpeng 920

We must confirm the PASID is disabled before using no-sva mode.
Signed-off-by: NHui Tang <tanghui20@huawei.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 95c612b3
...@@ -244,28 +244,24 @@ struct hisi_qp *hpre_create_qp(u8 type) ...@@ -244,28 +244,24 @@ struct hisi_qp *hpre_create_qp(u8 type)
return NULL; return NULL;
} }
static void hpre_pasid_enable(struct hisi_qm *qm) static void hpre_config_pasid(struct hisi_qm *qm)
{ {
u32 val; u32 val1, val2;
val = readl_relaxed(qm->io_base + HPRE_DATA_RUSER_CFG);
val |= BIT(HPRE_PASID_EN_BIT);
writel_relaxed(val, qm->io_base + HPRE_DATA_RUSER_CFG);
val = readl_relaxed(qm->io_base + HPRE_DATA_WUSER_CFG);
val |= BIT(HPRE_PASID_EN_BIT);
writel_relaxed(val, qm->io_base + HPRE_DATA_WUSER_CFG);
}
static void hpre_pasid_disable(struct hisi_qm *qm) if (qm->ver >= QM_HW_V3)
{ return;
u32 val;
val = readl_relaxed(qm->io_base + HPRE_DATA_RUSER_CFG); val1 = readl_relaxed(qm->io_base + HPRE_DATA_RUSER_CFG);
val &= ~BIT(HPRE_PASID_EN_BIT); val2 = readl_relaxed(qm->io_base + HPRE_DATA_WUSER_CFG);
writel_relaxed(val, qm->io_base + HPRE_DATA_RUSER_CFG); if (qm->use_sva) {
val = readl_relaxed(qm->io_base + HPRE_DATA_WUSER_CFG); val1 |= BIT(HPRE_PASID_EN_BIT);
val &= ~BIT(HPRE_PASID_EN_BIT); val2 |= BIT(HPRE_PASID_EN_BIT);
writel_relaxed(val, qm->io_base + HPRE_DATA_WUSER_CFG); } else {
val1 &= ~BIT(HPRE_PASID_EN_BIT);
val2 &= ~BIT(HPRE_PASID_EN_BIT);
}
writel_relaxed(val1, qm->io_base + HPRE_DATA_RUSER_CFG);
writel_relaxed(val2, qm->io_base + HPRE_DATA_WUSER_CFG);
} }
static int hpre_cfg_by_dsm(struct hisi_qm *qm) static int hpre_cfg_by_dsm(struct hisi_qm *qm)
...@@ -391,12 +387,11 @@ static int hpre_set_user_domain_and_cache(struct hisi_qm *qm) ...@@ -391,12 +387,11 @@ static int hpre_set_user_domain_and_cache(struct hisi_qm *qm)
dev_err(dev, "acpi_evaluate_dsm err.\n"); dev_err(dev, "acpi_evaluate_dsm err.\n");
disable_flr_of_bme(qm); disable_flr_of_bme(qm);
/* Enable data buffer pasid */
if (qm->use_sva)
hpre_pasid_enable(qm);
} }
/* Config data buffer pasid needed by Kunpeng 920 */
hpre_config_pasid(qm);
return ret; return ret;
} }
...@@ -949,8 +944,6 @@ static void hpre_remove(struct pci_dev *pdev) ...@@ -949,8 +944,6 @@ static void hpre_remove(struct pci_dev *pdev)
hisi_qm_stop(qm, QM_NORMAL); hisi_qm_stop(qm, QM_NORMAL);
if (qm->fun_type == QM_HW_PF) { if (qm->fun_type == QM_HW_PF) {
if (qm->use_sva && qm->ver == QM_HW_V2)
hpre_pasid_disable(qm);
hpre_cnt_regs_clear(qm); hpre_cnt_regs_clear(qm);
qm->debug.curr_qm_qp_num = 0; qm->debug.curr_qm_qp_num = 0;
hisi_qm_dev_err_uninit(qm); hisi_qm_dev_err_uninit(qm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册