* [PATCH] crypto: hisilicon/qm - disable qm clock-gating
@ 2021-12-18 10:17 Weili Qian
2021-12-24 3:26 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Weili Qian @ 2021-12-18 10:17 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-kernel, linux-crypto, wangzhou1, liulongfang
For Kunpeng930, if qm clock-gating is enabled, rate limiter
will be inaccurate. Therefore, disable clock-gating before doing task.
Signed-off-by: Weili Qian <qianweili@huawei.com>
---
drivers/crypto/hisilicon/qm.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index b1fe9c7b8cc8..b731cb4ec294 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -126,6 +126,8 @@
#define QM_CQC_VFT 0x1
#define QM_VFT_CFG 0x100060
#define QM_VFT_CFG_OP_ENABLE 0x100054
+#define QM_PM_CTRL 0x100148
+#define QM_IDLE_DISABLE BIT(9)
#define QM_VFT_CFG_DATA_L 0x100064
#define QM_VFT_CFG_DATA_H 0x100068
@@ -800,6 +802,19 @@ static void qm_db(struct hisi_qm *qm, u16 qn, u8 cmd, u16 index, u8 priority)
qm->ops->qm_db(qm, qn, cmd, index, priority);
}
+static void qm_disable_clock_gate(struct hisi_qm *qm)
+{
+ u32 val;
+
+ /* if qm enables clock gating in Kunpeng930, qos will be inaccurate. */
+ if (qm->ver < QM_HW_V3)
+ return;
+
+ val = readl(qm->io_base + QM_PM_CTRL);
+ val |= QM_IDLE_DISABLE;
+ writel(val, qm->io_base + QM_PM_CTRL);
+}
+
static int qm_dev_mem_reset(struct hisi_qm *qm)
{
u32 val;
@@ -5935,6 +5950,7 @@ int hisi_qm_init(struct hisi_qm *qm)
}
if (qm->fun_type == QM_HW_PF) {
+ qm_disable_clock_gate(qm);
ret = qm_dev_mem_reset(qm);
if (ret) {
dev_err(dev, "failed to reset device memory\n");
@@ -6099,6 +6115,7 @@ static int qm_rebuild_for_resume(struct hisi_qm *qm)
qm_cmd_init(qm);
hisi_qm_dev_err_init(qm);
+ qm_disable_clock_gate(qm);
ret = qm_dev_mem_reset(qm);
if (ret)
pci_err(pdev, "failed to reset device memory\n");
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: hisilicon/qm - disable qm clock-gating
2021-12-18 10:17 [PATCH] crypto: hisilicon/qm - disable qm clock-gating Weili Qian
@ 2021-12-24 3:26 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2021-12-24 3:26 UTC (permalink / raw)
To: Weili Qian; +Cc: davem, linux-kernel, linux-crypto, wangzhou1, liulongfang
On Sat, Dec 18, 2021 at 06:17:20PM +0800, Weili Qian wrote:
> For Kunpeng930, if qm clock-gating is enabled, rate limiter
> will be inaccurate. Therefore, disable clock-gating before doing task.
>
> Signed-off-by: Weili Qian <qianweili@huawei.com>
> ---
> drivers/crypto/hisilicon/qm.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-24 3:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18 10:17 [PATCH] crypto: hisilicon/qm - disable qm clock-gating Weili Qian
2021-12-24 3:26 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).