From patchwork Tue Apr 9 06:38:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vakul Garg X-Patchwork-Id: 10890573 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 57D101390 for ; Tue, 9 Apr 2019 06:38:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 406BD286EC for ; Tue, 9 Apr 2019 06:38:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3336728818; Tue, 9 Apr 2019 06:38:13 +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 C2EB3286EC for ; Tue, 9 Apr 2019 06:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726371AbfDIGiM (ORCPT ); Tue, 9 Apr 2019 02:38:12 -0400 Received: from mail-eopbgr40052.outbound.protection.outlook.com ([40.107.4.52]:8773 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726062AbfDIGiM (ORCPT ); Tue, 9 Apr 2019 02:38:12 -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=7E1Ax5z/e9QWrM7+JFbMLt6KnH7o6tBTqxLBOEnH3a8=; b=uqfjGq5c4VzckrpM74GjBw3E1WIfkwLKnU0KO2wZILIUrkA7CHsZjT18GCeM9rScTgViP8oWe/Y85WtZqb2XweLuQ5TTvLo8K/wN5F36BCEwQsvUnYwnvAiA9yVRrKiSCsZnMJ5rXSR318ZIicj6iYpnV0TH26AwBiQ9z2N672w= Received: from DB7PR04MB4252.eurprd04.prod.outlook.com (52.135.131.26) by DB7PR04MB3993.eurprd04.prod.outlook.com (52.134.107.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.19; Tue, 9 Apr 2019 06:38:08 +0000 Received: from DB7PR04MB4252.eurprd04.prod.outlook.com ([fe80::7df2:64d:6c26:9bef]) by DB7PR04MB4252.eurprd04.prod.outlook.com ([fe80::7df2:64d:6c26:9bef%5]) with mapi id 15.20.1771.019; Tue, 9 Apr 2019 06:38:08 +0000 From: Vakul Garg To: "linux-crypto@vger.kernel.org" CC: "herbert@gondor.apana.org.au" , Horia Geanta , Aymen Sghaier , "davem@davemloft.net" , Vakul Garg Subject: [PATCH] crypto: caam/jr - Remove extra memory barrier during job ring dequeue Thread-Topic: [PATCH] crypto: caam/jr - Remove extra memory barrier during job ring dequeue Thread-Index: AQHU7p7L1WWMt7PWPkWjXZuiG4N0VQ== Date: Tue, 9 Apr 2019 06:38:08 +0000 Message-ID: <20190409063505.16664-1-vakul.garg@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR01CA0131.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::25) 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: 85c7bc08-0c91-48c0-8cad-08d6bcb5ed91 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:DB7PR04MB3993; x-ms-traffictypediagnostic: DB7PR04MB3993: x-microsoft-antispam-prvs: x-forefront-prvs: 000227DA0C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(346002)(39860400002)(396003)(376002)(136003)(189003)(199004)(97736004)(53936002)(2616005)(2906002)(25786009)(3846002)(478600001)(386003)(6506007)(5640700003)(6116002)(14444005)(99286004)(486006)(186003)(66066001)(2501003)(256004)(86362001)(6436002)(44832011)(5660300002)(4326008)(476003)(6512007)(6916009)(2351001)(316002)(54906003)(106356001)(81156014)(26005)(105586002)(7736002)(1076003)(71190400001)(71200400001)(102836004)(50226002)(81166006)(6486002)(52116002)(68736007)(8936002)(14454004)(8676002)(305945005)(36756003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB3993;H:DB7PR04MB4252.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: XcGyGh8qjbWuSGU2/3l9xu9moQ1OFXPiK6j6650llDxfaY1+/4eIVSq+TRGggO4o6FIaMOtX1XbdHiHdg6/ztHRSCJ4U7zLqek6s6PVkXj92469HX7OFrNYr0Y1vTWwZwzcFvZIMDB2Aq+RS4GX4Avrki80aebfA27sH6ieURHf39Jxk2d175UcGuVtwaYpmftkwVeZTIbivWxh7Y7ZK0kqoOaxzzsmPgg6MANjOQw1KY/QHixWx/pwLxZV8tZOZGEd5J7GxKc7ahMHLKv4gmumqfXlkOTGHda81jqLwgWRASumxB6SrLoMNceHHPBkiAd6A38HQo+SXgqRchPJz+GULsusWsC03atJXHRprDbWcvWzq9SQfJAaeOrIFaPOYmgkyNi0CybLvhwooHAmNWIjj9vhHEJKKuPakF0H4eP4= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85c7bc08-0c91-48c0-8cad-08d6bcb5ed91 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2019 06:38:08.3947 (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: DB7PR04MB3993 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 function caam_jr_dequeue(), a full memory barrier is used before writing response job ring's register to signal removal of the completed job. Therefore for writing the register, we do not need another write memory barrier. Hence it is removed by replacing the call to wr_reg32() with a newly defined function wr_reg32_relaxed(). Signed-off-by: Vakul Garg --- drivers/crypto/caam/jr.c | 2 +- drivers/crypto/caam/regs.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 4e9b3fca5627..2ce6d7d2ad72 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -266,7 +266,7 @@ static void caam_jr_dequeue(unsigned long devarg) mb(); /* set done */ - wr_reg32(&jrp->rregs->outring_rmvd, 1); + wr_reg32_relaxed(&jrp->rregs->outring_rmvd, 1); jrp->out_ring_read_index = (jrp->out_ring_read_index + 1) & (JOBR_DEPTH - 1); diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index 3cd0822ea819..9e912c722e33 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -96,6 +96,14 @@ cpu_to_caam(16) cpu_to_caam(32) cpu_to_caam(64) +static inline void wr_reg32_relaxed(void __iomem *reg, u32 data) +{ + if (caam_little_end) + writel_relaxed(data, reg); + else + writel_relaxed(cpu_to_be32(data), reg); +} + static inline void wr_reg32(void __iomem *reg, u32 data) { if (caam_little_end)