From patchwork Tue Oct 27 13:46:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 289665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92C07C5DF9D for ; Tue, 27 Oct 2020 15:43:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AF4122400 for ; Tue, 27 Oct 2020 15:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813429; bh=5tRloe/WquCIoD4rlZyg4y//tnx15kjtF5WLoGbJLHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HzsBMNWd0X7PfWnUQZdB6gpWSW+o9XvL6fpvUpFYmx8/gA20GouaARROPpX1QUuct gE9J1bCgv8qAyvDOdJFkSILF4b0EEIlsLoMMQtzOPgNcuzWmMpLP0W1HzXRt39VYun dLSS+KAw9aGdS1N4ukIFtsIGDm73m7FzBrkHDQ1g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1797480AbgJ0P04 (ORCPT ); Tue, 27 Oct 2020 11:26:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:40296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1797731AbgJ0PY7 (ORCPT ); Tue, 27 Oct 2020 11:24:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 09EF020657; Tue, 27 Oct 2020 15:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812299; bh=5tRloe/WquCIoD4rlZyg4y//tnx15kjtF5WLoGbJLHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TpRS4WL6FAR9vhX7SiFzlPiLEzQKAwbUi2Zwzc8zagVzAWaqitXSBpA9H2wmKk4Li 8gyTIgZLi+HVpFDLjRBa2LygoCL3SApqkbt9KI5XfINhjqRF7UsxeTw3JNidEg5rqv qW/EjAo2kq3vSBp4yVRN4USTtEIhPMp+COkC0YWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 5.9 160/757] crypto: sun8i-ce - handle endianness of t_common_ctl Date: Tue, 27 Oct 2020 14:46:50 +0100 Message-Id: <20201027135458.097006242@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Corentin Labbe [ Upstream commit 87f34260f5e09a4578132ad1c05aef2d707dd4bf ] 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 Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- 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 138759dc8190e..08ed1ca12baf9 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);