Commit 5f67eef6 authored by Vamsi Attunuru's avatar Vamsi Attunuru Committed by Greg Kroah-Hartman

misc: mrvl-cn10k-dpi: add Octeon CN10K DPI administrative driver

Adds a misc driver for Marvell CN10K DPI(DMA Engine) device's physical
function which initializes DPI DMA hardware's global configuration and
enables hardware mailbox channels between physical function (PF) and
it's virtual functions (VF). VF device drivers (User space drivers) use
this hw mailbox to communicate any required device configuration on it's
respective VF device. Accordingly, this DPI PF driver provisions the
VF device resources.

At the hardware level, the DPI physical function (PF) acts as a management
interface to setup the VF device resources, VF devices are only provisioned
to handle or control the actual DMA Engine's data transfer capabilities.
Signed-off-by: default avatarVamsi Attunuru <vattunuru@marvell.com>
Reviewed-by: default avatarSrujana Challa <schalla@marvell.com>
Link: https://lore.kernel.org/r/20240706153009.3775333-1-vattunuru@marvell.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e56af94b
...@@ -21,6 +21,7 @@ fit into other categories. ...@@ -21,6 +21,7 @@ fit into other categories.
isl29003 isl29003
lis3lv02d lis3lv02d
max6875 max6875
mrvl_cn10k_dpi
oxsemi-tornado oxsemi-tornado
pci-endpoint-test pci-endpoint-test
spear-pcie-gadget spear-pcie-gadget
......
.. SPDX-License-Identifier: GPL-2.0
===============================================
Marvell CN10K DMA packet interface (DPI) driver
===============================================
Overview
========
DPI is a DMA packet interface hardware block in Marvell's CN10K silicon.
DPI hardware comprises a physical function (PF), its virtual functions,
mailbox logic, and a set of DMA engines & DMA command queues.
DPI PF function is an administrative function which services the mailbox
requests from its VF functions and provisions DMA engine resources to
it's VF functions.
mrvl_cn10k_dpi.ko misc driver loads on DPI PF device and services the
mailbox commands submitted by the VF devices and accordingly initializes
the DMA engines and VF device's DMA command queues. Also, driver creates
/dev/mrvl-cn10k-dpi node to set DMA engine and PEM (PCIe interface) port
attributes like fifo length, molr, mps & mrrs.
DPI PF driver is just an administrative driver to setup its VF device's
queues and provisions the hardware resources, it cannot initiate any
DMA operations. Only VF devices are provisioned with DMA capabilities.
Driver location
===============
drivers/misc/mrvl_cn10k_dpi.c
Driver IOCTLs
=============
:c:macro::`DPI_MPS_MRRS_CFG`
ioctl that sets max payload size & max read request size parameters of
a pem port to which DMA engines are wired.
:c:macro::`DPI_ENGINE_CFG`
ioctl that sets DMA engine's fifo sizes & max outstanding load request
thresholds.
User space code example
=======================
DPI VF devices are probed and accessed from user space applications using
vfio-pci driver. Below is a sample dpi dma application to demonstrate on
how applications use mailbox and ioctl services from DPI PF kernel driver.
https://github.com/MarvellEmbeddedProcessors/dpi-sample-app
...@@ -362,6 +362,7 @@ Code Seq# Include File Comments ...@@ -362,6 +362,7 @@ Code Seq# Include File Comments
0xB6 all linux/fpga-dfl.h 0xB6 all linux/fpga-dfl.h
0xB7 all uapi/linux/remoteproc_cdev.h <mailto:linux-remoteproc@vger.kernel.org> 0xB7 all uapi/linux/remoteproc_cdev.h <mailto:linux-remoteproc@vger.kernel.org>
0xB7 all uapi/linux/nsfs.h <mailto:Andrei Vagin <avagin@openvz.org>> 0xB7 all uapi/linux/nsfs.h <mailto:Andrei Vagin <avagin@openvz.org>>
0xB8 01-02 uapi/misc/mrvl_cn10k_dpi.h Marvell CN10K DPI driver
0xC0 00-0F linux/usb/iowarrior.h 0xC0 00-0F linux/usb/iowarrior.h
0xCA 00-0F uapi/misc/cxl.h 0xCA 00-0F uapi/misc/cxl.h
0xCA 10-2F uapi/misc/ocxl.h 0xCA 10-2F uapi/misc/ocxl.h
......
...@@ -13477,6 +13477,11 @@ S: Supported ...@@ -13477,6 +13477,11 @@ S: Supported
F: Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.yaml F: Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.yaml
F: drivers/mmc/host/sdhci-xenon* F: drivers/mmc/host/sdhci-xenon*
MARVELL OCTEON CN10K DPI DRIVER
M: Vamsi Attunuru <vattunuru@marvell.com>
S: Supported
F: drivers/misc/mrvl_cn10k_dpi.c
MATROX FRAMEBUFFER DRIVER MATROX FRAMEBUFFER DRIVER
L: linux-fbdev@vger.kernel.org L: linux-fbdev@vger.kernel.org
S: Orphan S: Orphan
......
...@@ -585,6 +585,20 @@ config NSM ...@@ -585,6 +585,20 @@ config NSM
To compile this driver as a module, choose M here. To compile this driver as a module, choose M here.
The module will be called nsm. The module will be called nsm.
config MARVELL_CN10K_DPI
tristate "Octeon CN10K DPI driver"
depends on PCI
help
Enables Octeon CN10K DMA packet interface (DPI) driver which
intializes DPI hardware's physical function (PF) device's
global configuration and its virtual function (VFs) resource
configuration to enable DMA transfers. DPI PF device does not
have any data movement functionality, it only serves VF's
resource configuration requests.
To compile this driver as a module, choose M here: the module
will be called mrvl_cn10k_dpi.
source "drivers/misc/c2port/Kconfig" source "drivers/misc/c2port/Kconfig"
source "drivers/misc/eeprom/Kconfig" source "drivers/misc/eeprom/Kconfig"
source "drivers/misc/cb710/Kconfig" source "drivers/misc/cb710/Kconfig"
......
...@@ -69,4 +69,5 @@ obj-$(CONFIG_TMR_INJECT) += xilinx_tmr_inject.o ...@@ -69,4 +69,5 @@ obj-$(CONFIG_TMR_INJECT) += xilinx_tmr_inject.o
obj-$(CONFIG_TPS6594_ESM) += tps6594-esm.o obj-$(CONFIG_TPS6594_ESM) += tps6594-esm.o
obj-$(CONFIG_TPS6594_PFSM) += tps6594-pfsm.o obj-$(CONFIG_TPS6594_PFSM) += tps6594-pfsm.o
obj-$(CONFIG_NSM) += nsm.o obj-$(CONFIG_NSM) += nsm.o
obj-$(CONFIG_MARVELL_CN10K_DPI) += mrvl_cn10k_dpi.o
obj-y += keba/ obj-y += keba/
--- drivers/misc/Makefile
+++ drivers/misc/Makefile
@@ -69,3 +69,4 @@ obj-$(CONFIG_TMR_INJECT) += xilinx_tmr_inject.o
obj-$(CONFIG_TPS6594_ESM) += tps6594-esm.o
obj-$(CONFIG_TPS6594_PFSM) += tps6594-pfsm.o
obj-$(CONFIG_NSM) += nsm.o
+obj-$(CONFIG_MARVELL_CN10K_DPI) += mrvl_cn10k_dpi.o
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Marvell Octeon CN10K DPI driver
*
* Copyright (C) 2024 Marvell.
*
*/
#ifndef __MRVL_CN10K_DPI_H__
#define __MRVL_CN10K_DPI_H__
#include <linux/types.h>
#define DPI_MAX_ENGINES 6
struct dpi_mps_mrrs_cfg {
__u16 max_read_req_sz; /* Max read request size */
__u16 max_payload_sz; /* Max payload size */
__u16 port; /* Ebus port */
__u16 reserved; /* Reserved */
};
struct dpi_engine_cfg {
__u64 fifo_mask; /* FIFO size mask in KBytes */
__u16 molr[DPI_MAX_ENGINES]; /* Max outstanding load requests */
__u16 update_molr; /* '1' to update engine MOLR */
__u16 reserved; /* Reserved */
};
/* DPI ioctl numbers */
#define DPI_MAGIC_NUM 0xB8
/* Set MPS & MRRS parameters */
#define DPI_MPS_MRRS_CFG _IOW(DPI_MAGIC_NUM, 1, struct dpi_mps_mrrs_cfg)
/* Set Engine FIFO configuration */
#define DPI_ENGINE_CFG _IOW(DPI_MAGIC_NUM, 2, struct dpi_engine_cfg)
#endif /* __MRVL_CN10K_DPI_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment