From patchwork Fri Mar 15 11:25:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vakul Garg X-Patchwork-Id: 10854575 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 F1B7C15AC for ; Fri, 15 Mar 2019 11:25:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA89A2899F for ; Fri, 15 Mar 2019 11:25:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE8242A6B4; Fri, 15 Mar 2019 11:25:28 +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 BA34B2A851 for ; Fri, 15 Mar 2019 11:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728251AbfCOLZ1 (ORCPT ); Fri, 15 Mar 2019 07:25:27 -0400 Received: from mail-eopbgr70058.outbound.protection.outlook.com ([40.107.7.58]:49846 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726785AbfCOLZ0 (ORCPT ); Fri, 15 Mar 2019 07:25:26 -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=Yyt8s5XyDG0XUfGrtaMNPtS4EDbc/BqXv2MOgpuC4oQ=; b=sKNMut3fVlkM7VuZ+QYLbbAmc7Cpf1hZxH9fZtCqd4jsMR26a2HZzzTGEkqfcCQmMWOt3elL2MidAjqyL9RmQba4xQZ9t/L3BI1k5sppQJ+syQdTn9+Iub5KeGvgE4mquXXrz2HtWTZjG7Lz0/NwpjShpxSsBU+r/973ombyXhk= Received: from DB7PR04MB4252.eurprd04.prod.outlook.com (52.135.131.26) by DB7PR04MB4428.eurprd04.prod.outlook.com (52.135.137.154) 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 11:25:21 +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 11:25:21 +0000 From: Vakul Garg To: "linux-crypto@vger.kernel.org" , "herbert@gondor.apana.org.au" CC: Horia Geanta , Aymen Sghaier , Vakul Garg Subject: [PATCH v2 1/3] crypto: caam/jr - Remove spinlock for output job ring Thread-Topic: [PATCH v2 1/3] crypto: caam/jr - Remove spinlock for output job ring Thread-Index: AQHU2yHG2bCJl1Eqok6nb1aTIie/TQ== Date: Fri, 15 Mar 2019 11:25:21 +0000 Message-ID: <20190315112238.24337-2-vakul.garg@nxp.com> References: <20190315112238.24337-1-vakul.garg@nxp.com> In-Reply-To: <20190315112238.24337-1-vakul.garg@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0018.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::28) 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: f99a3f97-8f1d-4d29-1d2b-08d6a938e90d 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:DB7PR04MB4428; x-ms-traffictypediagnostic: DB7PR04MB4428: x-microsoft-antispam-prvs: x-forefront-prvs: 09778E995A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(346002)(366004)(376002)(39860400002)(199004)(189003)(6436002)(6486002)(8676002)(316002)(8936002)(81156014)(81166006)(2906002)(50226002)(66066001)(2501003)(86362001)(6512007)(486006)(1076003)(256004)(14444005)(2616005)(14454004)(11346002)(476003)(25786009)(44832011)(71190400001)(71200400001)(99286004)(76176011)(4326008)(36756003)(68736007)(478600001)(105586002)(52116002)(446003)(53936002)(97736004)(186003)(6506007)(54906003)(386003)(110136005)(26005)(102836004)(6116002)(305945005)(7736002)(5660300002)(3846002)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4428;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: 7s6r6C0pYvPmd8J1udaJmYWo/frHnqSI5Pxt4lxerERZHgEwQQUYOxKGoDIyGt89mjSboJBn0URq0slMtniCiGgImVPWQMJurntQ/ZhbXJSgPc4hGfQQJeSoH1bxP+Vquv24Z9Dj+QdgpQzV3PtGIafrfoqH4t4CKAphPJMoHMebPegI2u4VjJ07I7txiLKMKU4kLmWfDudAhSyOOcJxfPdTBGgAw/DXr2h8E2zjoE7YJ0vJkGp0BrRzSJqY3DZpUvpRxOp57PFO/0tqPF1g1grSFNxkPPMt4Iud/4rb5IEnmxAIm+/n8dCKWapf5yLDMw/Ze5gvVsrxS8iKzwvQ+WGCcJUH+AQqgNtgjQbO6B6PysPK1DRxMm0BvEWmGHAswiWbDWq6Rs7A8+pZSu0wdiS8Kx+8oUaA8bOY2Qc3OmE= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f99a3f97-8f1d-4d29-1d2b-08d6a938e90d X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2019 11:25:21.8441 (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: DB7PR04MB4428 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 Reviewed-by: Horia Geantă --- Changes since v1: - Corrected code comment as per Chris Spencer's suggestion drivers/crypto/caam/intern.h | 1 - drivers/crypto/caam/jr.c | 7 +------ 2 files changed, 1 insertion(+), 7 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..d1021026f5b2 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; @@ -201,7 +199,7 @@ static void caam_jr_dequeue(unsigned long devarg) /* mark completed, avoid matching on a recycled desc addr */ jrp->entinfo[sw_idx].desc_addr_dma = 0; - /* Stash callback params for use outside of lock */ + /* Stash callback params */ usercall = jrp->entinfo[sw_idx].callbk; userarg = jrp->entinfo[sw_idx].cbkarg; userdesc = jrp->entinfo[sw_idx].desc_addr_virt; @@ -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 11:25:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vakul Garg X-Patchwork-Id: 10854577 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 EB7361575 for ; Fri, 15 Mar 2019 11:25:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5D512A6B4 for ; Fri, 15 Mar 2019 11:25:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C97442A83C; Fri, 15 Mar 2019 11:25: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 6B2E72A83D for ; Fri, 15 Mar 2019 11:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727799AbfCOLZ2 (ORCPT ); Fri, 15 Mar 2019 07:25:28 -0400 Received: from mail-eopbgr70058.outbound.protection.outlook.com ([40.107.7.58]:49846 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726785AbfCOLZ2 (ORCPT ); Fri, 15 Mar 2019 07:25: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=FNFL5fhwbxkMJtFhSvTrJleY15YwBRshyka9dMN8cF4=; b=Jd7KSncGRbPxNFBbiWwRBJ+zZJnPO/AO8Bb6fExXfJUl0dxIRPvPGt7c7QwjpmvmkhoBSi/bBEdxcd9iiHILJD8CR7BdBv9E5UXfkdXVF4s69kjcOUFB0dtFzau27aINzZ2YWCi9+5wcpN1LGb1VPUhOiIZU2uONMpn/P7ASsHQ= Received: from DB7PR04MB4252.eurprd04.prod.outlook.com (52.135.131.26) by DB7PR04MB4428.eurprd04.prod.outlook.com (52.135.137.154) 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 11:25:23 +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 11:25:23 +0000 From: Vakul Garg To: "linux-crypto@vger.kernel.org" , "herbert@gondor.apana.org.au" CC: Horia Geanta , Aymen Sghaier , Vakul Garg Subject: [PATCH v2 2/3] crypto: caam/jr - Removed redundant vars from job ring private data Thread-Topic: [PATCH v2 2/3] crypto: caam/jr - Removed redundant vars from job ring private data Thread-Index: AQHU2yHHP7XgCuqfwkiwUExBIfybdQ== Date: Fri, 15 Mar 2019 11:25:23 +0000 Message-ID: <20190315112238.24337-3-vakul.garg@nxp.com> References: <20190315112238.24337-1-vakul.garg@nxp.com> In-Reply-To: <20190315112238.24337-1-vakul.garg@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0018.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::28) 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: cce59e04-fcf9-45ae-863a-08d6a938ea26 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:DB7PR04MB4428; x-ms-traffictypediagnostic: DB7PR04MB4428: x-microsoft-antispam-prvs: x-forefront-prvs: 09778E995A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(346002)(366004)(376002)(39860400002)(199004)(189003)(6436002)(6486002)(8676002)(316002)(8936002)(81156014)(81166006)(2906002)(50226002)(66066001)(2501003)(86362001)(6512007)(486006)(1076003)(256004)(14444005)(2616005)(14454004)(11346002)(476003)(25786009)(44832011)(71190400001)(71200400001)(99286004)(76176011)(4326008)(36756003)(68736007)(478600001)(105586002)(52116002)(446003)(53936002)(97736004)(186003)(6506007)(54906003)(386003)(110136005)(26005)(102836004)(6116002)(305945005)(7736002)(5660300002)(3846002)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4428;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: rp8VP1J0Vn7tiYwZ7ZJEmV6C1EOeMiHDfWiaKjkFTsq8IRV78M9MA9rx/KNdo5OtKxa8jTgKrKBg27cNC+qI92qYru+jf/vNL94BtK146joktc/WU4JOCRpuNAngLLCFBWlyxDU30qMQIjKuCVha+ufz6C7o0EGZnPdddu24/S6M0XvYQ0heMuYUdEdbsCAuOLQatzh/yO+Rld4tgmxMmprXB/SBZUzZtfoaRao5yT7/obhrtAZHQUzzy5GS0khmNw0dxTr8N43z0mBHtSqX8146tplsv5WK/BEBP5H7ymO+DLYXxPWt7UBdz2LBRgiMWL4Y5bXqXEw7RRsFvAbaHxw07w3+RO4m8o76KubA1bu49yOjbBAprnHFlhRZu803pTdSnC7qgYPxhpqpD8n39mrii3gxDIfSRVgSxX13D6U= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cce59e04-fcf9-45ae-863a-08d6a938ea26 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2019 11:25:23.4682 (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: DB7PR04MB4428 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 d1021026f5b2..e95f82778fa1 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 11:25:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vakul Garg X-Patchwork-Id: 10854579 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 F210015AC for ; Fri, 15 Mar 2019 11:25:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBC472A6B4 for ; Fri, 15 Mar 2019 11:25:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFF052A83D; Fri, 15 Mar 2019 11:25:31 +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 802E72A6B4 for ; Fri, 15 Mar 2019 11:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728730AbfCOLZb (ORCPT ); Fri, 15 Mar 2019 07:25:31 -0400 Received: from mail-eopbgr70058.outbound.protection.outlook.com ([40.107.7.58]:49846 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726785AbfCOLZa (ORCPT ); Fri, 15 Mar 2019 07:25:30 -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=dGakhChNRo9dfWTUfS3cRzJ3fdqvF6SCppledGRgTHI=; b=badW8M1MHodCRb6qSAEQcMHXsb9XUAddCEtTlrDCM9k6zVUnNoPVY3ZjGIi6mwInTnspbHhMWtXlUnsicBDwZ1QEOvzBpnqZtVY7+3JdlTQtpLHHGgWuxUa+lW5McOC25iznWuwbk/mxx16n7SjyxZlWb0WWW2Da4ksLbGvf4ZQ= Received: from DB7PR04MB4252.eurprd04.prod.outlook.com (52.135.131.26) by DB7PR04MB4428.eurprd04.prod.outlook.com (52.135.137.154) 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 11:25: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 11:25: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 v2 3/3] crypto: caam/jr - Remove extra memory barrier during job ring enqueue Thread-Topic: [PATCH v2 3/3] crypto: caam/jr - Remove extra memory barrier during job ring enqueue Thread-Index: AQHU2yHJ0NGh70TZ50KNYr94J5qJrA== Date: Fri, 15 Mar 2019 11:25:25 +0000 Message-ID: <20190315112238.24337-4-vakul.garg@nxp.com> References: <20190315112238.24337-1-vakul.garg@nxp.com> In-Reply-To: <20190315112238.24337-1-vakul.garg@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0018.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::28) 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: 929f4936-fc2f-4bb6-7edf-08d6a938eb1e 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:DB7PR04MB4428; x-ms-traffictypediagnostic: DB7PR04MB4428: x-microsoft-antispam-prvs: x-forefront-prvs: 09778E995A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(346002)(366004)(376002)(39860400002)(199004)(189003)(6436002)(6486002)(8676002)(316002)(8936002)(81156014)(81166006)(2906002)(50226002)(66066001)(2501003)(86362001)(6512007)(486006)(1076003)(256004)(14444005)(2616005)(14454004)(11346002)(476003)(25786009)(44832011)(71190400001)(71200400001)(99286004)(76176011)(4326008)(36756003)(68736007)(478600001)(105586002)(52116002)(446003)(53936002)(97736004)(186003)(6506007)(54906003)(386003)(110136005)(26005)(102836004)(6116002)(305945005)(7736002)(5660300002)(3846002)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4428;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: kQyW3F+WHVQKTPs9k7+JGa3FqjIvv4YIg1DsQrIVhbraAWqVOALJ06/zX3l+7DdlbfACqLo5+omJJl2AyrYKLl5vuqFp53Cr0zSwAt1lW8KzK/PL4vM5lv+R43wYSYV/xLso7cpPd4qvzMpL3fGRMaz2FqcvUMZHl0TaDMCC+0mCEPt8Lh5ZeGA0wA21DkTQRcr/ji6arZSV0B1cJpB/dCdt3tNlZCTfl7OURZu1gsWv/Tb+1PiPMMxAoCsB7sKg/vRVJf4H+qEI6WYOIg42bsf5jxultyTfZhN3OG0lvwjxFF7UhG+jMVLKMfDa8O9V4v89miiF2d4ilX2OvHEU8iFa9UMKkQc2bszNQ8HPnMnDeEe3pDcW9QgSPNI32l2KS8uGWn5ANAd0hzOuRL7pZSiVuf2V1xjvi9uTn27VrnM= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 929f4936-fc2f-4bb6-7edf-08d6a938eb1e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2019 11:25:25.4946 (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: DB7PR04MB4428 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 Reviewed-by: Horia Geantă --- 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 e95f82778fa1..1de2562d0982 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);