Skip to contentSkip to conversation

crypto: caam - set RDB bit in security configuration register

PATCH In review Vakul Garg 3 participants 3 messages Feb 6, 2013 – Feb 7, 2013

Subsystems (2)
lore
Share & tools
lore

Vakul Garg

author
#0 lore raw

PATCH 1/1 crypto: caam - set RDB bit in security configuration register

This change is required for post SEC-5.0 devices which have RNG4. Setting RDB in security configuration register allows CAAM to use the "Random Data Buffer" to be filled by a single request. The Random Data Buffer is large enough for ten packets to get their IVs from a single request. If the Random Data Buffer is not enabled, then each IV causes a separate request, and RNG4 hardware cannot keep up resulting in lower IPSEC throughput.

---

 drivers/crypto/caam/ctrl.c |    3 +++
 drivers/crypto/caam/regs.h |    4 +++-
 2 files changed, 6 insertions(+), 1 deletions(-)
drivers/crypto/caam/ctrl.c +3 -0
index b3fecfa..53dd54e 100644
@@ -234,6 +234,9 @@ static int caam_probe(struct platform_device *pdev)
 	setbits32(&topregs->ctrl.mcr, MCFGR_WDENABLE |
 		  (sizeof(dma_addr_t) == sizeof(u64) ? MCFGR_LONG_PTR : 0));
 
+	if (of_device_is_compatible(nprop, "fsl,sec-v5.0"))
+		setbits32(&topregs->ctrl.scfgr, SCFGR_RDBENABLE);
+
 	if (sizeof(dma_addr_t) == sizeof(u64))
 		if (of_device_is_compatible(nprop, "fsl,sec-v5.0"))
 			dma_set_mask(dev, DMA_BIT_MASK(40));
drivers/crypto/caam/regs.h +3 -1
index 3223fc6..cd6feda 100644
@@ -252,7 +252,8 @@ struct caam_ctrl {
 	/* Read/Writable					        */
 	u32 rsvd1;
 	u32 mcr;		/* MCFG      Master Config Register  */
-	u32 rsvd2[2];
+	u32 rsvd2;
+	u32 scfgr;		/* SCFGR, Security Config Register */
 
 	/* Bus Access Configuration Section			010-11f */
 	/* Read/Writable                                                */
@@ -299,6 +300,7 @@ struct caam_ctrl {
 #define MCFGR_WDFAIL		0x20000000 /* DECO watchdog force-fail */
 #define MCFGR_DMA_RESET		0x10000000
 #define MCFGR_LONG_PTR		0x00010000 /* Use >32-bit desc addressing */
+#define SCFGR_RDBENABLE		0x00000400
 
 /* AXI read cache control */
 #define MCFGR_ARCACHE_SHIFT	12
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 1 line · On Wed, 6 Feb 2013 17:17:46 +0530 Vakul Garg <[email protected]> wrote:

This change is required for post SEC-5.0 devices which have RNG4. Setting RDB

wrap your commit message text to 75 chars

Quoted 5 lines

in security configuration register allows CAAM to use the "Random Data Buffer" to be filled by a single request. The Random Data Buffer is large enough for ten packets to get their IVs from a single request. If the Random Data Buffer is not enabled, then each IV causes a separate request, and RNG4 hardware cannot keep up resulting in lower IPSEC throughput.

Linux kernel IPSec or another IPSEC stack? how much lower?

drivers/crypto/caam/ctrl.c static int caam_probe(struct platform_device *pdev) · line 239

Quoted 3 lines
drivers/crypto/caam/ctrl.c +3 -0
+	if (of_device_is_compatible(nprop, "fsl,sec-v5.0"))
+		setbits32(&topregs->ctrl.scfgr, SCFGR_RDBENABLE);
+

this belongs further down - at the end of the RNG4 initialization section.

Kim

#2 lore raw
Quoted 10 lines

-----Original Message-----
From: Phillips Kim-R1AAHA
Sent: Thursday, February 07, 2013 7:03 AM
To: Garg Vakul-B16394
Cc: [email protected]; Herbert Xu; David S. Miller; Liu Shengzhou-B36685; Porosanu Alexandru-B06830; [email protected]
Subject: Re: [PATCH] crypto: caam - set RDB bit in security configuration register

Quoted 7 lines
Quoted 2 lines · On Wed, 6 Feb 2013 17:17:46 +0530 Vakul Garg <[email protected]> wrote:

This change is required for post SEC-5.0 devices which have RNG4. Setting RDB

wrap your commit message text to 75 chars

Ok

Quoted 10 lines
Quoted 2 lines

in security configuration register allows CAAM to use the "Random Data

Buffer"

Quoted 4 lines

to be filled by a single request. The Random Data Buffer is large enough for ten packets to get their IVs from a single request. If the Random Data Buffer is not enabled, then each IV causes a separate request, and RNG4 hardware cannot keep up resulting in lower IPSEC

throughput.

Linux kernel IPSec or another IPSEC stack? how much lower?

We measured USDPAA IPSEC throughput to be 1.9 times better on T4240 with this change.

Quoted 7 lines

drivers/crypto/caam/ctrl.c static int caam_probe(struct platform_device *pdev) · line 239

Quoted 4 lines
drivers/crypto/caam/ctrl.c +3 -0
+	if (of_device_is_compatible(nprop, "fsl,sec-v5.0"))
+		setbits32(&topregs->ctrl.scfgr, SCFGR_RDBENABLE);
+

this belongs further down - at the end of the RNG4 initialization section.

Ok

Quoted 2 lines

Kim