From patchwork Fri Mar 15 04:05:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vakul Garg X-Patchwork-Id: 10854045 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FBCA139A for ; Fri, 15 Mar 2019 04:05:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC8542A691 for ; Fri, 15 Mar 2019 04:05:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E05F62A80C; Fri, 15 Mar 2019 04:05:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83FEF2A691 for ; Fri, 15 Mar 2019 04:05:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726315AbfCOEFZ (ORCPT ); Fri, 15 Mar 2019 00:05:25 -0400 Received: from mail-eopbgr50078.outbound.protection.outlook.com ([40.107.5.78]:60967 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726462AbfCOEFZ (ORCPT ); Fri, 15 Mar 2019 00:05:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hoxQFvkovbFLnOx+pEOrNNXr3MVtH2gZkYBR3yIDBgY=; b=NPBVWQr1XriyJA2oVrA8kIUu+lwaYq9AaA4eUZPV6SvPJuat4S41SPWIvxC5y3TBlM2I8ZTltioCqplOp8WxwO2HUnfx+aBol5LxaXvxuPSZ58Qy3/oZZShCIoX4Ak8siY5Spyk+Zgt5hghM2gz47PCuc6FYqZvlPnQgzx9+Di8= Received: from DB7PR04MB4252.eurprd04.prod.outlook.com (52.135.131.26) by DB7PR04MB4716.eurprd04.prod.outlook.com (20.176.233.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Fri, 15 Mar 2019 04:05:22 +0000 Received: from DB7PR04MB4252.eurprd04.prod.outlook.com ([fe80::9ca:d78:c154:25b5]) by DB7PR04MB4252.eurprd04.prod.outlook.com ([fe80::9ca:d78:c154:25b5%4]) with mapi id 15.20.1709.011; Fri, 15 Mar 2019 04:05:22 +0000 From: Vakul Garg To: "linux-crypto@vger.kernel.org" , "herbert@gondor.apana.org.au" CC: Horia Geanta , Aymen Sghaier , Vakul Garg Subject: [PATCH 1/3] crypto: caam/jr - Remove spinlock for output job ring Thread-Topic: [PATCH 1/3] crypto: caam/jr - Remove spinlock for output job ring Thread-Index: AQHU2uRPul9h7cTAM0qkye+2AiaphQ== Date: Fri, 15 Mar 2019 04:05:22 +0000 Message-ID: <20190315040239.24705-2-vakul.garg@nxp.com> References: <20190315040239.24705-1-vakul.garg@nxp.com> In-Reply-To: <20190315040239.24705-1-vakul.garg@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BMXPR01CA0037.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::23) To DB7PR04MB4252.eurprd04.prod.outlook.com (2603:10a6:5:27::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vakul.garg@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.13.6 x-originating-ip: [92.120.1.70] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0c40b78c-64db-43fc-1d77-08d6a8fb723c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:DB7PR04MB4716; x-ms-traffictypediagnostic: DB7PR04MB4716: x-microsoft-antispam-prvs: x-forefront-prvs: 09778E995A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(136003)(366004)(346002)(396003)(199004)(189003)(97736004)(8676002)(105586002)(476003)(36756003)(44832011)(71190400001)(2616005)(52116002)(316002)(386003)(76176011)(4326008)(106356001)(486006)(110136005)(54906003)(71200400001)(102836004)(6506007)(25786009)(81156014)(81166006)(478600001)(7736002)(2906002)(14454004)(66066001)(2501003)(68736007)(14444005)(256004)(1076003)(99286004)(6116002)(53936002)(5660300002)(11346002)(305945005)(86362001)(8936002)(186003)(50226002)(6512007)(6436002)(3846002)(446003)(26005)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4716;H:DB7PR04MB4252.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: r34/GZ8dyPiaXLkvO6iVtZCzaBqRzg+UAUn3KazX064FBUIVGDKIfQ35WJPXqAwL6Yq/PtE2x9RBknSd+GmYngJmCimnUGOiDBVltjsR0l0fPzbzaqKOjTb6HO1bpYdRXk2m+xri9r03IkWIySnEKMx1oTx6NGVgcQcTQtBpcxoZvFFdlC9VsGuodvs2e5s+9nn4KhJQYQmgkkfsD2xqGPqgSFzat1wka7eYgrgAnRJcZ1v8L2A4fl9R+Mv8bMyEmUxPl1iyVb4YHp9tXm+A6SgH2IXHke05cK+fKo4ajtuLcxsZHEO/zeybw5OZ2PB8MzkR3vfjLExWPu12xWGbeE4CdEAFCIcmT4Z/Thr638DJs6KzcXDcZ74dbGLrTWQ2cA61eA8dP40GZhxzd8YK6NDCZZCRqEMyi7VCTXXdlww= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c40b78c-64db-43fc-1d77-08d6a8fb723c X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2019 04:05:22.9336 (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-Transport-CrossTenantHeadersStamped: DB7PR04MB4716 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For each job ring pair, the output ring is processed exactly by one cpu at a time under a tasklet context (one per ring). Therefore, there is no need to protect a job ring's access & its private data structure using a lock. Hence the lock can be removed. Signed-off-by: Vakul Garg --- drivers/crypto/caam/intern.h | 1 - drivers/crypto/caam/jr.c | 5 ----- 2 files changed, 6 deletions(-) diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h index 30d5b6c5892f..48d62e020599 100644 --- a/drivers/crypto/caam/intern.h +++ b/drivers/crypto/caam/intern.h @@ -56,7 +56,6 @@ struct caam_drv_private_jr { u32 inpring_avail; /* Number of free entries in input ring */ int head; /* entinfo (s/w ring) head index */ dma_addr_t *inpring; /* Base of input ring, alloc DMA-safe */ - spinlock_t outlock ____cacheline_aligned; /* Output ring index lock */ int out_ring_read_index; /* Output index "tail" */ int tail; /* entinfo (s/w ring) tail index */ struct jr_outentry *outring; /* Base of output ring, DMA-safe */ diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index b9caa95755d1..89de7297d099 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -177,8 +177,6 @@ static void caam_jr_dequeue(unsigned long devarg) head = READ_ONCE(jrp->head); - spin_lock(&jrp->outlock); - sw_idx = tail = jrp->tail; hw_idx = jrp->out_ring_read_index; @@ -234,8 +232,6 @@ static void caam_jr_dequeue(unsigned long devarg) jrp->tail = tail; } - spin_unlock(&jrp->outlock); - /* Finally, execute user's callback */ usercall(dev, userdesc, userstatus, userarg); outring_used--; @@ -452,7 +448,6 @@ static int caam_jr_init(struct device *dev) jrp->inpring_avail = JOBR_DEPTH; spin_lock_init(&jrp->inplock); - spin_lock_init(&jrp->outlock); /* Select interrupt coalescing parameters */ clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JOBR_INTC | From patchwork Fri Mar 15 04:05:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vakul Garg X-Patchwork-Id: 10854047 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C0CE139A for ; Fri, 15 Mar 2019 04:05:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 345942A691 for ; Fri, 15 Mar 2019 04:05:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 284E12A80C; Fri, 15 Mar 2019 04:05:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDAC42A691 for ; Fri, 15 Mar 2019 04:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726462AbfCOEF2 (ORCPT ); Fri, 15 Mar 2019 00:05:28 -0400 Received: from mail-eopbgr50078.outbound.protection.outlook.com ([40.107.5.78]:60967 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726493AbfCOEF2 (ORCPT ); Fri, 15 Mar 2019 00:05:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PnKdr36yzArkIYrIxiRZtmx0p8ItthHxRxhkRs2c+hY=; b=IF8Va/1MgSMv+123Vq5NegX70XTvA00FTRrudgtglEnXS+yT7U8ougRttFT/CMDpMPT2a+f8b98fZE0d8RpC+Y4gCIiUhVgsGDqs9Wf9Or2iTcX8ieSUTcBd4nETI1vhSDYyA6I/PgncHF34mnQ/rb9skufg6jb5AVtiSppbaNg= Received: from DB7PR04MB4252.eurprd04.prod.outlook.com (52.135.131.26) by DB7PR04MB4716.eurprd04.prod.outlook.com (20.176.233.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Fri, 15 Mar 2019 04:05:24 +0000 Received: from DB7PR04MB4252.eurprd04.prod.outlook.com ([fe80::9ca:d78:c154:25b5]) by DB7PR04MB4252.eurprd04.prod.outlook.com ([fe80::9ca:d78:c154:25b5%4]) with mapi id 15.20.1709.011; Fri, 15 Mar 2019 04:05:24 +0000 From: Vakul Garg To: "linux-crypto@vger.kernel.org" , "herbert@gondor.apana.org.au" CC: Horia Geanta , Aymen Sghaier , Vakul Garg Subject: [PATCH 2/3] crypto: caam/jr - Remove redundant vars from job ring private data Thread-Topic: [PATCH 2/3] crypto: caam/jr - Remove redundant vars from job ring private data Thread-Index: AQHU2uRQPQjC6sa45keuXp3BdD5hjw== Date: Fri, 15 Mar 2019 04:05:24 +0000 Message-ID: <20190315040239.24705-3-vakul.garg@nxp.com> References: <20190315040239.24705-1-vakul.garg@nxp.com> In-Reply-To: <20190315040239.24705-1-vakul.garg@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BMXPR01CA0037.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::23) To DB7PR04MB4252.eurprd04.prod.outlook.com (2603:10a6:5:27::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vakul.garg@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.13.6 x-originating-ip: [92.120.1.70] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 973d9df7-740a-4dc2-0961-08d6a8fb731d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:DB7PR04MB4716; x-ms-traffictypediagnostic: DB7PR04MB4716: x-microsoft-antispam-prvs: x-forefront-prvs: 09778E995A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(136003)(366004)(346002)(396003)(199004)(189003)(97736004)(8676002)(105586002)(476003)(36756003)(44832011)(71190400001)(2616005)(52116002)(316002)(386003)(76176011)(4326008)(106356001)(486006)(110136005)(54906003)(71200400001)(102836004)(6506007)(25786009)(81156014)(81166006)(478600001)(7736002)(2906002)(14454004)(66066001)(2501003)(68736007)(14444005)(256004)(1076003)(99286004)(6116002)(53936002)(5660300002)(11346002)(305945005)(86362001)(8936002)(186003)(50226002)(6512007)(6436002)(3846002)(446003)(26005)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4716;H:DB7PR04MB4252.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: YxOB8tK2+gEVK8vwXSFGhBbeSLLAHvXun5gu1DmTNjhX04pEDXauxZlzYA3myuTQ3/toV905gflw3ldt9NVMF2zwXvOK1/owdth12RDfy7RpxKiLOv2XYfv/ZRb8rJxscGcqxEKGi6DhnGW+YNKkQjWEf4Eu21iBfJxIHCG9VNHung7qtnImvaalMmgOvUxhAJ1xc7kLmqkLlY7eROmf1ep356JA5VdDeoDlNh8kWMbr3Zm1b3gFIfp9EC/IZXumYoRsHlxzctTtGt2Y5C7wpg5di3A0txyU2GRLMTiqprRdQ8TKtATEJUOYNUnn2ahWO8Rg10zJYCHd3HQ0UJk66d3JzjJMZWcJOR/oxeBAT3YesL1yqQ/1bvTdGkOtfAJFq+XhOC8FcRzIjPGrzJzfU2qqXiIvOr/i4TnboeBysOY= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 973d9df7-740a-4dc2-0961-08d6a8fb731d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2019 04:05:24.3806 (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-Transport-CrossTenantHeadersStamped: DB7PR04MB4716 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For each job ring, the variable 'ringsize' is initialised but never used. Similarly variables 'inp_ring_read_index' and 'head' always track the same value and instead of 'inp_ring_read_index', caam_jr_enqueue() can use 'head' itself. Both these variables have been removed. Signed-off-by: Vakul Garg --- drivers/crypto/caam/intern.h | 2 -- drivers/crypto/caam/jr.c | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h index 48d62e020599..3392615dc91b 100644 --- a/drivers/crypto/caam/intern.h +++ b/drivers/crypto/caam/intern.h @@ -49,10 +49,8 @@ struct caam_drv_private_jr { atomic_t tfm_count ____cacheline_aligned; /* Job ring info */ - int ringsize; /* Size of rings (assume input = output) */ struct caam_jrentry_info *entinfo; /* Alloc'ed 1 per ring entry */ spinlock_t inplock ____cacheline_aligned; /* Input ring index lock */ - int inp_ring_write_index; /* Input index "tail" */ u32 inpring_avail; /* Number of free entries in input ring */ int head; /* entinfo (s/w ring) head index */ dma_addr_t *inpring; /* Base of input ring, alloc DMA-safe */ diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 89de7297d099..02f02fa996da 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -358,7 +358,7 @@ int caam_jr_enqueue(struct device *dev, u32 *desc, head_entry->cbkarg = areq; head_entry->desc_addr_dma = desc_dma; - jrp->inpring[jrp->inp_ring_write_index] = cpu_to_caam_dma(desc_dma); + jrp->inpring[head] = cpu_to_caam_dma(desc_dma); /* * Guarantee that the descriptor's DMA address has been written to @@ -367,8 +367,6 @@ int caam_jr_enqueue(struct device *dev, u32 *desc, */ smp_wmb(); - jrp->inp_ring_write_index = (jrp->inp_ring_write_index + 1) & - (JOBR_DEPTH - 1); jrp->head = (head + 1) & (JOBR_DEPTH - 1); /* @@ -434,7 +432,6 @@ static int caam_jr_init(struct device *dev) jrp->entinfo[i].desc_addr_dma = !0; /* Setup rings */ - jrp->inp_ring_write_index = 0; jrp->out_ring_read_index = 0; jrp->head = 0; jrp->tail = 0; @@ -444,7 +441,6 @@ static int caam_jr_init(struct device *dev) wr_reg32(&jrp->rregs->inpring_size, JOBR_DEPTH); wr_reg32(&jrp->rregs->outring_size, JOBR_DEPTH); - jrp->ringsize = JOBR_DEPTH; jrp->inpring_avail = JOBR_DEPTH; spin_lock_init(&jrp->inplock); From patchwork Fri Mar 15 04:05:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vakul Garg X-Patchwork-Id: 10854049 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B383F1669 for ; Fri, 15 Mar 2019 04:05:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D45B2A691 for ; Fri, 15 Mar 2019 04:05:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9191A2A80C; Fri, 15 Mar 2019 04:05:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 160902A691 for ; Fri, 15 Mar 2019 04:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbfCOEFb (ORCPT ); Fri, 15 Mar 2019 00:05:31 -0400 Received: from mail-eopbgr50078.outbound.protection.outlook.com ([40.107.5.78]:60967 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726493AbfCOEFb (ORCPT ); Fri, 15 Mar 2019 00:05:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TYrYr1gB2L4p5DUFLqv8O9tswBEihjFm1LuIikvCmP0=; b=o1iFBcIyiRjC5REZ3iRmOFPeXfCV/luohMQXsZOCW2Kn7TtBfQ0YNiXtmRt88jhgqyibWQZq13oR0kXhiDT+IEffZJMQG4mto0AA65QYx2i2zTX1yMp57qLldqjzG0Psx7bMylrx/xkdVMzbVeN6V2HRrkLlgGpCqLmgpexI7L4= Received: from DB7PR04MB4252.eurprd04.prod.outlook.com (52.135.131.26) by DB7PR04MB4716.eurprd04.prod.outlook.com (20.176.233.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Fri, 15 Mar 2019 04:05:25 +0000 Received: from DB7PR04MB4252.eurprd04.prod.outlook.com ([fe80::9ca:d78:c154:25b5]) by DB7PR04MB4252.eurprd04.prod.outlook.com ([fe80::9ca:d78:c154:25b5%4]) with mapi id 15.20.1709.011; Fri, 15 Mar 2019 04:05:25 +0000 From: Vakul Garg To: "linux-crypto@vger.kernel.org" , "herbert@gondor.apana.org.au" CC: Horia Geanta , Aymen Sghaier , Vakul Garg Subject: [PATCH 3/3] crypto: caam/jr - Remove extra memory barrier during job ring enqueue Thread-Topic: [PATCH 3/3] crypto: caam/jr - Remove extra memory barrier during job ring enqueue Thread-Index: AQHU2uRRR0cYYITjQEyV02QNgFhbdA== Date: Fri, 15 Mar 2019 04:05:25 +0000 Message-ID: <20190315040239.24705-4-vakul.garg@nxp.com> References: <20190315040239.24705-1-vakul.garg@nxp.com> In-Reply-To: <20190315040239.24705-1-vakul.garg@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BMXPR01CA0037.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::23) To DB7PR04MB4252.eurprd04.prod.outlook.com (2603:10a6:5:27::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vakul.garg@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.13.6 x-originating-ip: [92.120.1.70] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5f5d0390-66ff-44ce-d5e6-08d6a8fb73f9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:DB7PR04MB4716; x-ms-traffictypediagnostic: DB7PR04MB4716: x-microsoft-antispam-prvs: x-forefront-prvs: 09778E995A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(136003)(366004)(346002)(396003)(199004)(189003)(97736004)(8676002)(105586002)(476003)(36756003)(44832011)(71190400001)(2616005)(52116002)(316002)(386003)(76176011)(4326008)(106356001)(486006)(110136005)(54906003)(71200400001)(102836004)(6506007)(25786009)(81156014)(81166006)(478600001)(7736002)(2906002)(14454004)(66066001)(2501003)(68736007)(14444005)(256004)(1076003)(99286004)(6116002)(53936002)(5660300002)(11346002)(305945005)(86362001)(8936002)(186003)(50226002)(6512007)(6436002)(3846002)(446003)(26005)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4716;H:DB7PR04MB4252.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: dgQVl3a91V4vuPRNlOkSJWcBR0crOFet4AnPY9Ha21WOEAHECR0dTGOMUKMcPVGX6U/JNbVeR8j6HxudLvgcc7cGtBZqqmroS5VJFhDLhUrZz7ED2hwZTLzTJghI2JXuGe4Es72FbwGyNFRqFqZkHF5aNSVht3qq/s9XzJ6mUsGvWOEtx7EUKV0HJUao48IlxJdLSsBDqbe4cMW70wzhlyi2FKTHcEldGRb12wtPT4ywjkxsr3zt709pkqzHdpE/i+m5ImKNPW24qU4/5CBUGjzZOOkux78x8PRoGLLQOSbGOrYIhJ8BEkQUwrFD9QFLXjn7wmW55cOaiy1X705cCq99wWdAS+GdTD6HBauJFoxy/YixoKLDD6EA7q6sgkvXKG8Im2Po349rkdWEwm04eeDG0ZJA2JLutmNKrZplRb8= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f5d0390-66ff-44ce-d5e6-08d6a8fb73f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2019 04:05:25.9057 (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-Transport-CrossTenantHeadersStamped: DB7PR04MB4716 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In caam_jr_enqueue(), a write barrier is needed to order stores to job ring slot before declaring addition of new job into input job ring. The register write is done using wr_reg32() which internally uses iowrite32() for write operation. The api iowrite32() issues a write barrier before issuing write operation. Therefore, the wmb() preceding wr_reg32() can be safely removed. Signed-off-by: Vakul Garg --- drivers/crypto/caam/jr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 02f02fa996da..3bd28386eb07 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -371,9 +371,11 @@ int caam_jr_enqueue(struct device *dev, u32 *desc, /* * Ensure that all job information has been written before - * notifying CAAM that a new job was added to the input ring. + * notifying CAAM that a new job was added to the input ring + * using a memory barrier. The wr_reg32() uses api iowrite32() + * to do the register write. iowrite32() issues a memory barrier + * before the write operation. */ - wmb(); wr_reg32(&jrp->rregs->inpring_jobadd, 1);