linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe@baylibre.com>
To: davem@davemloft.net, herbert@gondor.apana.org.au,
	mripard@kernel.org, wens@csie.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Corentin Labbe <clabbe@baylibre.com>
Subject: [PATCH v5 07/18] crypto: sun8i-ce: handle endianness of t_common_ctl
Date: Fri, 21 Aug 2020 13:43:24 +0000	[thread overview]
Message-ID: <1598017415-39059-8-git-send-email-clabbe@baylibre.com> (raw)
In-Reply-To: <1598017415-39059-1-git-send-email-clabbe@baylibre.com>

t_common_ctl is LE32 so we need to convert its value before using it.
This value is only used on H6 (ignored on other SoCs) and not handling
the endianness cause failure on xRNG/hashes operations on H6 when running BE.

Fixes: 06f751b61329 ("crypto: allwinner - Add sun8i-ce Crypto Engine")
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
index 138759dc8190..08ed1ca12baf 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
@@ -120,7 +120,10 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
 	/* Be sure all data is written before enabling the task */
 	wmb();
 
-	v = 1 | (ce->chanlist[flow].tl->t_common_ctl & 0x7F) << 8;
+	/* Only H6 needs to write a part of t_common_ctl along with "1", but since it is ignored
+	 * on older SoCs, we have no reason to complicate things.
+	 */
+	v = 1 | ((le32_to_cpu(ce->chanlist[flow].tl->t_common_ctl) & 0x7F) << 8);
 	writel(v, ce->base + CE_TLR);
 	mutex_unlock(&ce->mlock);
 
-- 
2.26.2


  parent reply	other threads:[~2020-08-21 13:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 13:43 [PATCH v5 00/18] crypto: allwinner: add xRNG and hashes Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 01/18] crypto: sun8i-ss: Add SS_START define Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 02/18] crypto: sun8i-ss: Add support for the PRNG Corentin Labbe
2020-08-28  6:49   ` Herbert Xu
2020-08-21 13:43 ` [PATCH v5 03/18] crypto: sun8i-ss: support hash algorithms Corentin Labbe
2020-08-28  6:47   ` Herbert Xu
2020-08-21 13:43 ` [PATCH v5 04/18] crypto: sun8i-ss: fix a trivial typo Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 05/18] crypto: sun8i-ss: Add more comment on some structures Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 06/18] crypto: sun8i-ss: better debug printing Corentin Labbe
2020-08-21 13:43 ` Corentin Labbe [this message]
2020-08-21 13:43 ` [PATCH v5 08/18] crypto: sun8i-ce: move iv data to request context Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 09/18] crypto: sun8i-ce: split into prepare/run/unprepare Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 10/18] crypto: sun8i-ce: handle different error registers Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 11/18] crypto: sun8i-ce: rename has_t_dlen_in_bytes to cipher_t_dlen_in_bytes Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 12/18] crypto: sun8i-ce: support hash algorithms Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 13/18] crypto: sun8i-ce: Add stat_bytes debugfs Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 14/18] crypto: sun8i-ce: Add support for the PRNG Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 15/18] crypto: sun8i-ce: Add support for the TRNG Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 16/18] crypto: sun8i-ce: fix comparison of integer expressions of different signedness Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 17/18] crypto: sun8i-ss: " Corentin Labbe
2020-08-21 13:43 ` [PATCH v5 18/18] crypto: sun8i-ce: fix some style issue Corentin Labbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1598017415-39059-8-git-send-email-clabbe@baylibre.com \
    --to=clabbe@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).