Skip to contentSkip to conversation

Add Support for Marvell OcteonTX2 Cryptographic

PATCH Superseded Srujana Challa 4 participants 12 messages Sep 17, 2020 – Sep 19, 2020

Subsystems (6)

v3 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Srujana Challa

author maintainer
#0 lore raw

v3 cover Add Support for Marvell OcteonTX2 Cryptographic

The following series adds support for Marvell Cryptographic Acceleration Unit(CPT) on OcteonTX2 CN96XX SoC.
This series is tested with CRYPTO_EXTRA_TESTS enabled and CRYPTO_DISABLE_TESTS disabled.

Changes since v2:
* Fixed C=1 warnings.
* Added code to exit CPT VF driver gracefully.
* Moved OcteonTx2 asm code to a header file under include/linux/soc/

Changes since v1:
* Moved Makefile changes from patch4 to patch2 and patch3.

Srujana Challa (3):
octeontx2-pf: move asm code to include/linux/soc
octeontx2-af: add support to manage the CPT unit
drivers: crypto: add support for OCTEONTX2 CPT engine
drivers: crypto: add the Virtual Function driver for OcteonTX2 CPT

 MAINTAINERS                                   |    2 +
 drivers/crypto/marvell/Kconfig                |   17 +
 drivers/crypto/marvell/Makefile               |    1 +
 drivers/crypto/marvell/octeontx2/Makefile     |   10 +
 .../marvell/octeontx2/otx2_cpt_common.h       |   53 +
 .../marvell/octeontx2/otx2_cpt_hw_types.h     |  467 ++++
 .../marvell/octeontx2/otx2_cpt_mbox_common.c  |  286 +++
 .../marvell/octeontx2/otx2_cpt_mbox_common.h  |  100 +
 .../marvell/octeontx2/otx2_cpt_reqmgr.h       |  197 ++
 drivers/crypto/marvell/octeontx2/otx2_cptlf.h |  356 +++
 .../marvell/octeontx2/otx2_cptlf_main.c       |  967 ++++++++
 drivers/crypto/marvell/octeontx2/otx2_cptpf.h |   79 +
 .../marvell/octeontx2/otx2_cptpf_main.c       |  598 +++++
 .../marvell/octeontx2/otx2_cptpf_mbox.c       |  694 ++++++
 .../marvell/octeontx2/otx2_cptpf_ucode.c      | 2173 +++++++++++++++++
 .../marvell/octeontx2/otx2_cptpf_ucode.h      |  180 ++
 drivers/crypto/marvell/octeontx2/otx2_cptvf.h |   29 +
 .../marvell/octeontx2/otx2_cptvf_algs.c       | 1698 +++++++++++++
 .../marvell/octeontx2/otx2_cptvf_algs.h       |  172 ++
 .../marvell/octeontx2/otx2_cptvf_main.c       |  229 ++
 .../marvell/octeontx2/otx2_cptvf_mbox.c       |  189 ++
 .../marvell/octeontx2/otx2_cptvf_reqmgr.c     |  540 ++++
 .../ethernet/marvell/octeontx2/af/Makefile    |    3 +-
 .../net/ethernet/marvell/octeontx2/af/mbox.h  |   85 +
 .../net/ethernet/marvell/octeontx2/af/rvu.c   |    2 +-
 .../net/ethernet/marvell/octeontx2/af/rvu.h   |    7 +
 .../ethernet/marvell/octeontx2/af/rvu_cpt.c   |  343 +++
 .../marvell/octeontx2/af/rvu_debugfs.c        |  342 +++
 .../ethernet/marvell/octeontx2/af/rvu_nix.c   |   76 +
 .../ethernet/marvell/octeontx2/af/rvu_reg.h   |   65 +-
 .../marvell/octeontx2/nic/otx2_common.h       |   13 +-
 include/linux/soc/marvell/octeontx2/asm.h     |   29 +
 32 files changed, 9982 insertions(+), 20 deletions(-)
 create mode 100644 drivers/crypto/marvell/octeontx2/Makefile
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_common.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_hw_types.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_reqmgr.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptlf.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptlf_main.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c
 create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c
 create mode 100644 include/linux/soc/marvell/octeontx2/asm.h
Signature · 1 line
2.28.0
author maintainer
#1 lore raw

PATCH v3 1/4 octeontx2-pf: move asm code to include/linux/soc

On OcteonTX2 platform CPT instruction enqueue and NIX packet send are only possible via LMTST operations which uses LDEOR instruction. This patch moves the asm code from OcteonTX2 nic driver to include/linux/soc as it will be used by OcteonTX2 CPT and NIC driver for LMTST.

---
 MAINTAINERS                                   |  2 ++
 .../marvell/octeontx2/nic/otx2_common.h       | 13 +--------
 include/linux/soc/marvell/octeontx2/asm.h     | 29 +++++++++++++++++++
 3 files changed, 32 insertions(+), 12 deletions(-)
 create mode 100644 include/linux/soc/marvell/octeontx2/asm.h
MAINTAINERS +2 -0
index 9a545a631f0d..95ddbb4f1a89 100644
@@ -10431,6 +10431,7 @@ M:	Srujana Challa <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	drivers/crypto/marvell/
+F:	include/linux/soc/marvell/octeontx2/
 
 MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2)
 M:	Mirko Lindner <[email protected]>
@@ -10503,6 +10504,7 @@ M:	hariprasad <[email protected]>
 L:	[email protected]
 S:	Supported
 F:	drivers/net/ethernet/marvell/octeontx2/nic/
+F:	include/linux/soc/marvell/octeontx2/
 
 MARVELL OCTEONTX2 RVU ADMIN FUNCTION DRIVER
 M:	Sunil Goutham <[email protected]>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -12
index ac47762cce9b..12311964d9d6 100644
@@ -16,6 +16,7 @@
 #include <linux/net_tstamp.h>
 #include <linux/ptp_clock_kernel.h>
 #include <linux/timecounter.h>
+#include <linux/soc/marvell/octeontx2/asm.h>
 
 #include <mbox.h>
 #include "otx2_reg.h"
@@ -420,21 +421,9 @@ static inline u64 otx2_atomic64_add(u64 incr, u64 *ptr)
 	return result;
 }
 
-static inline u64 otx2_lmt_flush(uint64_t addr)
-{
-	u64 result = 0;
-
-	__asm__ volatile(".cpu  generic+lse\n"
-			 "ldeor xzr,%x[rf],[%[rs]]"
-			 : [rf]"=r"(result)
-			 : [rs]"r"(addr));
-	return result;
-}
-
 #else
 #define otx2_write128(lo, hi, addr)
 #define otx2_atomic64_add(incr, ptr)		({ *ptr += incr; })
-#define otx2_lmt_flush(addr)			({ 0; })
 #endif
 
 /* Alloc pointer from pool/aura */
include/linux/soc/marvell/octeontx2/asm.h new file +29 -0
new file mode 100644
index 000000000000..ae2279fe830a
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-only
+ * Copyright (C) 2020 Marvell.
+ */
+
+#ifndef __SOC_OTX2_ASM_H
+#define __SOC_OTX2_ASM_H
+
+#if defined(CONFIG_ARM64)
+/*
+ * otx2_lmt_flush is used for LMT store operation.
+ * On octeontx2 platform CPT instruction enqueue and
+ * NIX packet send are only possible via LMTST
+ * operations and it uses LDEOR instruction targeting
+ * the coprocessor address.
+ */
+#define otx2_lmt_flush(ioaddr)                          \
+({                                                      \
+	u64 result = 0;                                 \
+	__asm__ volatile(".cpu  generic+lse\n"          \
+			 "ldeor xzr, %x[rf], [%[rs]]"   \
+			 : [rf]"=r" (result)            \
+			 : [rs]"r" (ioaddr));           \
+	(result);                                       \
+})
+#else
+#define otx2_lmt_flush(ioaddr)          ({ 0; })
+#endif
+
+#endif /* __SOC_OTX2_ASM_H */
Signature · 1 line
2.28.0
author maintainer
#2 lore raw

PATCH v3 2/4 octeontx2-af: add support to manage the CPT unit

In reply to Srujana Challa

From: Srujana <[email protected]>

The Admin function (AF) manages hardware resources on the cryptographic acceleration unit(CPT). This patch adds a mailbox interface for PFs and VFs to configure hardware resources for cryptography and inline-ipsec.

---
 .../ethernet/marvell/octeontx2/af/Makefile    |   3 +-
 .../net/ethernet/marvell/octeontx2/af/mbox.h  |  85 +++++
 .../net/ethernet/marvell/octeontx2/af/rvu.c   |   2 +-
 .../net/ethernet/marvell/octeontx2/af/rvu.h   |   7 +
 .../ethernet/marvell/octeontx2/af/rvu_cpt.c   | 343 ++++++++++++++++++
 .../marvell/octeontx2/af/rvu_debugfs.c        | 342 +++++++++++++++++
 .../ethernet/marvell/octeontx2/af/rvu_nix.c   |  76 ++++
 .../ethernet/marvell/octeontx2/af/rvu_reg.h   |  65 +++-
 8 files changed, 915 insertions(+), 8 deletions(-)
 create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c
drivers/net/ethernet/marvell/octeontx2/af/Makefile +2 -1
index 0bc2410c8949..657a89afbf75 100644
@@ -8,4 +8,5 @@ obj-$(CONFIG_OCTEONTX2_AF) += octeontx2_af.o
 
 octeontx2_mbox-y := mbox.o
 octeontx2_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \
-		  rvu_reg.o rvu_npc.o rvu_debugfs.o ptp.o
+		  rvu_reg.o rvu_npc.o rvu_debugfs.o ptp.o \
+		  rvu_cpt.o
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +85 -0

107 lines not on this page · raw message

drivers/net/ethernet/marvell/octeontx2/af/rvu.c +1 -1
index c3ef73ae782c..72be5c1044ae 100644
@@ -1023,7 +1023,7 @@ int rvu_mbox_handler_ready(struct rvu *rvu, struct msg_req *req,
 /* Get current count of a RVU block's LF/slots
  * provisioned to a given RVU func.
  */
-static u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blktype)
+u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blktype)
 {
 	switch (blktype) {
 	case BLKTYPE_NPA:
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +7 -0
index 05da7a91944a..360991ae355b 100644
@@ -42,6 +42,10 @@ struct dump_ctx {
 	bool	all;
 };
 
+struct cpt_dump_ctx {
+	char    e_type[NAME_SIZE];
+};
+
 struct rvu_debugfs {
 	struct dentry *root;
 	struct dentry *cgx_root;
@@ -50,11 +54,13 @@ struct rvu_debugfs {
 	struct dentry *npa;
 	struct dentry *nix;
 	struct dentry *npc;
+	struct dentry *cpt;
 	struct dump_ctx npa_aura_ctx;
 	struct dump_ctx npa_pool_ctx;
 	struct dump_ctx nix_cq_ctx;
 	struct dump_ctx nix_rq_ctx;
 	struct dump_ctx nix_sq_ctx;
+	struct cpt_dump_ctx cpt_ctx;
 	int npa_qsize_id;
 	int nix_qsize_id;
 };
@@ -412,6 +418,7 @@ int rvu_get_lf(struct rvu *rvu, struct rvu_block *block, u16 pcifunc, u16 slot);
 int rvu_lf_reset(struct rvu *rvu, struct rvu_block *block, int lf);
 int rvu_get_blkaddr(struct rvu *rvu, int blktype, u16 pcifunc);
 int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero);
+u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blktype);
 
 /* RVU HW reg validation */
 enum regmap_block {
drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c new file +343 -0

343 lines not on this page · raw message

drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +342 -0

354 lines not on this page · raw message

drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +76 -0

79 lines not on this page · raw message

drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h +59 -6

77 lines not on this page · raw message

Signature · 1 line
2.28.0
#3 lore raw

Re: [PATCH v3,net-next,2/4] octeontx2-af: add support to manage the CPT unit

Review

Quoted 6 lines · Srujana Challa
(quoted diff) +2 -0
+int rvu_mbox_handler_nix_inline_ipsec_lf_cfg(struct rvu *rvu,
 
+               struct nix_inline_ipsec_lf_cfg *req, struct msg_rsp

Can you do something about this code alignment ?

checkpatch outputs:

---------------------------------------------------------------------
---
Commit c5f9e5da557f ("octeontx2-af: add support to manage the CPT unit")
---------------------------------------------------------------------
---
CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #958: FILE: drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c:3454:
+int rvu_mbox_handler_nix_inline_ipsec_lf_cfg(struct rvu *rvu,
+ struct nix_inline_ipsec_lf_cfg *req, struct msg_rsp
*rsp)

WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Srujana <[email protected]>'

author maintainer
#4 lore raw

PATCH v3 3/4 drivers: crypto: add support for OCTEONTX2 CPT engine

In reply to Srujana Challa

Add support for the cryptographic acceleration unit (CPT) on OcteonTX2 CN96XX SoC.

---
 drivers/crypto/marvell/Kconfig                |   13 +
 drivers/crypto/marvell/Makefile               |    1 +
 drivers/crypto/marvell/octeontx2/Makefile     |    7 +
 .../marvell/octeontx2/otx2_cpt_common.h       |   53 +
 .../marvell/octeontx2/otx2_cpt_hw_types.h     |  462 ++++
 .../marvell/octeontx2/otx2_cpt_mbox_common.c  |  286 +++
 .../marvell/octeontx2/otx2_cpt_mbox_common.h  |  100 +
 .../marvell/octeontx2/otx2_cpt_reqmgr.h       |   76 +
 drivers/crypto/marvell/octeontx2/otx2_cptlf.h |  342 +++
 drivers/crypto/marvell/octeontx2/otx2_cptpf.h |   79 +
 .../marvell/octeontx2/otx2_cptpf_main.c       |  598 +++++
 .../marvell/octeontx2/otx2_cptpf_mbox.c       |  694 ++++++
 .../marvell/octeontx2/otx2_cptpf_ucode.c      | 2173 +++++++++++++++++
 .../marvell/octeontx2/otx2_cptpf_ucode.h      |  180 ++
 drivers/crypto/marvell/octeontx2/otx2_cptvf.h |   24 +
 15 files changed, 5088 insertions(+)
 create mode 100644 drivers/crypto/marvell/octeontx2/Makefile
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_common.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_hw_types.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cpt_reqmgr.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptlf.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf.h
drivers/crypto/marvell/Kconfig +13 -0
index 13063384f958..9c4001105cb6 100644
@@ -35,3 +35,16 @@ config CRYPTO_DEV_OCTEONTX_CPT
 
 		To compile this driver as module, choose M here:
 		the modules will be called octeontx-cpt and octeontx-cptvf
+
+config CRYPTO_DEV_OCTEONTX2_CPT
+	tristate "Support for Marvell OcteonTX2 CPT driver"
+	depends on ARM64 || COMPILE_TEST
+	depends on PCI_MSI && 64BIT
+	select OCTEONTX2_MBOX
+	select CRYPTO_DEV_MARVELL
+	help
+		This driver allows you to utilize the Marvell Cryptographic
+		Accelerator Unit(CPT) found in OcteonTX2 series of processors.
+
+		To compile this driver as module, choose M here:
+		the modules will be called octeontx2-cpt and octeontx2-cptvf
drivers/crypto/marvell/Makefile +1 -0
index 6c6a1519b0f1..39db6d9c0aaf 100644
@@ -2,3 +2,4 @@
 
 obj-$(CONFIG_CRYPTO_DEV_MARVELL_CESA) += cesa/
 obj-$(CONFIG_CRYPTO_DEV_OCTEONTX_CPT) += octeontx/
+obj-$(CONFIG_CRYPTO_DEV_OCTEONTX2_CPT) += octeontx2/
drivers/crypto/marvell/octeontx2/Makefile new file +7 -0
new file mode 100644
index 000000000000..d5d8f962bbb3
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_CRYPTO_DEV_OCTEONTX2_CPT) += octeontx2-cpt.o
+
+octeontx2-cpt-objs := otx2_cptpf_main.o otx2_cptpf_mbox.o otx2_cptpf_ucode.o \
+		      otx2_cpt_mbox_common.o
+
+ccflags-y += -I$(srctree)/drivers/net/ethernet/marvell/octeontx2/af
drivers/crypto/marvell/octeontx2/otx2_cpt_common.h new file +53 -0

53 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cpt_hw_types.h new file +462 -0

462 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c new file +286 -0

286 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.h new file +100 -0

100 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cpt_reqmgr.h new file +76 -0

76 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptlf.h new file +342 -0

342 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptpf.h new file +79 -0

79 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c new file +598 -0

598 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c new file +694 -0

694 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c new file +2173 -0

283 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.h new file +180 -0

180 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptvf.h new file +24 -0
new file mode 100644
index 000000000000..51039c7a7195

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.28.0

Part of the diff is not shown here. View the raw message.

#5 lore raw

Re: [PATCH v3,net-next,3/4] drivers: crypto: add support for OCTEONTX2 CPT engine

I love your patch! Yet something to improve:

Hi Srujana,

I love your patch! Yet something to improve:

[auto build test ERROR on cryptodev/master]
[also build test ERROR on crypto/master sparc-next/master v5.9-rc5 next-20200917] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Srujana-Challa/drivers-crypto-add-support-for-OCTEONTX2-CPT-engine/20200918-025047
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from drivers/crypto/marvell/octeontx2/otx2_cptpf.h:9,
from drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.h:8, from drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c:5:

>> drivers/crypto/marvell/octeontx2/otx2_cptlf.h:8:10: fatal error: linux/soc/marvell/octeontx2/asm.h: No such file or directory

8 | #include <linux/soc/marvell/octeontx2/asm.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

# https://github.com/0day-ci/linux/commit/bc79b89570c07aabe9985f837486d3d7a0793136
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Srujana-Challa/drivers-crypto-add-support-for-OCTEONTX2-CPT-engine/20200918-025047 git checkout bc79b89570c07aabe9985f837486d3d7a0793136
vim +8 drivers/crypto/marvell/octeontx2/otx2_cptlf.h

     7	
   > 8	#include <linux/soc/marvell/octeontx2/asm.h>
     9	#include "otx2_cpt_reqmgr.h"
    10	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#6 lore raw

Re: [PATCH v3,net-next,3/4] drivers: crypto: add support for OCTEONTX2 CPT engine

In reply to Srujana Challa
Quoted 13 lines · Srujana Challa

Add support for the cryptographic acceleration unit (CPT) on

OcteonTX2 CN96XX SoC.

---

[...]

Quoted 1 line
 15 files changed, 5088 insertions(+)

Huge patch, i suggest to break the whole series up to smaller patches, i suggest each component in a separate patch (e.g: infrastructure, new mbox, debugfs, etc..)

What linux interfaces are going to enable your ipsec features? i couldn't find any netdev, xfrm references in your series .. and the cover letter + commit messages lack of such information.

FYI checkpatch is not happy at all with this patch:
total: 0 errors, 2 warnings, 85 checks, 5094 lines checked

85 mostly legit checks fire up.

author maintainer
#7 lore raw

PATCH v3 4/4 drivers: crypto: add the Virtual Function driver for OcteonTX2 CPT

In reply to Srujana Challa

Add support for the cryptographic accelerator unit virtual functions on OcteonTX2 96XX SoC.

---
 drivers/crypto/marvell/Kconfig                |    4 +
 drivers/crypto/marvell/octeontx2/Makefile     |    5 +-
 .../marvell/octeontx2/otx2_cpt_hw_types.h     |    5 +
 .../marvell/octeontx2/otx2_cpt_reqmgr.h       |  121 ++
 drivers/crypto/marvell/octeontx2/otx2_cptlf.h |   14 +
 .../marvell/octeontx2/otx2_cptlf_main.c       |  967 ++++++++++
 drivers/crypto/marvell/octeontx2/otx2_cptvf.h |    5 +
 .../marvell/octeontx2/otx2_cptvf_algs.c       | 1698 +++++++++++++++++
 .../marvell/octeontx2/otx2_cptvf_algs.h       |  172 ++
 .../marvell/octeontx2/otx2_cptvf_main.c       |  229 +++
 .../marvell/octeontx2/otx2_cptvf_mbox.c       |  189 ++
 .../marvell/octeontx2/otx2_cptvf_reqmgr.c     |  540 ++++++
 12 files changed, 3948 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptlf_main.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c
drivers/crypto/marvell/Kconfig +4 -0
index 9c4001105cb6..1f118bea077e 100644
@@ -40,8 +40,12 @@ config CRYPTO_DEV_OCTEONTX2_CPT
 	tristate "Support for Marvell OcteonTX2 CPT driver"
 	depends on ARM64 || COMPILE_TEST
 	depends on PCI_MSI && 64BIT
+	depends on CRYPTO_LIB_AES
 	select OCTEONTX2_MBOX
 	select CRYPTO_DEV_MARVELL
+	select CRYPTO_SKCIPHER
+	select CRYPTO_HASH
+	select CRYPTO_AEAD
 	help
 		This driver allows you to utilize the Marvell Cryptographic
 		Accelerator Unit(CPT) found in OcteonTX2 series of processors.
drivers/crypto/marvell/octeontx2/Makefile +4 -1
index d5d8f962bbb3..e08df488b5a9 100644
@@ -1,7 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_CRYPTO_DEV_OCTEONTX2_CPT) += octeontx2-cpt.o
+obj-$(CONFIG_CRYPTO_DEV_OCTEONTX2_CPT) += octeontx2-cpt.o octeontx2-cptvf.o
 
 octeontx2-cpt-objs := otx2_cptpf_main.o otx2_cptpf_mbox.o otx2_cptpf_ucode.o \
 		      otx2_cpt_mbox_common.o
+octeontx2-cptvf-objs := otx2_cptvf_main.o otx2_cptvf_mbox.o otx2_cptlf_main.o \
+			otx2_cptvf_reqmgr.o otx2_cptvf_algs.o \
+			otx2_cpt_mbox_common.o
 
 ccflags-y += -I$(srctree)/drivers/net/ethernet/marvell/octeontx2/af
drivers/crypto/marvell/octeontx2/otx2_cpt_hw_types.h +5 -0
index d927f1f0f07f..73d83a19d69b 100644
@@ -104,6 +104,11 @@
 #define OTX2_CPT_LMT_LFBASE             BIT_ULL(OTX2_CPT_RVU_FUNC_BLKADDR_SHIFT)
 #define OTX2_CPT_LMT_LF_LMTLINEX(a)     (OTX2_CPT_LMT_LFBASE | 0x000 | \
 					 (a) << 12)
+/* RVU VF registers */
+#define OTX2_RVU_VF_INT                 (0x20)
+#define OTX2_RVU_VF_INT_W1S             (0x28)
+#define OTX2_RVU_VF_INT_ENA_W1S         (0x30)
+#define OTX2_RVU_VF_INT_ENA_W1C         (0x38)
 
 /*
  * Enumeration otx2_cpt_ucode_error_code_e
drivers/crypto/marvell/octeontx2/otx2_cpt_reqmgr.h +121 -0

131 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptlf.h +14 -0
index 353ab5d2cd5b..5dcd552c9aca 100644
@@ -44,6 +44,10 @@
 #define OTX2_CPT_QUEUE_HI_PRIO  0x1
 #define OTX2_CPT_QUEUE_LOW_PRIO 0x0
 
+enum otx2_cptlf_state {
+	OTX2_CPTLF_IN_RESET,
+	OTX2_CPTLF_STARTED,
+};
 
 struct otx2_cptlf_sysfs_cfg {
 	char name[OTX2_CPT_NAME_LENGTH];
@@ -339,4 +343,14 @@ static inline void otx2_cpt_send_cmd(union otx2_cpt_inst_s *cptinst,
 
 	} while (!ret);
 }
+
+static inline bool otx2_cptlf_started(struct otx2_cptlfs_info *lfs)
+{
+	return atomic_read(&lfs->state) == OTX2_CPTLF_STARTED;
+}
+
+int otx2_cptvf_lf_init(struct pci_dev *pdev, void __iomem *reg_base,
+		       struct otx2_cptlfs_info *lfs, int lfs_num);
+int otx2_cptvf_lf_shutdown(struct pci_dev *pdev, struct otx2_cptlfs_info *lfs);
+
 #endif /* __OTX2_CPTLF_H */
drivers/crypto/marvell/octeontx2/otx2_cptlf_main.c new file +967 -0

967 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptvf.h +5 -0
index 51039c7a7195..6a4d8b5a2dca 100644
@@ -21,4 +21,9 @@ struct otx2_cptvf_dev {
 	struct workqueue_struct *pfvf_mbox_wq;
 };
 
+irqreturn_t otx2_cptvf_pfvf_mbox_intr(int irq, void *arg);
+void otx2_cptvf_pfvf_mbox_handler(struct work_struct *work);
+int otx2_cptvf_send_eng_grp_num_msg(struct otx2_cptvf_dev *cptvf, int eng_type);
+int otx2_cptvf_send_kcrypto_limits_msg(struct otx2_cptvf_dev *cptvf);
+
 #endif /* __OTX2_CPTVF_H */
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c new file +1698 -0

1,698 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.h new file +172 -0

137 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c new file +229 -0

229 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c new file +189 -0

189 lines not on this page · raw message

drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c new file +540 -0

540 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.28.0

Part of the diff is not shown here. View the raw message.

maintainer
#8 lore raw
In reply to Srujana Challa
Quoted 4 lines · On Thu, 17 Sep 2020 18:58:31 +0530 Srujana Challa wrote:

The following series adds support for Marvell Cryptographic Acceleration Unit(CPT) on OcteonTX2 CN96XX SoC.
This series is tested with CRYPTO_EXTRA_TESTS enabled and CRYPTO_DISABLE_TESTS disabled.

No writeable debugfs files, please.

Please provide more information about how users are going to make use of the functionality and what the capabilities are. You add 10K LoC and patches barely have barely a commit message.

author maintainer
#9 lore raw
Quoted 5 lines

Subject: [EXT] Re: [PATCH v3,net-next,0/4] Add Support for Marvell OcteonTX2 Cryptographic

External Email

Quoted 8 lines

----------------------------------------------------------------------

Quoted 4 lines · On Thu, 17 Sep 2020 18:58:31 +0530 Srujana Challa wrote:

The following series adds support for Marvell Cryptographic Acceleration Unit(CPT) on OcteonTX2 CN96XX SoC.
This series is tested with CRYPTO_EXTRA_TESTS enabled and CRYPTO_DISABLE_TESTS disabled.

No writeable debugfs files, please

I would like to get more clarity on few things, would you like debugfs entries to be read only and could you let me know the reason for not having writable entries?

Quoted 4 lines

Please provide more information about how users are going to make use of the functionality and what the capabilities are. You add 10K LoC and patches barely have barely a commit message.

#10 lore raw
In reply to Srujana Challa
Quoted 6 lines · Srujana Challa

The following series adds support for Marvell Cryptographic Acceleration
Unit(CPT) on OcteonTX2 CN96XX SoC.
This series is tested with CRYPTO_EXTRA_TESTS enabled and CRYPTO_DISABLE_TESTS disabled.

I am with Jakub on this one, 10K LOC require more explanation in the cover-letter.
e.g. some background, high level design, device components being added/changed. Basically, what should we expect code-wise before we jump into 10K LOC review..

Quoted 86 lines

Changes since v2:
* Fixed C=1 warnings.
* Added code to exit CPT VF driver gracefully.
* Moved OcteonTx2 asm code to a header file under include/linux/soc/

Changes since v1:
* Moved Makefile changes from patch4 to patch2 and patch3.

Srujana Challa (3):
octeontx2-pf: move asm code to include/linux/soc
octeontx2-af: add support to manage the CPT unit
drivers: crypto: add support for OCTEONTX2 CPT engine
drivers: crypto: add the Virtual Function driver for OcteonTX2 CPT

 MAINTAINERS                                   |    2 +
 drivers/crypto/marvell/Kconfig                |   17 +
 drivers/crypto/marvell/Makefile               |    1 +
 drivers/crypto/marvell/octeontx2/Makefile     |   10 +
 .../marvell/octeontx2/otx2_cpt_common.h       |   53 +
 .../marvell/octeontx2/otx2_cpt_hw_types.h     |  467 ++++
 .../marvell/octeontx2/otx2_cpt_mbox_common.c  |  286 +++
 .../marvell/octeontx2/otx2_cpt_mbox_common.h  |  100 +
 .../marvell/octeontx2/otx2_cpt_reqmgr.h       |  197 ++
 drivers/crypto/marvell/octeontx2/otx2_cptlf.h |  356 +++
 .../marvell/octeontx2/otx2_cptlf_main.c       |  967 ++++++++
 drivers/crypto/marvell/octeontx2/otx2_cptpf.h |   79 +
 .../marvell/octeontx2/otx2_cptpf_main.c       |  598 +++++
 .../marvell/octeontx2/otx2_cptpf_mbox.c       |  694 ++++++
 .../marvell/octeontx2/otx2_cptpf_ucode.c      | 2173
+++++++++++++++++
 .../marvell/octeontx2/otx2_cptpf_ucode.h      |  180 ++
 drivers/crypto/marvell/octeontx2/otx2_cptvf.h |   29 +
 .../marvell/octeontx2/otx2_cptvf_algs.c       | 1698 +++++++++++++
 .../marvell/octeontx2/otx2_cptvf_algs.h       |  172 ++
 .../marvell/octeontx2/otx2_cptvf_main.c       |  229 ++
 .../marvell/octeontx2/otx2_cptvf_mbox.c       |  189 ++
 .../marvell/octeontx2/otx2_cptvf_reqmgr.c     |  540 ++++
 .../ethernet/marvell/octeontx2/af/Makefile    |    3 +-
 .../net/ethernet/marvell/octeontx2/af/mbox.h  |   85 +
 .../net/ethernet/marvell/octeontx2/af/rvu.c   |    2 +-
 .../net/ethernet/marvell/octeontx2/af/rvu.h   |    7 +
 .../ethernet/marvell/octeontx2/af/rvu_cpt.c   |  343 +++
 .../marvell/octeontx2/af/rvu_debugfs.c        |  342 +++
 .../ethernet/marvell/octeontx2/af/rvu_nix.c   |   76 +
 .../ethernet/marvell/octeontx2/af/rvu_reg.h   |   65 +-
 .../marvell/octeontx2/nic/otx2_common.h       |   13 +-
 include/linux/soc/marvell/octeontx2/asm.h     |   29 +
 32 files changed, 9982 insertions(+), 20 deletions(-)
 create mode 100644 drivers/crypto/marvell/octeontx2/Makefile
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_common.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_hw_types.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_reqmgr.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptlf.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptlf_main.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c
 create mode 100644
drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c
 create mode 100644 include/linux/soc/marvell/octeontx2/asm.h
author maintainer
#11 lore raw
Quoted 11 lines

Subject: Re: [PATCH v3,net-next,0/4] Add Support for Marvell OcteonTX2 Cryptographic

Quoted 6 lines · Srujana Challa

The following series adds support for Marvell Cryptographic Acceleration
Unit(CPT) on OcteonTX2 CN96XX SoC.
This series is tested with CRYPTO_EXTRA_TESTS enabled and CRYPTO_DISABLE_TESTS disabled.

Quoted 5 lines

I am with Jakub on this one, 10K LOC require more explanation in the cover-letter.
e.g. some background, high level design, device components being added/changed. Basically, what should we expect code-wise before we jump into 10K LOC review.

Okay, I will split the series up to smaller patches and submit the next version with more information. Thanks.

Quoted 87 lines
Quoted 87 lines

Changes since v2:
* Fixed C=1 warnings.
* Added code to exit CPT VF driver gracefully.
* Moved OcteonTx2 asm code to a header file under include/linux/soc/

Changes since v1:
* Moved Makefile changes from patch4 to patch2 and patch3.

Srujana Challa (3):
octeontx2-pf: move asm code to include/linux/soc
octeontx2-af: add support to manage the CPT unit
drivers: crypto: add support for OCTEONTX2 CPT engine
drivers: crypto: add the Virtual Function driver for OcteonTX2 CPT

 MAINTAINERS                                   |    2 +
 drivers/crypto/marvell/Kconfig                |   17 +
 drivers/crypto/marvell/Makefile               |    1 +
 drivers/crypto/marvell/octeontx2/Makefile     |   10 +
 .../marvell/octeontx2/otx2_cpt_common.h       |   53 +
 .../marvell/octeontx2/otx2_cpt_hw_types.h     |  467 ++++
 .../marvell/octeontx2/otx2_cpt_mbox_common.c  |  286 +++
 .../marvell/octeontx2/otx2_cpt_mbox_common.h  |  100 +
 .../marvell/octeontx2/otx2_cpt_reqmgr.h       |  197 ++
 drivers/crypto/marvell/octeontx2/otx2_cptlf.h |  356 +++
 .../marvell/octeontx2/otx2_cptlf_main.c       |  967 ++++++++
 drivers/crypto/marvell/octeontx2/otx2_cptpf.h |   79 +
 .../marvell/octeontx2/otx2_cptpf_main.c       |  598 +++++
 .../marvell/octeontx2/otx2_cptpf_mbox.c       |  694 ++++++
 .../marvell/octeontx2/otx2_cptpf_ucode.c      | 2173
+++++++++++++++++
 .../marvell/octeontx2/otx2_cptpf_ucode.h      |  180 ++
 drivers/crypto/marvell/octeontx2/otx2_cptvf.h |   29 +
 .../marvell/octeontx2/otx2_cptvf_algs.c       | 1698 +++++++++++++
 .../marvell/octeontx2/otx2_cptvf_algs.h       |  172 ++
 .../marvell/octeontx2/otx2_cptvf_main.c       |  229 ++
 .../marvell/octeontx2/otx2_cptvf_mbox.c       |  189 ++
 .../marvell/octeontx2/otx2_cptvf_reqmgr.c     |  540 ++++
 .../ethernet/marvell/octeontx2/af/Makefile    |    3 +-
 .../net/ethernet/marvell/octeontx2/af/mbox.h  |   85 +
 .../net/ethernet/marvell/octeontx2/af/rvu.c   |    2 +-
 .../net/ethernet/marvell/octeontx2/af/rvu.h   |    7 +
 .../ethernet/marvell/octeontx2/af/rvu_cpt.c   |  343 +++
 .../marvell/octeontx2/af/rvu_debugfs.c        |  342 +++
 .../ethernet/marvell/octeontx2/af/rvu_nix.c   |   76 +
 .../ethernet/marvell/octeontx2/af/rvu_reg.h   |   65 +-
 .../marvell/octeontx2/nic/otx2_common.h       |   13 +-
 include/linux/soc/marvell/octeontx2/asm.h     |   29 +
 32 files changed, 9982 insertions(+), 20 deletions(-)
 create mode 100644 drivers/crypto/marvell/octeontx2/Makefile
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_common.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_hw_types.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_mbox_common.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cpt_reqmgr.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptlf.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptlf_main.c
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptpf.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.h
 create mode 100644 drivers/crypto/marvell/octeontx2/otx2_cptvf.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.h
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_main.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c
 create mode 100644
drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c
 create mode 100644
drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c
 create mode 100644 include/linux/soc/marvell/octeontx2/asm.h