Re: [PATCH v4 3/4] dmaengine: Add Broadcom SBA RAID driver
On Wed, Feb 15, 2017 at 12:55 PM, Dan Williams wrote: > On Tue, Feb 14, 2017 at 11:03 PM, Anup Patel wrote: >> On Wed, Feb 15, 2017 at 12:13 PM, Dan Williams >> wrote: >>> On Tue, Feb 14, 2017 at 10:25 PM, Anup Patel >>> wrote: On Tue, Feb 14, 2017 at 10:04 PM, Dan Williams wrote: > On Mon, Feb 13, 2017 at 10:51 PM, Anup Patel > wrote: >> The Broadcom stream buffer accelerator (SBA) provides offloading >> capabilities for RAID operations. This SBA offload engine is >> accessible via Broadcom SoC specific ring manager. >> >> This patch adds Broadcom SBA RAID driver which provides one >> DMA device with RAID capabilities using one or more Broadcom >> SoC specific ring manager channels. The SBA RAID driver in its >> current shape implements memcpy, xor, and pq operations. >> >> Signed-off-by: Anup Patel >> Reviewed-by: Ray Jui >> --- >> drivers/dma/Kconfig| 13 + >> drivers/dma/Makefile |1 + >> drivers/dma/bcm-sba-raid.c | 1694 >> >> 3 files changed, 1708 insertions(+) >> create mode 100644 drivers/dma/bcm-sba-raid.c >> >> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig >> index 263495d..bf8fb84 100644 >> --- a/drivers/dma/Kconfig >> +++ b/drivers/dma/Kconfig >> @@ -99,6 +99,19 @@ config AXI_DMAC >> controller is often used in Analog Device's reference designs >> for FPGA >> platforms. >> >> +config BCM_SBA_RAID >> + tristate "Broadcom SBA RAID engine support" >> + depends on (ARM64 && MAILBOX && RAID6_PQ) || COMPILE_TEST >> + select DMA_ENGINE >> + select DMA_ENGINE_RAID >> + select ASYNC_TX_ENABLE_CHANNEL_SWITCH > > I thought you agreed to drop this. Its usage is broken. If ASYNC_TX_ENABLE_CHANNEL_SWITCH is not selected then async_dma_find_channel() will only try to find channel with DMA_ASYNC_TX capability. The DMA_ASYNC_TX capability is set by dma_async_device_register() when all Async Tx capabilities are supported by a DMA devices namely DMA_INTERRUPT, DMA_MEMCPY, DMA_XOR, DMA_XOR_VAL, DMA_PQ, and DMA_PQ_VAL. We only support DMA_MEMCPY, DMA_XOR, and DMA_PQ capabilities in BCM-SBA-RAID driver so DMA_ASYNC_TX capability is never set for the DMA device registered by BCM-SBA-RAID driver. Due to above, if ASYNC_TX_ENABLE_CHANNEL_SWITCH is not selected then Async Tx APIs fail to find DMA channel provided by BCM-SBA-RAID hence the option ASYNC_TX_ENABLE_CHANNEL_SWITCH is required for BCM-SBA-RAID. The DMA mappings are violated by channel switching only if we switch form DMA channel A to DMA channel B and both these DMA channels have different underlying "struct device". In most of the cases DMA mappings are not violated because DMA channels having Async Tx capabilities are provided using same underlying "struct device". >>> >>> No, fix the infrastructure. Do not put local hack in your driver for >>> this global problem [1]. >> >> There is no hack in the driver. We need >> ASYNC_TX_ENABLE_CHANNEL_SWITCH >> based on current state of dmaengine framework. >> >> The framework should be fixed as separate patchset. >> >> We have other RAID drivers such as xgene-dma and >> mv_xor_v2 who also require >> ASYNC_TX_ENABLE_CHANNEL_SWITCH due >> to same reason. >> >> Fixing the framework and improving framework is >> a ongoing process. I don't see why that should >> stop this patchset. >> > > Because this driver is turning on a dangerous compile time option and > is not using the functionality. If this silicon IP block appears in > another product in the future paired with another DMA engine then the > assumptions about a safe/single dma-device is violated. > > The realization of how async_tx was breaking DMA mapping api > assumptions came after some of these dma-drivers were added to the > kernel. We should stop making the problem worse. > > I should have submitted a patch like the below at the time we > discovered this problem, but unfortunately it languished when I > stopped maintaining the iop-adma and ioat drivers. > > diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig > index 263495d0adbd..6b30eb9ad125 100644 > --- a/drivers/dma/Kconfig > +++ b/drivers/dma/Kconfig > @@ -35,6 +35,7 @@ comment "DMA Devices" > > #core > config ASYNC_TX_ENABLE_CHANNEL_SWITCH > + depends on BROKEN > bool > > config ARCH_HAS_ASYNC_TX_FIND_CHANNEL Instead of selecting ASYNC_TX_ENABLE_CHANNEL_SWITCH, we can select the following in BCM_SBA_RAID config option: 1. ASYNC_TX_DISABLE_XOR_VAL 2. ASYNC_TX_DISABLE_PQ_VAL This will satisfy the needs of dma_async_device_register() when ASYNC_TX_ENABLE_CHANNEL_SWITCH is not selected. Will this be acceptable ?? Regards, Anup
Re: [PATCH v4 3/4] dmaengine: Add Broadcom SBA RAID driver
On Tue, Feb 14, 2017 at 11:03 PM, Anup Patel wrote: > On Wed, Feb 15, 2017 at 12:13 PM, Dan Williams > wrote: >> On Tue, Feb 14, 2017 at 10:25 PM, Anup Patel wrote: >>> On Tue, Feb 14, 2017 at 10:04 PM, Dan Williams >>> wrote: On Mon, Feb 13, 2017 at 10:51 PM, Anup Patel wrote: > The Broadcom stream buffer accelerator (SBA) provides offloading > capabilities for RAID operations. This SBA offload engine is > accessible via Broadcom SoC specific ring manager. > > This patch adds Broadcom SBA RAID driver which provides one > DMA device with RAID capabilities using one or more Broadcom > SoC specific ring manager channels. The SBA RAID driver in its > current shape implements memcpy, xor, and pq operations. > > Signed-off-by: Anup Patel > Reviewed-by: Ray Jui > --- > drivers/dma/Kconfig| 13 + > drivers/dma/Makefile |1 + > drivers/dma/bcm-sba-raid.c | 1694 > > 3 files changed, 1708 insertions(+) > create mode 100644 drivers/dma/bcm-sba-raid.c > > diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig > index 263495d..bf8fb84 100644 > --- a/drivers/dma/Kconfig > +++ b/drivers/dma/Kconfig > @@ -99,6 +99,19 @@ config AXI_DMAC > controller is often used in Analog Device's reference designs > for FPGA > platforms. > > +config BCM_SBA_RAID > + tristate "Broadcom SBA RAID engine support" > + depends on (ARM64 && MAILBOX && RAID6_PQ) || COMPILE_TEST > + select DMA_ENGINE > + select DMA_ENGINE_RAID > + select ASYNC_TX_ENABLE_CHANNEL_SWITCH I thought you agreed to drop this. Its usage is broken. >>> >>> If ASYNC_TX_ENABLE_CHANNEL_SWITCH is not selected >>> then async_dma_find_channel() will only try to find channel >>> with DMA_ASYNC_TX capability. >>> >>> The DMA_ASYNC_TX capability is set by >>> dma_async_device_register() when all Async Tx >>> capabilities are supported by a DMA devices namely >>> DMA_INTERRUPT, DMA_MEMCPY, DMA_XOR, >>> DMA_XOR_VAL, DMA_PQ, and DMA_PQ_VAL. >>> >>> We only support DMA_MEMCPY, DMA_XOR, and >>> DMA_PQ capabilities in BCM-SBA-RAID driver so >>> DMA_ASYNC_TX capability is never set for the >>> DMA device registered by BCM-SBA-RAID driver. >>> >>> Due to above, if ASYNC_TX_ENABLE_CHANNEL_SWITCH >>> is not selected then Async Tx APIs fail to find DMA >>> channel provided by BCM-SBA-RAID hence the >>> option ASYNC_TX_ENABLE_CHANNEL_SWITCH is >>> required for BCM-SBA-RAID. >>> >>> The DMA mappings are violated by channel switching >>> only if we switch form DMA channel A to DMA channel >>> B and both these DMA channels have different underlying >>> "struct device". In most of the cases DMA mappings >>> are not violated because DMA channels having >>> Async Tx capabilities are provided using same >>> underlying "struct device". >> >> No, fix the infrastructure. Do not put local hack in your driver for >> this global problem [1]. > > There is no hack in the driver. We need > ASYNC_TX_ENABLE_CHANNEL_SWITCH > based on current state of dmaengine framework. > > The framework should be fixed as separate patchset. > > We have other RAID drivers such as xgene-dma and > mv_xor_v2 who also require > ASYNC_TX_ENABLE_CHANNEL_SWITCH due > to same reason. > > Fixing the framework and improving framework is > a ongoing process. I don't see why that should > stop this patchset. > Because this driver is turning on a dangerous compile time option and is not using the functionality. If this silicon IP block appears in another product in the future paired with another DMA engine then the assumptions about a safe/single dma-device is violated. The realization of how async_tx was breaking DMA mapping api assumptions came after some of these dma-drivers were added to the kernel. We should stop making the problem worse. I should have submitted a patch like the below at the time we discovered this problem, but unfortunately it languished when I stopped maintaining the iop-adma and ioat drivers. diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 263495d0adbd..6b30eb9ad125 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -35,6 +35,7 @@ comment "DMA Devices" #core config ASYNC_TX_ENABLE_CHANNEL_SWITCH + depends on BROKEN bool config ARCH_HAS_ASYNC_TX_FIND_CHANNEL
Re: [PATCH v4 3/4] dmaengine: Add Broadcom SBA RAID driver
On Wed, Feb 15, 2017 at 12:13 PM, Dan Williams wrote: > On Tue, Feb 14, 2017 at 10:25 PM, Anup Patel wrote: >> On Tue, Feb 14, 2017 at 10:04 PM, Dan Williams >> wrote: >>> On Mon, Feb 13, 2017 at 10:51 PM, Anup Patel >>> wrote: The Broadcom stream buffer accelerator (SBA) provides offloading capabilities for RAID operations. This SBA offload engine is accessible via Broadcom SoC specific ring manager. This patch adds Broadcom SBA RAID driver which provides one DMA device with RAID capabilities using one or more Broadcom SoC specific ring manager channels. The SBA RAID driver in its current shape implements memcpy, xor, and pq operations. Signed-off-by: Anup Patel Reviewed-by: Ray Jui --- drivers/dma/Kconfig| 13 + drivers/dma/Makefile |1 + drivers/dma/bcm-sba-raid.c | 1694 3 files changed, 1708 insertions(+) create mode 100644 drivers/dma/bcm-sba-raid.c diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 263495d..bf8fb84 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -99,6 +99,19 @@ config AXI_DMAC controller is often used in Analog Device's reference designs for FPGA platforms. +config BCM_SBA_RAID + tristate "Broadcom SBA RAID engine support" + depends on (ARM64 && MAILBOX && RAID6_PQ) || COMPILE_TEST + select DMA_ENGINE + select DMA_ENGINE_RAID + select ASYNC_TX_ENABLE_CHANNEL_SWITCH >>> >>> I thought you agreed to drop this. Its usage is broken. >> >> If ASYNC_TX_ENABLE_CHANNEL_SWITCH is not selected >> then async_dma_find_channel() will only try to find channel >> with DMA_ASYNC_TX capability. >> >> The DMA_ASYNC_TX capability is set by >> dma_async_device_register() when all Async Tx >> capabilities are supported by a DMA devices namely >> DMA_INTERRUPT, DMA_MEMCPY, DMA_XOR, >> DMA_XOR_VAL, DMA_PQ, and DMA_PQ_VAL. >> >> We only support DMA_MEMCPY, DMA_XOR, and >> DMA_PQ capabilities in BCM-SBA-RAID driver so >> DMA_ASYNC_TX capability is never set for the >> DMA device registered by BCM-SBA-RAID driver. >> >> Due to above, if ASYNC_TX_ENABLE_CHANNEL_SWITCH >> is not selected then Async Tx APIs fail to find DMA >> channel provided by BCM-SBA-RAID hence the >> option ASYNC_TX_ENABLE_CHANNEL_SWITCH is >> required for BCM-SBA-RAID. >> >> The DMA mappings are violated by channel switching >> only if we switch form DMA channel A to DMA channel >> B and both these DMA channels have different underlying >> "struct device". In most of the cases DMA mappings >> are not violated because DMA channels having >> Async Tx capabilities are provided using same >> underlying "struct device". > > No, fix the infrastructure. Do not put local hack in your driver for > this global problem [1]. There is no hack in the driver. We need ASYNC_TX_ENABLE_CHANNEL_SWITCH based on current state of dmaengine framework. The framework should be fixed as separate patchset. We have other RAID drivers such as xgene-dma and mv_xor_v2 who also require ASYNC_TX_ENABLE_CHANNEL_SWITCH due to same reason. Fixing the framework and improving framework is a ongoing process. I don't see why that should stop this patchset. Regards, Anup
Re: [PATCH v4 3/4] dmaengine: Add Broadcom SBA RAID driver
On Tue, Feb 14, 2017 at 10:25 PM, Anup Patel wrote: > On Tue, Feb 14, 2017 at 10:04 PM, Dan Williams > wrote: >> On Mon, Feb 13, 2017 at 10:51 PM, Anup Patel wrote: >>> The Broadcom stream buffer accelerator (SBA) provides offloading >>> capabilities for RAID operations. This SBA offload engine is >>> accessible via Broadcom SoC specific ring manager. >>> >>> This patch adds Broadcom SBA RAID driver which provides one >>> DMA device with RAID capabilities using one or more Broadcom >>> SoC specific ring manager channels. The SBA RAID driver in its >>> current shape implements memcpy, xor, and pq operations. >>> >>> Signed-off-by: Anup Patel >>> Reviewed-by: Ray Jui >>> --- >>> drivers/dma/Kconfig| 13 + >>> drivers/dma/Makefile |1 + >>> drivers/dma/bcm-sba-raid.c | 1694 >>> >>> 3 files changed, 1708 insertions(+) >>> create mode 100644 drivers/dma/bcm-sba-raid.c >>> >>> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig >>> index 263495d..bf8fb84 100644 >>> --- a/drivers/dma/Kconfig >>> +++ b/drivers/dma/Kconfig >>> @@ -99,6 +99,19 @@ config AXI_DMAC >>> controller is often used in Analog Device's reference designs for >>> FPGA >>> platforms. >>> >>> +config BCM_SBA_RAID >>> + tristate "Broadcom SBA RAID engine support" >>> + depends on (ARM64 && MAILBOX && RAID6_PQ) || COMPILE_TEST >>> + select DMA_ENGINE >>> + select DMA_ENGINE_RAID >>> + select ASYNC_TX_ENABLE_CHANNEL_SWITCH >> >> I thought you agreed to drop this. Its usage is broken. > > If ASYNC_TX_ENABLE_CHANNEL_SWITCH is not selected > then async_dma_find_channel() will only try to find channel > with DMA_ASYNC_TX capability. > > The DMA_ASYNC_TX capability is set by > dma_async_device_register() when all Async Tx > capabilities are supported by a DMA devices namely > DMA_INTERRUPT, DMA_MEMCPY, DMA_XOR, > DMA_XOR_VAL, DMA_PQ, and DMA_PQ_VAL. > > We only support DMA_MEMCPY, DMA_XOR, and > DMA_PQ capabilities in BCM-SBA-RAID driver so > DMA_ASYNC_TX capability is never set for the > DMA device registered by BCM-SBA-RAID driver. > > Due to above, if ASYNC_TX_ENABLE_CHANNEL_SWITCH > is not selected then Async Tx APIs fail to find DMA > channel provided by BCM-SBA-RAID hence the > option ASYNC_TX_ENABLE_CHANNEL_SWITCH is > required for BCM-SBA-RAID. > > The DMA mappings are violated by channel switching > only if we switch form DMA channel A to DMA channel > B and both these DMA channels have different underlying > "struct device". In most of the cases DMA mappings > are not violated because DMA channels having > Async Tx capabilities are provided using same > underlying "struct device". No, fix the infrastructure. Do not put local hack in your driver for this global problem [1]. [1]: https://lwn.net/Articles/443531/
Re: [PATCH v4 3/4] dmaengine: Add Broadcom SBA RAID driver
On Tue, Feb 14, 2017 at 10:04 PM, Dan Williams wrote: > On Mon, Feb 13, 2017 at 10:51 PM, Anup Patel wrote: >> The Broadcom stream buffer accelerator (SBA) provides offloading >> capabilities for RAID operations. This SBA offload engine is >> accessible via Broadcom SoC specific ring manager. >> >> This patch adds Broadcom SBA RAID driver which provides one >> DMA device with RAID capabilities using one or more Broadcom >> SoC specific ring manager channels. The SBA RAID driver in its >> current shape implements memcpy, xor, and pq operations. >> >> Signed-off-by: Anup Patel >> Reviewed-by: Ray Jui >> --- >> drivers/dma/Kconfig| 13 + >> drivers/dma/Makefile |1 + >> drivers/dma/bcm-sba-raid.c | 1694 >> >> 3 files changed, 1708 insertions(+) >> create mode 100644 drivers/dma/bcm-sba-raid.c >> >> diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig >> index 263495d..bf8fb84 100644 >> --- a/drivers/dma/Kconfig >> +++ b/drivers/dma/Kconfig >> @@ -99,6 +99,19 @@ config AXI_DMAC >> controller is often used in Analog Device's reference designs for >> FPGA >> platforms. >> >> +config BCM_SBA_RAID >> + tristate "Broadcom SBA RAID engine support" >> + depends on (ARM64 && MAILBOX && RAID6_PQ) || COMPILE_TEST >> + select DMA_ENGINE >> + select DMA_ENGINE_RAID >> + select ASYNC_TX_ENABLE_CHANNEL_SWITCH > > I thought you agreed to drop this. Its usage is broken. If ASYNC_TX_ENABLE_CHANNEL_SWITCH is not selected then async_dma_find_channel() will only try to find channel with DMA_ASYNC_TX capability. The DMA_ASYNC_TX capability is set by dma_async_device_register() when all Async Tx capabilities are supported by a DMA devices namely DMA_INTERRUPT, DMA_MEMCPY, DMA_XOR, DMA_XOR_VAL, DMA_PQ, and DMA_PQ_VAL. We only support DMA_MEMCPY, DMA_XOR, and DMA_PQ capabilities in BCM-SBA-RAID driver so DMA_ASYNC_TX capability is never set for the DMA device registered by BCM-SBA-RAID driver. Due to above, if ASYNC_TX_ENABLE_CHANNEL_SWITCH is not selected then Async Tx APIs fail to find DMA channel provided by BCM-SBA-RAID hence the option ASYNC_TX_ENABLE_CHANNEL_SWITCH is required for BCM-SBA-RAID. The DMA mappings are violated by channel switching only if we switch form DMA channel A to DMA channel B and both these DMA channels have different underlying "struct device". In most of the cases DMA mappings are not violated because DMA channels having Async Tx capabilities are provided using same underlying "struct device". Regards, Anup
Re: [PATCH v4 3/4] dmaengine: Add Broadcom SBA RAID driver
On Mon, Feb 13, 2017 at 10:51 PM, Anup Patel wrote: > The Broadcom stream buffer accelerator (SBA) provides offloading > capabilities for RAID operations. This SBA offload engine is > accessible via Broadcom SoC specific ring manager. > > This patch adds Broadcom SBA RAID driver which provides one > DMA device with RAID capabilities using one or more Broadcom > SoC specific ring manager channels. The SBA RAID driver in its > current shape implements memcpy, xor, and pq operations. > > Signed-off-by: Anup Patel > Reviewed-by: Ray Jui > --- > drivers/dma/Kconfig| 13 + > drivers/dma/Makefile |1 + > drivers/dma/bcm-sba-raid.c | 1694 > > 3 files changed, 1708 insertions(+) > create mode 100644 drivers/dma/bcm-sba-raid.c > > diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig > index 263495d..bf8fb84 100644 > --- a/drivers/dma/Kconfig > +++ b/drivers/dma/Kconfig > @@ -99,6 +99,19 @@ config AXI_DMAC > controller is often used in Analog Device's reference designs for > FPGA > platforms. > > +config BCM_SBA_RAID > + tristate "Broadcom SBA RAID engine support" > + depends on (ARM64 && MAILBOX && RAID6_PQ) || COMPILE_TEST > + select DMA_ENGINE > + select DMA_ENGINE_RAID > + select ASYNC_TX_ENABLE_CHANNEL_SWITCH I thought you agreed to drop this. Its usage is broken.
[PATCH v4 3/4] dmaengine: Add Broadcom SBA RAID driver
The Broadcom stream buffer accelerator (SBA) provides offloading capabilities for RAID operations. This SBA offload engine is accessible via Broadcom SoC specific ring manager. This patch adds Broadcom SBA RAID driver which provides one DMA device with RAID capabilities using one or more Broadcom SoC specific ring manager channels. The SBA RAID driver in its current shape implements memcpy, xor, and pq operations. Signed-off-by: Anup Patel Reviewed-by: Ray Jui --- drivers/dma/Kconfig| 13 + drivers/dma/Makefile |1 + drivers/dma/bcm-sba-raid.c | 1694 3 files changed, 1708 insertions(+) create mode 100644 drivers/dma/bcm-sba-raid.c diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 263495d..bf8fb84 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -99,6 +99,19 @@ config AXI_DMAC controller is often used in Analog Device's reference designs for FPGA platforms. +config BCM_SBA_RAID + tristate "Broadcom SBA RAID engine support" + depends on (ARM64 && MAILBOX && RAID6_PQ) || COMPILE_TEST + select DMA_ENGINE + select DMA_ENGINE_RAID + select ASYNC_TX_ENABLE_CHANNEL_SWITCH + default ARCH_BCM_IPROC + help + Enable support for Broadcom SBA RAID Engine. The SBA RAID + engine is available on most of the Broadcom iProc SoCs. It + has the capability to offload memcpy, xor and pq computation + for raid5/6. + config COH901318 bool "ST-Ericsson COH901318 DMA support" select DMA_ENGINE diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index a4fa336..ba96bdd 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/ obj-$(CONFIG_AT_HDMAC) += at_hdmac.o obj-$(CONFIG_AT_XDMAC) += at_xdmac.o obj-$(CONFIG_AXI_DMAC) += dma-axi-dmac.o +obj-$(CONFIG_BCM_SBA_RAID) += bcm-sba-raid.o obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c new file mode 100644 index 000..279e5e2 --- /dev/null +++ b/drivers/dma/bcm-sba-raid.c @@ -0,0 +1,1694 @@ +/* + * Copyright (C) 2017 Broadcom + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * Broadcom SBA RAID Driver + * + * The Broadcom stream buffer accelerator (SBA) provides offloading + * capabilities for RAID operations. The SBA offload engine is accessible + * via Broadcom SoC specific ring manager. Two or more offload engines + * can share same Broadcom SoC specific ring manager due to this Broadcom + * SoC specific ring manager driver is implemented as a mailbox controller + * driver and offload engine drivers are implemented as mallbox clients. + * + * Typically, Broadcom SoC specific ring manager will implement larger + * number of hardware rings over one or more SBA hardware devices. By + * design, the internal buffer size of SBA hardware device is limited + * but all offload operations supported by SBA can be broken down into + * multiple small size requests and executed parallely on multiple SBA + * hardware devices for achieving high through-put. + * + * The Broadcom SBA RAID driver does not require any register programming + * except submitting request to SBA hardware device via mailbox channels. + * This driver implements a DMA device with one DMA channel using a set + * of mailbox channels provided by Broadcom SoC specific ring manager + * driver. To exploit parallelism (as described above), all DMA request + * coming to SBA RAID DMA channel are broken down to smaller requests + * and submitted to multiple mailbox channels in round-robin fashion. + * For having more SBA DMA channels, we can create more SBA device nodes + * in Broadcom SoC specific DTS based on number of hardware rings supported + * by Broadcom SoC ring manager. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dmaengine.h" + +/* SBA command related defines */ +#define SBA_TYPE_SHIFT 48 +#define SBA_TYPE_MASK GENMASK(1, 0) +#define SBA_TYPE_A 0x0 +#define SBA_TYPE_B 0x2 +#define SBA_TYPE_C 0x3 +#define SBA_USER_DEF_SHIFT 32 +#define SBA_USER_DEF_MASK GENMASK(15, 0) +#define SBA_R_MDATA_SHIFT 24 +#define SBA_R_MDATA_MASK GENMASK(7, 0) +#define SBA_C_MDATA_MS_SHIFT 18 +#define SBA_C_MDATA_MS_MASKGENMASK(1, 0) +#def