Skip to content
Permalink
Browse files
drivers: crypto: add support for OCTEONTX2 CPT engine
Add support for the cryptographic acceleration unit (CPT) on
OcteonTX2 CN96XX SoC.

Signed-off-by: Suheil Chandran <schandran@marvell.com>
Signed-off-by: Lukas Bartosik <lbartosik@marvell.com>
Signed-off-by: Srujana Challa <schalla@marvell.com>
  • Loading branch information
SruChalla authored and intel-lab-lkp committed Sep 17, 2020
1 parent 8db1824 commit bc79b89570c07aabe9985f837486d3d7a0793136
Show file tree
Hide file tree
Showing 15 changed files with 5,088 additions and 0 deletions.
@@ -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
@@ -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/
@@ -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
@@ -0,0 +1,53 @@
/* SPDX-License-Identifier: GPL-2.0-only
* Copyright (C) 2020 Marvell.
*/

#ifndef __OTX2_CPT_COMMON_H
#define __OTX2_CPT_COMMON_H

#include <linux/pci.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/crypto.h>
#include "otx2_cpt_hw_types.h"
#include "rvu.h"

#define OTX2_CPT_MAX_VFS_NUM 128
#define OTX2_CPT_MAX_LFS_NUM 64

#define OTX2_CPT_RVU_PFFUNC(pf, func) \
((((pf) & RVU_PFVF_PF_MASK) << RVU_PFVF_PF_SHIFT) | \
(((func) & RVU_PFVF_FUNC_MASK) << RVU_PFVF_FUNC_SHIFT))

#define OTX2_CPT_RVU_FUNC_ADDR_S(blk, slot, offs) \
(((blk) << 20) | ((slot) << 12) | (offs))

#define OTX2_CPT_DMA_MINALIGN 128
#define OTX2_CPT_INVALID_CRYPTO_ENG_GRP 0xFF

#define OTX2_CPT_NAME_LENGTH 64

#define BAD_OTX2_CPT_ENG_TYPE OTX2_CPT_MAX_ENG_TYPES

enum otx2_cpt_eng_type {
OTX2_CPT_AE_TYPES = 1,
OTX2_CPT_SE_TYPES = 2,
OTX2_CPT_IE_TYPES = 3,
OTX2_CPT_MAX_ENG_TYPES,
};

static inline void otx2_cpt_write64(void __iomem *reg_base, u64 blk, u64 slot,
u64 offs, u64 val)
{
writeq_relaxed(val, reg_base +
OTX2_CPT_RVU_FUNC_ADDR_S(blk, slot, offs));
}

static inline u64 otx2_cpt_read64(void __iomem *reg_base, u64 blk, u64 slot,
u64 offs)
{
return readq_relaxed(reg_base +
OTX2_CPT_RVU_FUNC_ADDR_S(blk, slot, offs));
}
#endif /* __OTX2_CPT_COMMON_H */

0 comments on commit bc79b89

Please sign in to comment.