Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4531118ybl; Tue, 20 Aug 2019 13:29:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/E9UtEC+xlpF/mNuWZLp6oPdA7JvDUOxRRz6k3Z7kEDG5bQAnVoCcMpcqYSphzWHvh4sB X-Received: by 2002:a17:902:a715:: with SMTP id w21mr28676756plq.274.1566332981075; Tue, 20 Aug 2019 13:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566332981; cv=none; d=google.com; s=arc-20160816; b=dggF7zhwion7eCKhmXEgZdGisjzXiiiuEnvWgBf4Lbbd4g4pcohe9Ydrv2NJynVQxU PQlJ693SsYHIksXVThx8XErjzAEokMskZ2zJQLzkgN+4SIs8xGZ5fIsxFURKm534EUPW I0P1kH9MyOXwJCRYpJVjjLgqSHoIXsKFhxuwfr/GXaDBS+zEbU7RdmYcZTJB1JGvYJWS tK4CYTH0jAeR2gEW+QlHZfR3R91UZCpI8yr8nvTCwb1dA59eKY74W6bm/6YPKRAecAel 7xzQKrLlmDb54TgJK6WqVrKFB4gALHtwTyWoI3MWz9Kdna+MgT0U0CAd7s0hnUPpvy2M ajSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6qXb3+hkNMLokNbmTsp+ObVF0F8sjhOp4GiAYlV6riw=; b=c1Zi5PnehA6os9bcHvsSae7R1vPbqN1yozmvK7z/TfseZcO/cWwfs0b9QJ4eawEbyX C+CTNqcUr8+voPOP94o/sQKzzKEZkJCTy1q4/sLFovFUA7ckUsI85+G2HUCwO6QXBZ6h w4kHxotCyBpLY/OM91nMxd4BEjeCpry5/HKXiC8ILCM8mLZJoE/K+/IoyUdUJO+Iunwc LRMIzgKwE8lrpqsgOHUKRFZJ8stAmfA6tMgzCqA1NqAoUFdTIwC+It1pzfqP2zbCGDwE fEBRvwYBLr8Rqfn5zVvIp++cfKcAoOWz31cdTLiZAFQ/id8FeiN41D6SQWbg6vYTUypg dl5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FapWINcp; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 36si13347333pld.289.2019.08.20.13.29.21; Tue, 20 Aug 2019 13:29:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FapWINcp; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728283AbfHTU3U (ORCPT + 99 others); Tue, 20 Aug 2019 16:29:20 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:43066 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730618AbfHTU3U (ORCPT ); Tue, 20 Aug 2019 16:29:20 -0400 Received: by mail-io1-f65.google.com with SMTP id 18so14950813ioe.10; Tue, 20 Aug 2019 13:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=6qXb3+hkNMLokNbmTsp+ObVF0F8sjhOp4GiAYlV6riw=; b=FapWINcpbfTZ7UsJb/RlukZqqcIV1FVnESoBlEBwGB7TFPLwfKoXQpusi9gIN9XWDs nRi28QbUJ++5GcrC524pDsRJCDrTPbAT1IWULg1ST6eiiyc050z7bkOCJgsvVGIuXhRp gM/w67h+FSQ3JXCI8YXx9eEZ0M7DPziQByz/zuShlA3BM4cBBDDAYlML3AvwZcIrjlDU uwUL0KClJRQ2OisKv1rqJwCppzUT+EO+c1J0AXaKSIHGSBCdEWHm/8AFWvxCPbgX70mz ziYmPdkDS3mYjqOUTgZNNOboIXjlx3BTXXtImkkshc6oZMzmlq3YEYSec18NU1zXoYJb Ew2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=6qXb3+hkNMLokNbmTsp+ObVF0F8sjhOp4GiAYlV6riw=; b=lfstOBpVRH5SEZRdV6abhJ/ve74avjjwq5azmUuE7NS83TPd0E01JO7Mjw9619Jg2T ktulOOrlGs3cjcpLhZICwU+zJp/D6oTDBc98M8khsyyF1SqK6bFqOk2MXbijOrCJZgTD kq5kDuBlcAhUwPAkeCCEZYSGwN/53ocmVrXXdjdchq/cIlxnimz6eXugleEoWcvgE+70 +Z7y6ZTlAb8JQjmLh4T1yC66SP9yxX+mDs54iylH6yMYzcgfFMsGYOel4+X6rfDSILFX 6heUBGmhe/Znieo2kw41igr2TxS+25CDvzdnnx/Mq52XdGuQ8UwBm/CPgjb79e2eVDQt azQg== X-Gm-Message-State: APjAAAWk8aRQaA5idD+fiWVYAjU6bWm/rewE9IniH+0Q7txh4L8gtSak JhGCk3mAMl7y6i6OrgG5arCP/qRpuUTv/2AtLvY= X-Received: by 2002:a5e:8e08:: with SMTP id a8mr17306812ion.94.1566332959424; Tue, 20 Aug 2019 13:29:19 -0700 (PDT) MIME-Version: 1.0 References: <20190820202402.24951-1-andrew.smirnov@gmail.com> <20190820202402.24951-14-andrew.smirnov@gmail.com> In-Reply-To: <20190820202402.24951-14-andrew.smirnov@gmail.com> From: Andrey Smirnov Date: Tue, 20 Aug 2019 13:29:07 -0700 Message-ID: Subject: Re: [PATCH v8 13/16] crypto: caam - select DMA address size at runtime To: =?UTF-8?Q?Horia_Geant=C4=83?= Cc: Chris Spencer , Cory Tusar , Chris Healy , Lucas Stach , Aymen Sghaier , Leonard Crestez , linux-kernel , linux-crypto@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Aug 20, 2019 at 1:24 PM Andrey Smirnov w= rote: > > i.MX8 mScale SoC still use 32-bit addresses in its CAAM implmentation, > so we can't rely on sizeof(dma_addr_t) to detemine CAAM pointer > size. Convert the code to query CTPR and MCFGR for that during driver > probing. > > Signed-off-by: Andrey Smirnov > Cc: Chris Spencer > Cc: Cory Tusar > Cc: Chris Healy > Cc: Lucas Stach > Cc: Horia Geant=C4=83 > Cc: Aymen Sghaier > Cc: Leonard Crestez > Cc: linux-crypto@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/crypto/caam/caampkc.c | 8 +++---- > drivers/crypto/caam/ctrl.c | 5 +++- > drivers/crypto/caam/desc_constr.h | 10 ++++++-- > drivers/crypto/caam/intern.h | 2 +- > drivers/crypto/caam/pdb.h | 16 +++++++++---- > drivers/crypto/caam/pkc_desc.c | 8 +++---- > drivers/crypto/caam/regs.h | 40 +++++++++++++++++++++++-------- > 7 files changed, 63 insertions(+), 26 deletions(-) > > diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.= c > index 5b12b232ee5e..83f96d4f86e0 100644 > --- a/drivers/crypto/caam/caampkc.c > +++ b/drivers/crypto/caam/caampkc.c > @@ -17,13 +17,13 @@ > #include "sg_sw_sec4.h" > #include "caampkc.h" > > -#define DESC_RSA_PUB_LEN (2 * CAAM_CMD_SZ + sizeof(struct rsa_pub_= pdb)) > +#define DESC_RSA_PUB_LEN (2 * CAAM_CMD_SZ + SIZEOF_RSA_PUB_PDB) > #define DESC_RSA_PRIV_F1_LEN (2 * CAAM_CMD_SZ + \ > - sizeof(struct rsa_priv_f1_pdb)) > + SIZEOF_RSA_PRIV_F1_PDB) > #define DESC_RSA_PRIV_F2_LEN (2 * CAAM_CMD_SZ + \ > - sizeof(struct rsa_priv_f2_pdb)) > + SIZEOF_RSA_PRIV_F2_PDB) > #define DESC_RSA_PRIV_F3_LEN (2 * CAAM_CMD_SZ + \ > - sizeof(struct rsa_priv_f3_pdb)) > + SIZEOF_RSA_PRIV_F3_PDB) > #define CAAM_RSA_MAX_INPUT_SIZE 512 /* for a 4096-bit modulus */ > > /* buffer filled with zeros, used for padding */ > diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c > index 47b92451756f..4b7f95f64e34 100644 > --- a/drivers/crypto/caam/ctrl.c > +++ b/drivers/crypto/caam/ctrl.c > @@ -602,7 +602,10 @@ static int caam_probe(struct platform_device *pdev) > caam_imx =3D (bool)imx_soc_match; > > comp_params =3D rd_reg32(&ctrl->perfmon.comp_parms_ms); > - caam_ptr_sz =3D sizeof(dma_addr_t); > + if (comp_params & CTPR_MS_PS && rd_reg32(&ctrl->mcr) & MCFGR_LONG= _PTR) Horia: As I previously mentioned, i.MX8MQ SRM I have doesn't document MCFGR bits related to this. If you don't mind, please double check that using MCFGR_LONG_PTR here is correct. Thanks, Andrey Smirnov