[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230225022627.8275-1-kunyu@nfschina.com>
Date: Sat, 25 Feb 2023 10:26:26 +0800
From: Li kunyu <kunyu@...china.com>
To: linus.walleij@...aro.org
Cc: davem@...emloft.net, herbert@...dor.apana.org.au,
kunyu@...china.com, linux-arm-kernel@...ts.infradead.org,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
lionel.debieve@...s.st.com, mcoquelin.stm32@...il.com
Subject: Re: [v2 PATCH] crypto: stm32 - Save and restore between each request
hello senior:
I understand the new patch and probably know where to add these two functions.
> +static int stm32_hash_one_request(struct crypto_engine *engine, void *areq)
+ if (rctx->flags & HASH_FLAGS_INIT) {
+ u32 *preg = rctx->hw_context;
+ u32 reg;
+ int i;
+
+ if (!hdev->pdata->ux500)
+ stm32_hash_write(hdev, HASH_IMR, *preg++);
+ stm32_hash_write(hdev, HASH_STR, *preg++);
+ stm32_hash_write(hdev, HASH_CR, *preg);
+ reg = *preg++ | HASH_CR_INIT;
+ stm32_hash_write(hdev, HASH_CR, reg);
+
+ for (i = 0; i < HASH_CSR_REGISTER_NUMBER; i++)
+ stm32_hash_write(hdev, HASH_CSR(i), *preg++);
+
+ hdev->flags |= HASH_FLAGS_INIT;
-------------------------------------------------------------
Add functions:
pm_runtime_mark_last_busy(hdev->dev);
pm_runtime_put_autosuspend(hdev->dev);
-------------------------------------------------------------
+ }
+
There is another place:
> @@ -442,6 +441,18 @@ static int stm32_hash_update_cpu(struct stm32_hash_dev *hdev)
hdev->flags |= HASH_FLAGS_OUTPUT_READY;
err = 0;
}
+ } else {
+ u32 *preg = rctx->hw_context;
+ int i;
+
+ if (!hdev->pdata->ux500)
+ *preg++ = stm32_hash_read(hdev, HASH_IMR);
+ *preg++ = stm32_hash_read(hdev, HASH_STR);
+ *preg++ = stm32_hash_read(hdev, HASH_CR);
+ for (i = 0; i < HASH_CSR_REGISTER_NUMBER; i++)
+ *preg++ = stm32_hash_read(hdev, HASH_CSR(i));
+
+ rctx->flags |= HASH_FLAGS_INIT;
-------------------------------------------------------------
Add functions:
pm_runtime_mark_last_busy(hdev->dev);
pm_runtime_put_autosuspend(hdev->dev);
-------------------------------------------------------------
}
Powered by blists - more mailing lists