linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vakul Garg <vakul.garg@nxp.com>
To: "linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>
Cc: Horia Geanta <horia.geanta@nxp.com>,
	Aymen Sghaier <aymen.sghaier@nxp.com>,
	Vakul Garg <vakul.garg@nxp.com>
Subject: [PATCH 3/3] crypto: caam/jr - Remove extra memory barrier during job ring enqueue
Date: Fri, 15 Mar 2019 04:05:25 +0000	[thread overview]
Message-ID: <20190315040239.24705-4-vakul.garg@nxp.com> (raw)
In-Reply-To: <20190315040239.24705-1-vakul.garg@nxp.com>

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 <vakul.garg@nxp.com>
---
 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);
 
-- 
2.13.6


      parent reply	other threads:[~2019-03-15  4:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15  4:05 [PATCH 0/3] CAAM job ring driver cleanups Vakul Garg
2019-03-15  4:05 ` [PATCH 1/3] crypto: caam/jr - Remove spinlock for output job ring Vakul Garg
2019-03-15  8:08   ` Chris Spencer
2019-03-15  4:05 ` [PATCH 2/3] crypto: caam/jr - Remove redundant vars from job ring private data Vakul Garg
2019-03-15  4:05 ` Vakul Garg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190315040239.24705-4-vakul.garg@nxp.com \
    --to=vakul.garg@nxp.com \
    --cc=aymen.sghaier@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).