Broadcom FlexRM ring manager support
Subsystems (3)
v4 cover Broadcom FlexRM ring manager support
The Broadcom FlexRM ring manager provides producer-consumer style ring interface for offload engines on Broadcom iProc SoCs. We can have one or more instances of Broadcom FlexRM ring manager in a SoC.
This patchset adds a mailbox driver for Broadcom FlexRM ring manager which can be used by offload engine drivers as mailbox clients.
The Broadcom FlexRM mailbox driver is feature complete for RAID and Crypto offload engines. We will have incremental patches in-future for ring-level statistics using debugfs and minor optimizations.
This patchset is based on Linux-4.10-rc2 and it is also available at flexrm-v4 branch of https://github.com/Broadcom/arm64-linux.git
Changes since v3:
- Fixed mailbox client example DT node in DT bindings document
Changes since v2:
- Rebased patches for Linux-4.10-rc2
Changes since v1:
- Use compatile string as brcm,iproc-flexrm-mbox
- Rephrase commit message and text in DT bindings patch
Anup Patel (2):
mailbox: Add driver for Broadcom FlexRM ring manager
dt-bindings: Add DT bindings info for FlexRM ring manager
.../bindings/mailbox/brcm,iproc-flexrm-mbox.txt | 59 ++ drivers/mailbox/Kconfig | 11 + drivers/mailbox/Makefile | 2 + drivers/mailbox/mailbox-flexrm/Makefile | 6 + drivers/mailbox/mailbox-flexrm/flexrm-desc.c | 764 +++++++++++++++++++ drivers/mailbox/mailbox-flexrm/flexrm-desc.h | 47 ++ drivers/mailbox/mailbox-flexrm/flexrm-main.c | 829 +++++++++++++++++++++ include/linux/mailbox/brcm-message.h | 14 +- 8 files changed, 1728 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,iproc-flexrm-mbox.txt create mode 100644 drivers/mailbox/mailbox-flexrm/Makefile create mode 100644 drivers/mailbox/mailbox-flexrm/flexrm-desc.c create mode 100644 drivers/mailbox/mailbox-flexrm/flexrm-desc.h create mode 100644 drivers/mailbox/mailbox-flexrm/flexrm-main.c
Signature · 1 line
2.7.4
PATCH v4 1/2 mailbox: Add driver for Broadcom FlexRM ring manager
Some of the Broadcom iProc SoCs have FlexRM ring manager which provides a ring-based programming interface to various offload engines (e.g. RAID, Crypto, etc).
This patch adds a common mailbox driver for Broadcom FlexRM ring manager which can be shared by various offload engine drivers (implemented as mailbox clients).
--- drivers/mailbox/Kconfig | 11 + drivers/mailbox/Makefile | 2 + drivers/mailbox/mailbox-flexrm/Makefile | 6 + drivers/mailbox/mailbox-flexrm/flexrm-desc.c | 764 ++++++++++++++++++++++++ drivers/mailbox/mailbox-flexrm/flexrm-desc.h | 47 ++ drivers/mailbox/mailbox-flexrm/flexrm-main.c | 829 +++++++++++++++++++++++++++ include/linux/mailbox/brcm-message.h | 14 +- 7 files changed, 1669 insertions(+), 4 deletions(-) create mode 100644 drivers/mailbox/mailbox-flexrm/Makefile create mode 100644 drivers/mailbox/mailbox-flexrm/flexrm-desc.c create mode 100644 drivers/mailbox/mailbox-flexrm/flexrm-desc.h create mode 100644 drivers/mailbox/mailbox-flexrm/flexrm-main.c
drivers/mailbox/Kconfig +11 -0
@@ -152,4 +152,15 @@ config BCM_PDC_MBOX Mailbox implementation for the Broadcom PDC ring manager, which provides access to various offload engines on Broadcom SoCs. Say Y here if you want to use the Broadcom PDC. + +config BCM_FLEXRM_MBOX + tristate "Broadcom FlexRM Mailbox" + depends on ARM64 || COMPILE_TEST + depends on HAS_DMA + select GENERIC_MSI_IRQ_DOMAIN + default ARCH_BCM_IPROC + help + Mailbox implementation of the Broadcom FlexRM ring manager, + which provides access to various offload engines on Broadcom + SoCs. Say Y here if you want to use the Broadcom FlexRM. endif
drivers/mailbox/Makefile +2 -0
@@ -30,4 +30,6 @@ obj-$(CONFIG_HI6220_MBOX) += hi6220-mailbox.o obj-$(CONFIG_BCM_PDC_MBOX) += bcm-pdc-mailbox.o +obj-$(CONFIG_BCM_FLEXRM_MBOX) += mailbox-flexrm/ + obj-$(CONFIG_TEGRA_HSP_MBOX) += tegra-hsp.o
drivers/mailbox/mailbox-flexrm/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for Broadcom FlexRM Mailbox Driver. +# + +flexrm-mbox-objs := flexrm-main.o flexrm-desc.o +obj-$(CONFIG_BCM_FLEXRM_MBOX) += flexrm-mbox.o
drivers/mailbox/mailbox-flexrm/flexrm-desc.c new file +764 -0
764 lines not on this page · raw message
drivers/mailbox/mailbox-flexrm/flexrm-desc.h new file +47 -0
47 lines not on this page · raw message
drivers/mailbox/mailbox-flexrm/flexrm-main.c new file +829 -0
829 lines not on this page · raw message
include/linux/mailbox/brcm-message.h +10 -4
@@ -16,6 +16,7 @@enum brcm_message_type {BRCM_MESSAGE_UNKNOWN =0 , +BRCM_MESSAGE_BATCH ,BRCM_MESSAGE_SPU ,BRCM_MESSAGE_SBA ,BRCM_MESSAGE_MAX ,
@@ -23,24 +24,29 @@ enum brcm_message_type {struct brcm_sba_command {u64 cmd; +u64 *cmd_dma; +dma_addr_t cmd_dma_addr;#define BRCM_SBA_CMD_TYPE_A BIT(0)#define BRCM_SBA_CMD_TYPE_B BIT(1)#define BRCM_SBA_CMD_TYPE_C BIT(2)#define BRCM_SBA_CMD_HAS_RESP BIT(3)#define BRCM_SBA_CMD_HAS_OUTPUT BIT(4)u64 flags; -dma_addr_t input; -size_t input_len;dma_addr_t resp;size_t resp_len; -dma_addr_t output; -size_t output_len; +dma_addr_t data; +size_t data_len; };struct brcm_message {enum brcm_message_type type;union {struct { +struct brcm_message *msgs; +unsigned int msgs_queued; +unsigned int msgs_count; + } batch; +struct {struct scatterlist *src;struct scatterlist *dst; } spu;
Signature · 1 line
2.7.4
Re: [PATCH v4 1/2] mailbox: Add driver for Broadcom FlexRM ring manager
Hi All,
Any comments on this patch ??
Regards,
Anup
Re: [PATCH v4 1/2] mailbox: Add driver for Broadcom FlexRM ring manager
Hi Anup,
Quoted 7 lines · Anup Patel
Hi All,
Any comments on this patch ??
Regards,
Anup
Looks good to me.
Jassi, can you pickup this patchset?
Scott
PATCH v4 2/2 dt-bindings: Add DT bindings info for FlexRM ring manager
In reply to Anup PatelThis patch adds device tree bindings document for the FlexRM ring manager found on Broadcom iProc SoCs.
--- .../bindings/mailbox/brcm,iproc-flexrm-mbox.txt | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,iproc-flexrm-mbox.txt
Documentation/devicetree/bindings/mailbox/brcm,iproc-flexrm-mbox.txt new file +59 -0
@@ -0,0 +1,59 @@ +Broadcom FlexRM Ring Manager +============================ +The Broadcom FlexRM ring manager provides a set of rings which can be +used to submit work to offload engines. An SoC may have multiple FlexRM +hardware blocks. There is one device tree entry per FlexRM block. The +FlexRM driver will create a mailbox-controller instance for given FlexRM +hardware block where each mailbox channel is a separate FlexRM ring. + +Required properties: +-------------------- +- compatible: Should be "brcm,iproc-flexrm-mbox" +- reg: Specifies base physical address and size of the FlexRM + ring registers +- msi-parent: Phandles (and potential Device IDs) to MSI controllers + The FlexRM engine will send MSIs (instead of wired + interrupts) to CPU. There is one MSI for each FlexRM ring. + Refer devicetree/bindings/interrupt-controller/msi.txt +- #mbox-cells: Specifies the number of cells needed to encode a mailbox + channel. This should be 3. + + The 1st cell is the mailbox channel number. + + The 2nd cell contains MSI completion threshold. This is the + number of completion messages for which FlexRM will inject + one MSI interrupt to CPU. + + The 3nd cell contains MSI timer value representing time for + which FlexRM will wait to accumulate N completion messages + where N is the value specified by 2nd cell above. If FlexRM + does not get required number of completion messages in time + specified by this cell then it will inject one MSI interrupt + to CPU provided atleast one completion message is available. + +Optional properties: +-------------------- +- dma-coherent: Present if DMA operations made by the FlexRM engine (such + as DMA descriptor access, access to buffers pointed by DMA + descriptors and read/write pointer updates to DDR) are + cache coherent with the CPU. + +Example: +-------- +crypto_mbox: mbox at 67000000 { + compatible = "brcm,iproc-flexrm-mbox"; + reg = <0x67000000 0x200000>; + msi-parent = <&gic_its 0x7f00>; + #mbox-cells = <3>; +}; + +crypto at 672c0000 { + compatible = "brcm,spu2-v2-crypto"; + reg = <0x672c0000 0x1000>; + mboxes = <&crypto_mbox 0 0x1 0xffff>, + <&crypto_mbox 1 0x1 0xffff>, + <&crypto_mbox 16 0x1 0xffff>, + <&crypto_mbox 17 0x1 0xffff>, + <&crypto_mbox 30 0x1 0xffff>, + <&crypto_mbox 31 0x1 0xffff>; +};
Signature · 1 line
2.7.4
Re: [PATCH v4 2/2] dt-bindings: Add DT bindings info for FlexRM ring manager
Quoted 10 lines · Anup Patel
This patch adds device tree bindings document for the FlexRM ring manager found on Broadcom iProc SoCs.
Reviewed-by Ray Jui <[email protected]>Reviewed-by Scott Branden <[email protected]>Signed-off-by Anup Patel <[email protected]>--- .../bindings/mailbox/brcm,iproc-flexrm-mbox.txt | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/brcm,iproc-flexrm-mbox.txt