Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3429861ybi; Fri, 19 Jul 2019 03:09:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGWTWyRNjJR2MWZokv/hFfWFTZ6fxIB+bUoWXJoRdTxBeava/0PH2DdA4BNA0UqNSuY635 X-Received: by 2002:a17:90a:26ef:: with SMTP id m102mr56155401pje.50.1563530980459; Fri, 19 Jul 2019 03:09:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563530980; cv=pass; d=google.com; s=arc-20160816; b=FDLAxL7Tu701hP/S8aGibf81a+0W2UEXI95FcDLPyzZqOrRH8YJStvjEC1/Jp29/WT H14NewhC9zFko45/cum69qUkkRZpu4toZPKHtmqu6yIqZf98CQZZ8pV77uGN0/qTbDO3 L5ypUutj+cRzH6fyKMr5bvhcaPGZOgqTeNSqWjHYLLo8poOGeFJ3BkURTJ9EIbQZu3qs lx9JWkVBxCtIkdnBQ8l1p2jDfkoTPnLxGOIRBo3QxIyTx7NNDxEhRAifHDm/CZMTfOGX vG5MOz2Hvhl9OoBSEQO0EjaeV7qGe33cqjMEwzPYUx9mEgrQU6vAo4aJUI2cGQZnPa6K JtwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=jFXReoj9qkBzR0qlZe4HPyQSGnt+PAUVIRSj9fzhf/U=; b=uHcoGqm6vj5ymQjkUr/IbCKSswJkmJ+iH6q1hpEfR2v26HXBjNPg5hwyUntlfBQFbI pLKHAbNbKsls3jKG1avP2wwZDrMzWUC7W6UGrB44o3ClLy4x3sgtMAHd46Ps0g2idXFI igAaJLel6IbRlvGtj+KmM1SPaEFT30tANvYrAjii+e1zekR2hy5BuaUd2VDuEGbb+6Z5 0ydV03V6gEeVi7mgtn4DVZMCUlgfujXVAhlY2iA0tIYTu19kPaQkhfjmWRKgcFscdSri 4HVPPbMI9hojwBrLDqAMVZdETULTqt3d7cLp4VDvq4jCH9ot6A6iP+QoNWkQkiPEfE0L t15Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=TEKSvzQG; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si2104107pfd.259.2019.07.19.03.09.19; Fri, 19 Jul 2019 03:09:40 -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=@nxp.com header.s=selector2 header.b=TEKSvzQG; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbfGSKIh (ORCPT + 99 others); Fri, 19 Jul 2019 06:08:37 -0400 Received: from mail-eopbgr20065.outbound.protection.outlook.com ([40.107.2.65]:64067 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725794AbfGSKIh (ORCPT ); Fri, 19 Jul 2019 06:08:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CcU10ifY89d1sgEu08MHlYDAXLSLXqtvLURX/UHjhdnozZ0/6yf0G9hozb85NHhO27KLsGB/ukqbaBgOwzJr/lGF3cgzHukxVIlMxlsGiqTVcx4DWirxzAa4HsQlU52E8PqXmmT3LJ+1qZ0/MC7KDM8alZSqc0wU1pTN3gSBiQVU9l9V29JrYt7JOrTNCLxjb4GOVp+DF2fYkL3yZa0kPiOCCECOCbgcVSAHqNCDRwrditriJgc3q9M91bo8uLt7OgGW9Zpke5FlOJIwMwvjcUJpv9IeiTZ7UaBh8pb1boB7ghQbuCBlZaWziXdSEcdmmZXQgKdiUrvAm2OX9ynVhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jFXReoj9qkBzR0qlZe4HPyQSGnt+PAUVIRSj9fzhf/U=; b=VjnsbvebQi3RRfe1eLmL6fg1XlCjsKDnIHcwgqJffiv3LSuJppZjEdV+HJurGYb3Pf9gRNng3vyTFVawmzczy8Yoesh0dGlWpJPu1I67+PKUQYp4M1UAMOBWipW5zXqeG4Pwt7OsTFfEI4EUJXWE4xLDKYAaJLn9kl2ZsvXv4c9qbEJK7CoqE/fC3UAkHNlrtr6rJsDXje/j2LZ7eMk/ptfR3EkvYKtx2ITj4tw60QIV6b1bwJBGh0goMJCJmIJ+QRT3th/OFuapm5pYzGCcwN3o54u10vMtQQot14mtycj+z4DL1QN47t9wIMgH3tYpMTk15FoccWFLbMl0cVXjNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=nxp.com;dmarc=pass action=none header.from=nxp.com;dkim=pass header.d=nxp.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jFXReoj9qkBzR0qlZe4HPyQSGnt+PAUVIRSj9fzhf/U=; b=TEKSvzQG6ANDelBrFscNR3rJuKAL159czXEDhe8y6vMvgp8NNNg74q6ZMKrfKBhM4tTtXKfiOqtWlTbCyBeyfvh2DTsyAMPiv9pOMFeegtzsj3qDRseziTYEMvYSSn9gI6zNNcRTGbi5pBMczsz4nDUKuj7K/xZCXQgmdiefCnA= Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com (52.134.3.153) by VI1PR0402MB3438.eurprd04.prod.outlook.com (52.134.3.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Fri, 19 Jul 2019 10:08:32 +0000 Received: from VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::7c64:5296:4607:e10]) by VI1PR0402MB3485.eurprd04.prod.outlook.com ([fe80::7c64:5296:4607:e10%5]) with mapi id 15.20.2073.012; Fri, 19 Jul 2019 10:08:32 +0000 From: Horia Geanta To: Iuliana Prodan , Herbert Xu , Aymen Sghaier CC: "David S. Miller" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: Re: [PATCH v2 09/14] crypto: caam - keep both virtual and dma key addresses Thread-Topic: [PATCH v2 09/14] crypto: caam - keep both virtual and dma key addresses Thread-Index: AQHVPcSrL0fOkGV3mUijL9yeORi/pQ== Date: Fri, 19 Jul 2019 10:08:32 +0000 Message-ID: References: <1563494276-3993-1-git-send-email-iuliana.prodan@nxp.com> <1563494276-3993-10-git-send-email-iuliana.prodan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=horia.geanta@nxp.com; x-originating-ip: [212.146.100.6] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8752321e-6cd3-486d-8abe-08d70c310e4d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:VI1PR0402MB3438; x-ms-traffictypediagnostic: VI1PR0402MB3438: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 01039C93E4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(366004)(396003)(346002)(39860400002)(189003)(199004)(66556008)(305945005)(44832011)(25786009)(256004)(476003)(6246003)(68736007)(66946007)(486006)(66066001)(7736002)(66476007)(64756008)(6636002)(14444005)(99286004)(76176011)(6116002)(7696005)(66446008)(229853002)(3846002)(33656002)(52536014)(2906002)(4326008)(446003)(53546011)(5660300002)(6506007)(76116006)(26005)(102836004)(186003)(71200400001)(71190400001)(86362001)(53936002)(14454004)(8676002)(81156014)(81166006)(8936002)(478600001)(55016002)(9686003)(6436002)(316002)(91956017)(74316002)(54906003)(110136005);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB3438;H:VI1PR0402MB3485.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ZvX81TijFiW+FoSYZpMacM/nD0LqussgjA0lqOuS4gskVyvYQUwqrcovdTkhd5gIfw50mOMUku/bkdEo6qCSKM4E+2l0AIAQeLohQbVtnq/BJUBqnfT9T2VSfajQetb83ebc7izxlomevMv3AmZv9E4dKmXwCYFNsaO0O1e+Q520LT64+PCTii9CIvoRIdY65xYVOPpyp0I5HKFyqbb20B6uO1npFlqCnFZgIOam+gR36i9UvrcEaDK6nv8JZKnp202wPMYI5+JjybgEg6PXM/bhWaLSJ0YfrGMP3Ds6tX4FwxygJ1UZ5YsBCQF1eWHl/Mtjwf7M4aCCKWf2cj4svPW8/C3a4N60sD0ahRcQX93gQRJkkkLXyEGvHzK185ENBcJJyltS3fgKyFJOG3TlYfaM+eACUgXMtuGVksi+oTA= Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8752321e-6cd3-486d-8abe-08d70c310e4d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2019 10:08:32.8038 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: horia.geanta@nxp.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3438 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 7/19/2019 2:58 AM, Iuliana Prodan wrote:=0A= > From: Horia Geant=E3 =0A= > =0A= > Update alginfo struct to keep both virtual and dma key addresses,=0A= > so that descriptors have them at hand.=0A= > One example where this is needed is in the xcbc(aes) shared descriptors,= =0A= > which are updated in current patch.=0A= > Another example is the upcoming fix for DKP.=0A= > =0A= > Signed-off-by: Horia Geant=E3 =0A= > ---=0A= > drivers/crypto/caam/caamhash.c | 26 ++++++++++++--------------=0A= > drivers/crypto/caam/caamhash_desc.c | 5 ++---=0A= > drivers/crypto/caam/caamhash_desc.h | 2 +-=0A= > drivers/crypto/caam/desc_constr.h | 10 ++++------=0A= > 4 files changed, 19 insertions(+), 24 deletions(-)=0A= > =0A= > diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhas= h.c=0A= > index 2ec4bad..14fdfa1 100644=0A= > --- a/drivers/crypto/caam/caamhash.c=0A= > +++ b/drivers/crypto/caam/caamhash.c=0A= [...]=0A= > @@ -508,6 +502,10 @@ static int axcbc_setkey(struct crypto_ahash *ahash, = const u8 *key,=0A= > memcpy(ctx->key, key, keylen);=0A= > dma_sync_single_for_device(jrdev, ctx->key_dma, keylen, DMA_TO_DEVICE);= =0A= > ctx->adata.keylen =3D keylen;=0A= > + /* key is loaded from memory for UPDATE and FINALIZE states */=0A= > + ctx->adata.key_dma =3D ctx->key_dma;=0A= > + /* key is immediate data for INIT and INITFINAL states */=0A= > + ctx->adata.key_virt =3D ctx->key;=0A= > =0A= Now that it's possible to store both virtual and dma key addresses,=0A= it would be more efficient to move these assignments .cra_init callback.=0A= =0A= I'll submit the changes in v3.=0A= =0A= Horia=0A= =0A= [...]=0A= > diff --git a/drivers/crypto/caam/desc_constr.h b/drivers/crypto/caam/desc= _constr.h=0A= > index 5988a26..8154174 100644=0A= > --- a/drivers/crypto/caam/desc_constr.h=0A= > +++ b/drivers/crypto/caam/desc_constr.h=0A= > @@ -457,8 +457,8 @@ do { \=0A= > * functions where it is used.=0A= > * @keylen: length of the provided algorithm key, in bytes=0A= > * @keylen_pad: padded length of the provided algorithm key, in bytes=0A= > - * @key: address where algorithm key resides; virtual address if key_inl= ine=0A= > - * is true, dma (bus) address if key_inline is false.=0A= > + * @key_dma: dma (bus) address where algorithm key resides=0A= > + * @key_virt: virtual address where algorithm key resides=0A= > * @key_inline: true - key can be inlined in the descriptor; false - key= is=0A= > * referenced by the descriptor=0A= > */=0A= > @@ -466,10 +466,8 @@ struct alginfo {=0A= > u32 algtype;=0A= > unsigned int keylen;=0A= > unsigned int keylen_pad;=0A= > - union {=0A= > - dma_addr_t key_dma;=0A= > - const void *key_virt;=0A= > - };=0A= > + dma_addr_t key_dma;=0A= > + const void *key_virt;=0A= > bool key_inline;=0A= > };=0A= > =0A= > =0A=