mailbox: xgene: Add support for APM X-Gene SoC Queue Manager/Traffic Manager
Subsystems (5)
v3 cover mailbox: xgene: Add support for APM X-Gene SoC Queue Manager/Traffic Manager
This patch adds support for APM X-Gene SoC Queue Manager/Traffic Manager.
QMTM is required by APM X-Gene SoC Ethernet, PktDMA (XOR Engine) and Security Engine subsystems. All subsystems communicate with QMTM using messages which include information about the work to be performed and the location of associated data buffers.
V3:
* Switch to mailbox framework
* Add support for little and big endian kernel
* Change virt_to_phys function call to dma_zalloc_coherent
V2:
* Adding COMPILE_TEST dependency for QMTM in Kconfig
* Updated license banner as per review comments
* Fixed alignment for macros
* Changed EXPORT_SYMBOL to EXPORT_SYMBOL_GPL
V1:
* inital version
---
Ravi Patel (4):
Documentation: mailbox: APM X-Gene SoC QMTM
Documentation: devicetree: bindings for APM X-Gene SoC QMTM
mailbox: xgene: base driver for APM X-Gene SoC QMTM
arm64: boot: dts: entries for APM X-Gene SoC QMTM
.../devicetree/bindings/mailbox/apm-xgene-qmtm.txt | 53 ++ Documentation/mailbox/apm-xgene-qmtm.txt | 149 ++++++ MAINTAINERS | 9 + arch/arm64/boot/dts/apm-storm.dtsi | 18 +- drivers/mailbox/Kconfig | 2 + drivers/mailbox/Makefile | 1 + drivers/mailbox/xgene/Kconfig | 9 + drivers/mailbox/xgene/Makefile | 7 + drivers/mailbox/xgene/xgene_qmtm_main.c | 516 ++++++++++++++++++++ drivers/mailbox/xgene/xgene_qmtm_main.h | 112 +++++ drivers/mailbox/xgene/xgene_qmtm_storm.c | 358 ++++++++++++++ include/linux/platform_data/xgene_qmtm.h | 300 ++++++++++++ 12 files changed, 1533 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/mailbox/apm-xgene-qmtm.txt create mode 100644 Documentation/mailbox/apm-xgene-qmtm.txt create mode 100644 drivers/mailbox/xgene/Kconfig create mode 100644 drivers/mailbox/xgene/Makefile create mode 100644 drivers/mailbox/xgene/xgene_qmtm_main.c create mode 100644 drivers/mailbox/xgene/xgene_qmtm_main.h create mode 100644 drivers/mailbox/xgene/xgene_qmtm_storm.c create mode 100644 include/linux/platform_data/xgene_qmtm.h
Signature · 1 line
1.7.9.5
PATCH v3 1/4 Documentation: mailbox: APM X-Gene SoC QMTM
This patch adds documentation for APM X-Gene SoC Queue Manager/Traffic Manager.
--- Documentation/mailbox/apm-xgene-qmtm.txt | 149 ++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 Documentation/mailbox/apm-xgene-qmtm.txt
Documentation/mailbox/apm-xgene-qmtm.txt new file +149 -0
@@ -0,0 +1,149 @@ +AppliedMicro X-Gene SOC Queue Manager/Traffic Manager Document + +Copyright (c) 2013 Applied Micro Circuits Corporation. +Author: Ravi Patel <[email protected]> + +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. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + + +Overview: +QMTM is a device which interacts with CPU, Ethernet, PktDMA and Security +subsystems through AXI BUS. Its centralized resource manager/driver exports +APIs for CPU, Ethernet, PktDMA and Security subsystems to +1. Initialize & allocate queue & pbn. +2. Read queue state so that subsystems driver knows how much more work it can + offload to its subsystem. +3. Apply QoS for subsystems on their queues. + +Layout: +The layout represents run-time flow of messages between Ethernet subsystem, CPU +and QMTM in APM X-Gene SOC. PktDMA and Security subsystems interfaces with QMTM +in the same way as Ethernet. + + + CPU + o-------------------------o + | | + +----|[2] {5}|----+ + | | [1] {4} | | +Register | o------+-----------+------o | Register +Write | CPU WR | | CPU RD | Write +to start v MSG v ^ MSG v to notify +packet | | DDR | | packet +transmit | o--------+-----o-----+--------o | received + | | Q0 M . M M | M M . M Q1 | | + | | for S . S S | S S . S for | | + | | ETH G . G G | G G . G ETH | | + | | TX n . 2 1 | 1 2 . n RX | | + | o----------+---o---+----------o | + | | | | + v v ^ v + | | | | +o--------|-------------|-------|-------------|--------o +| | | | | | Coherent +| v v ^ v | I/O +| | | | | | BUS +o--------|-------------|-------|-------------|--------o + | [3] | | {3} | + v QMTM RD v ^ QMTM WR v + | MSG | | MSG | + o----+----o--------+---o---+--------o----+----o + | Queue 0 | | | Queue 1 | + | Command o ETH PBN 0 o CPU PBN 0 o Command | Queue Manager/ + | Register| | |Register | Traffic Manager + o---------o---+--------o--------+---o---------o + | | + v ^ +Ethernet RD MSG | [4] ETH {2} | Ethernet WR MSG +from its PBN o---+-----------------+---o to CPU PBN + | | + | Egress MAC Ingress MAC | + | [5] {1} | + o------|-----------|------o + v ^ + | | + TX Data RX Data + +Transmit Flow +[1] CPU (Ethernet driver) prepares 32 byte Ethernet egress work message and + enqueues the message to the queue in DDR. +[2] CPU (Ethernet driver) notifies QMTM that there is a message enqueued in + Ethernet transmit queue (e.g. Q0). +[3] QMTM prefetches the Ethernet egress work messages into Ethernet PBN + (e.g. ETH PBN 0). +[4] Ethernet reads work messages from its PBN. +[5] Ethernet DMAs payload from DDR to its egress FIFO and transmits data out. + +Receive Flow +{1} Ethernet receives data and DMAs payload from its ingress FIFO to DDR and + prepares a Ethernet ingress work message. +{2} Ethernet pushes work message to QMTM. +{3} QMTM prefetches the Ethernet ingress work messages into CPU PBN + (e.g. CPU PBN 0) and then interrupts CPU. +{4} CPU (Ethernet driver) dequeues the 32 bytes Ethernet ingress work message + from the queue in DDR. +{5} CPU (Ethernet driver) notifies QMTM that it dequeued a message from + Ethernet receive queue (e.g. Q1). + + +Definition: +1. QMTM (Queue/Traffic Manager) + QMTM manages queues and pbns for CPU, Ethernet, PktDMA and Security + Subsystems. It also performs flow control and QoS on queues. + +2. Slave/Client/Agent + Ethernet, PktDMA (XOR Engine) and Security Engine Subsystems & CPU whose + queues and pbn are managed by QMTM are called slave/client/agent. + +3. Queue + Queue is circular FIFO memory for QMTM hardware in which a 16 bytes, + 32 bytes or 64 bytes message is dequeued OR enqueued between CPU and + Ethernet, PktDMA and Security Engine Subsystems. + +4. PB + Each subsystem in the APM X-Gene SoC device has a prefetch buffer for + storing messages in order to pipeline the QMTM processing latency with the + subsystem processing latency. The number of buffers prefetched depends on + the QM/TM processing latency and the subsystem data rate. + + There are multiple PB for a subsystem, each PB is assigned a number which is + called PBN. Each subsystem and CPU can have max 32 pbns, however QMTM limits + how many pbns it supports for each subsystem. + +5. Message + The subsystems in the APM X-Gene SoC communicate with a central Queue Manager + (QM) that manages all the messages queued to the subsystems. The subsystems + communicate with the QM using messages that include information about the + work to be performed and the location of the buffers or data on which the + work is to be performed. + + A message consists of 16, 32 or 64 bytes which resides in a queue. A message + which is + a. 16 bytes contains information of data buffer, length, etc. allocated by + subsystem driver. + b. 32 or 64 bytes contains information about the work to be done for a + subsystem. Each subsystem defines its own format of work message. + + Each subsystem defines their own format of work message. A message (or queue + descriptor) has attribute fields (QMTM specific) which are common for all + subsystem work messages. The remaining fields of a message are specific to + subsystem. QMTM device doesn't have any knowledge of these subsystems + specific fields and the data operation which subsystem is going to perform + using these fields. + + e.g. + 1. Ethernet work message includes data address & length which is used by + Ethernet DMA engine for copying the data to/from its internal FIFO. + 2. PktDMA work message includes multiple data addresses & lengths for + doing scatter/gather, XOR operations and result data address/es to give + back result to the CPU (driver). + 3. Security work message includes data address & length for doing encryption + or decryption, the type of encryption or decryption and result data + address to give back result to the CPU (driver).
Signature · 1 line
1.7.9.5
PATCH v3 2/4 Documentation: devicetree: bindings for APM X-Gene SoC QMTM
In reply to Ravi PatelThis patch adds devicetree bindings documentation for APM X-Gene SoC Queue Manager/Traffic Manager.
--- .../devicetree/bindings/mailbox/apm-xgene-qmtm.txt | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/mailbox/apm-xgene-qmtm.txt
Documentation/devicetree/bindings/mailbox/apm-xgene-qmtm.txt new file +53 -0
@@ -0,0 +1,53 @@ +* APM X-Gene SoC Queue Manager/Traffic Manager mailbox nodes + +Mailbox nodes are defined to describe on-chip Queue Managers in APM X-Gene SoC. +APM X-Gene SoC Ethernet, PktDMA (XOR Engine), and Security Engine subsystems +communicate with a central Queue Manager using messages which include +information about the work to be performed and the location of the associated +data buffers. There are multiple instances of QMTM. Each QMTM instance has its +own node. Its corresponding clock nodes are shown below. + +Required properties: +- compatible : Shall be "apm,xgene-qmtm" +- reg : First memory resource shall be the QMTM register + memory resource. + Second memory resource shall be the QMTM IO-Fabric + memory resource. +- #mailbox-cells : Shall be 4 as it expects following arguments + First cell for 64-bit mailbox bus address MSB. + Second cell for 64-bit mailbox bus address LSB. + Third cell for 32-bit mailbox size. + Fourth cell for 32-bit mailbox signal/id value. +- interrupts : First interrupt resource shall be the QMTM Error + interrupt. + Remaining interrupt resources shall be the Ingress + work message interrupt mapping for receiver, + receiving work messages for the QMTM. +- clocks : Reference to the clock entry. + +Optional properties: +- status : Shall be "ok" if enabled or "disabled" if disabled. + Default is "ok". + +Example: + qmlclk: qmlclk { + compatible = "apm,xgene-device-clock"; + #clock-cells = <1>; + clock-names = "socplldiv2"; + status = "ok"; + csr-offset = <0x0>; + csr-mask = <0x3>; + enable-offset = <0x8>; + enable-mask = <0x3>; + }; + + qmlite: mailbox at 17030000 { + compatible = "apm,xgene-qmtm"; + #mailbox-cells = <4>; + status = "ok"; + reg = <0x0 0x17030000 0x0 0x10000>, + <0x0 0x10000000 0x0 0x400000>; + interrupts = <0x0 0x40 0x4>, + <0x0 0x3c 0x4>; + clocks = <&qmlclk 0>; + };
Signature · 1 line
1.7.9.5
PATCH v3 3/4 mailbox: xgene: base driver for APM X-Gene SoC QMTM
In reply to Ravi PatelThis patch adds APM X-Gene SoC Queue Manager/Traffic Manager base driver. QMTM is requried by Ethernet, PktDMA (XOR Engine) and Security subsystems.
--- MAINTAINERS | 9 + drivers/mailbox/Kconfig | 2 + drivers/mailbox/Makefile | 1 + drivers/mailbox/xgene/Kconfig | 9 + drivers/mailbox/xgene/Makefile | 7 + drivers/mailbox/xgene/xgene_qmtm_main.c | 516 ++++++++++++++++++++++++++++++ drivers/mailbox/xgene/xgene_qmtm_main.h | 112 +++++++ drivers/mailbox/xgene/xgene_qmtm_storm.c | 358 +++++++++++++++++++++ include/linux/platform_data/xgene_qmtm.h | 300 +++++++++++++++++ 9 files changed, 1314 insertions(+) create mode 100644 drivers/mailbox/xgene/Kconfig create mode 100644 drivers/mailbox/xgene/Makefile create mode 100644 drivers/mailbox/xgene/xgene_qmtm_main.c create mode 100644 drivers/mailbox/xgene/xgene_qmtm_main.h create mode 100644 drivers/mailbox/xgene/xgene_qmtm_storm.c create mode 100644 include/linux/platform_data/xgene_qmtm.h
MAINTAINERS +9 -0
@@ -678,6 +678,15 @@ S: Maintained F: drivers/net/appletalk/ F: net/appletalk/ +APPLIEDMICRO (APM) X-GENE SOC QUEUE MANAGER/TRAFFIC MANAGER (QMTM) DRIVER +M: Ravi Patel <[email protected]> +M: Keyur Chudgar <[email protected]> +S: Maintained +F: drivers/mailbox/xgene/ +F: include/linux/platform_data/xgene_qmtm.h +F: Documentation/devicetree/bindings/mailbox/apm-xgene-qmtm.txt +F: Documentation/mailbox/apm-xgene-qmtm + APTINA CAMERA SENSOR PLL M: Laurent Pinchart <[email protected]> L: linux-media at vger.kernel.org
drivers/mailbox/Kconfig +2 -0
@@ -50,4 +50,6 @@ config OMAP_MBOX_KFIFO_SIZE Specify the default size of mailbox's kfifo buffers (bytes). This can also be changed at runtime (via the mbox_kfifo_size module parameter). + +source "drivers/mailbox/xgene/Kconfig" endif
drivers/mailbox/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_OMAP1_MBOX) += mailbox_omap1.o mailbox_omap1-objs := mailbox-omap1.o obj-$(CONFIG_OMAP2PLUS_MBOX) += mailbox_omap2.o mailbox_omap2-objs := mailbox-omap2.o +obj-$(CONFIG_XGENE_MBOX) += xgene/
drivers/mailbox/xgene/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +config XGENE_MBOX + tristate "APM X-Gene Queue Manager/Traffic Manager Mailbox" + depends on ARM64 || COMPILE_TEST + default y + help + This option enables APM X-Gene Queue Manager Traffic Manager (QMTM) + mailbox support. + QMTM is required for Ethernet, PktDMA (XOR Engine) and Security + Engine.
drivers/mailbox/xgene/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for APM X-GENE Queue Manager Traffic Manager mailbox +# + +obj-$(CONFIG_XGENE_MBOX) += xgene-qmtm.o + +xgene-qmtm-objs := xgene_qmtm_main.o xgene_qmtm_storm.o
drivers/mailbox/xgene/xgene_qmtm_main.c new file +516 -0
516 lines not on this page · raw message
drivers/mailbox/xgene/xgene_qmtm_main.h new file +112 -0
112 lines not on this page · raw message
drivers/mailbox/xgene/xgene_qmtm_storm.c new file +358 -0
358 lines not on this page · raw message
include/linux/platform_data/xgene_qmtm.h new file +300 -0
300 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 4/4 arm64: boot: dts: entries for APM X-Gene SoC QMTM
In reply to Ravi PatelThis patch adds APM X-Gene SoC Queue Manager/Traffic Manager DTS entries.
--- arch/arm64/boot/dts/apm-storm.dtsi | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/apm-storm.dtsi +17 -1
@@ -148,10 +148,15 @@ compatible = "apm,xgene-device-clock"; #clock-cells = <1>; clocks = <&socplldiv2 0>; - clock-names = "qmlclk"; + clock-names = "socplldiv2"; reg = <0x0 0x1703C000 0x0 0x1000>; reg-names = "csr-reg"; clock-output-names = "qmlclk"; + status = "ok"; + csr-offset = <0x0>; + csr-mask = <0x3>; + enable-offset = <0x8>; + enable-mask = <0x3>; }; ethclk: ethclk {
@@ -187,5 +192,16 @@ interrupt-parent = <&gic>; interrupts = <0x0 0x4c 0x4>; }; + + qmlite: mailbox at 17030000 { + compatible = "apm,xgene-qmtm"; + #mailbox-cells = <4>; + status = "ok"; + reg = <0x0 0x17030000 0x0 0x10000>, + <0x0 0x10000000 0x0 0x400000>; + interrupts = <0x0 0x40 0x4>, + <0x0 0x3c 0x4>; + clocks = <&qmlclk 0>; + }; }; };
Signature · 1 line
1.7.9.5