misc: xgene: Add support for APM X-Gene SoC Queue Manager/Traffic Manager
Subsystems (4)
cover misc: 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 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.
Ravi Patel (4):
Documentation: Add documentation for APM X-Gene SoC Queue
Manager/Traffic Manager DTS binding
misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic
Manager
arm64: boot: dts: Add DTS entries for APM X-Gene SoC Queue
Manager/Traffic Manager
misc: xgene: Add error handling for APM X-Gene SoC Queue
Manager/Traffic Manager
.../devicetree/bindings/misc/apm-xgene-qmtm.txt | 52 ++ MAINTAINERS | 7 + arch/arm64/boot/dts/apm-storm.dtsi | 17 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/xgene/Kconfig | 1 + drivers/misc/xgene/Makefile | 5 + drivers/misc/xgene/qmtm/Kconfig | 8 + drivers/misc/xgene/qmtm/Makefile | 7 + drivers/misc/xgene/qmtm/xgene_qmtm_error.c | 287 ++++++++ drivers/misc/xgene/qmtm/xgene_qmtm_main.c | 768 ++++++++++++++++++++ drivers/misc/xgene/qmtm/xgene_qmtm_main.h | 143 ++++ drivers/misc/xgene/qmtm/xgene_qmtm_storm.c | 375 ++++++++++ drivers/misc/xgene/qmtm/xgene_qmtm_storm.h | 144 ++++ include/misc/xgene/xgene_qmtm.h | 282 +++++++ 15 files changed, 2098 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/apm-xgene-qmtm.txt create mode 100644 drivers/misc/xgene/Kconfig create mode 100644 drivers/misc/xgene/Makefile create mode 100644 drivers/misc/xgene/qmtm/Kconfig create mode 100644 drivers/misc/xgene/qmtm/Makefile create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_error.c create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_main.c create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_main.h create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_storm.c create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_storm.h create mode 100644 include/misc/xgene/xgene_qmtm.h
Signature · 9 lines
1.7.9.5 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Applied Micro Circuits Corporation or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. All unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
PATCH 1/4 Documentation: Add documentation for APM X-Gene SoC Queue Manager/Traffic Manager DTS binding
This patch adds device tree binding documentation for APM X-Gene SoC
Queue Manager/Traffic Manager.
--- .../devicetree/bindings/misc/apm-xgene-qmtm.txt | 51 ++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/apm-xgene-qmtm.txt
Documentation/devicetree/bindings/misc/apm-xgene-qmtm.txt new file +51 -0
@@ -0,0 +1,51 @@ +* APM X-Gene SOC Queue Manager/Traffic Manager nodes + +QMTM nodes are defined to describe on-chip Queue Managers in APM X-Gene SOC. +APM X-Gene SOC Ethernet, PktDMA, 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-lite" for QMLite instance +- reg : First memory resource shall be the QMTM CSR memory + resource. + Second memory resource shall be the QMTM IO-Fabric + memory resource. +- slave-name : Shall be "CPU_QMTM3" which is receiver for ingress + work messages for the QMTM. Here receiver is CPU. +- 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 = "qmlclk"; + status = "ok"; + csr-offset = <0x0>; + csr-mask = <0x3>; + enable-offset = <0x8>; + enable-mask = <0x3>; + }; + + qmlite: qmtm at 17030000 { + compatible = "apm,xgene-qmtm-lite"; + reg = <0x0 0x17030000 0x0 0x10000>, + <0x0 0x10000000 0x0 0x400000>; + slave-name = "CPU_QMTM3"; + interrupts = <0x0 0x40 0x4>, + <0x0 0x3c 0x4>; + status = "ok"; + #clock-cells = <1>; + clocks = <&qmlclk 0>; + };
Signature · 9 lines
1.7.9.5 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Applied Micro Circuits Corporation or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. All unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
PATCH 2/4 misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic Manager
In reply to Ravi PatelThis patch adds APM X-Gene SoC Queue Manager/Traffic Manager base driver.
QMTM is requried by Ethernet, PktDMA and Security Engine subsystems.
--- MAINTAINERS | 7 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/xgene/Kconfig | 1 + drivers/misc/xgene/Makefile | 5 + drivers/misc/xgene/qmtm/Kconfig | 8 + drivers/misc/xgene/qmtm/Makefile | 7 + drivers/misc/xgene/qmtm/xgene_qmtm_main.c | 765 ++++++++++++++++++++++++++++ drivers/misc/xgene/qmtm/xgene_qmtm_main.h | 139 +++++ drivers/misc/xgene/qmtm/xgene_qmtm_storm.c | 375 ++++++++++++++ drivers/misc/xgene/qmtm/xgene_qmtm_storm.h | 144 ++++++ include/misc/xgene/xgene_qmtm.h | 282 ++++++++++ 12 files changed, 1735 insertions(+) create mode 100644 drivers/misc/xgene/Kconfig create mode 100644 drivers/misc/xgene/Makefile create mode 100644 drivers/misc/xgene/qmtm/Kconfig create mode 100644 drivers/misc/xgene/qmtm/Makefile create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_main.c create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_main.h create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_storm.c create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_storm.h create mode 100644 include/misc/xgene/xgene_qmtm.h
MAINTAINERS +7 -0
@@ -665,6 +665,13 @@ 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/misc/xgene/ +F: include/misc/xgene/xgene_qmtm.h + APTINA CAMERA SENSOR PLL M: Laurent Pinchart <[email protected]> L: linux-media at vger.kernel.org
drivers/misc/Kconfig +1 -0
@@ -525,4 +525,5 @@ source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" source "drivers/misc/vmw_vmci/Kconfig" source "drivers/misc/mic/Kconfig" +source "drivers/misc/xgene/Kconfig" endmenu
drivers/misc/Makefile +1 -0
@@ -53,3 +53,4 @@ obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/ obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o obj-$(CONFIG_SRAM) += sram.o obj-y += mic/ +obj-$(CONFIG_ARCH_XGENE) += xgene/
drivers/misc/xgene/Kconfig new file +1 -0
@@ -0,0 +1 @@ +source "drivers/misc/xgene/qmtm/Kconfig"
drivers/misc/xgene/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile for APM X-GENE misc drivers. +# + +obj-$(CONFIG_XGENE_QMTM) += qmtm/
drivers/misc/xgene/qmtm/Kconfig new file +8 -0
@@ -0,0 +1,8 @@ +config XGENE_QMTM + tristate "APM X-Gene QMTM driver" + depends on ARCH_XGENE + default n + help + This option enables APM X-Gene Queue Manager Traffic Manager (QMTM) + driver support. + QMTM is required for Ethernet, PktDMA and Security Engine.
drivers/misc/xgene/qmtm/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for APM X-GENE Queue Manager Traffic Manager driver. +# + +obj-$(CONFIG_XGENE_QMTM) += xgene-qmtm.o + +xgene-qmtm-objs := xgene_qmtm_main.o xgene_qmtm_storm.o
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +765 -0
765 lines not on this page · raw message
drivers/misc/xgene/qmtm/xgene_qmtm_main.h new file +139 -0
139 lines not on this page · raw message
drivers/misc/xgene/qmtm/xgene_qmtm_storm.c new file +375 -0
375 lines not on this page · raw message
drivers/misc/xgene/qmtm/xgene_qmtm_storm.h new file +144 -0
144 lines not on this page · raw message
include/misc/xgene/xgene_qmtm.h new file +282 -0
282 lines not on this page · raw message
Signature · 9 lines
1.7.9.5 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Applied Micro Circuits Corporation or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. All unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
PATCH 3/4 arm64: boot: dts: Add DTS entries for APM X-Gene SoC Queue Manager/Traffic Manager
In reply to Ravi PatelThis patch adds APM X-Gene SoC Queue Manager/Traffic Manager DTS entries.
--- arch/arm64/boot/dts/apm-storm.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm64/boot/dts/apm-storm.dtsi +17 -0
@@ -152,6 +152,11 @@ 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,17 @@ interrupt-parent = <&gic>; interrupts = <0x0 0x4c 0x4>; }; + + qmlite: qmtm at 17030000 { + compatible = "apm,xgene-qmtm-lite"; + reg = <0x0 0x17030000 0x0 0x10000>, + <0x0 0x10000000 0x0 0x400000>; + slave-name = "CPU_QMTM3"; + interrupts = <0x0 0x40 0x4>, + <0x0 0x3c 0x4>; + status = "ok"; + #clock-cells = <1>; + clocks = <&qmlclk 0>; + }; }; };
Signature · 9 lines
1.7.9.5 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Applied Micro Circuits Corporation or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. All unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
PATCH 4/4 misc: xgene: Add error handling for APM X-Gene SoC Queue Manager/Traffic Manager
In reply to Ravi PatelThis patch adds support for error handling in APM X-Gene SoC Queue
Manager/Traffic Manager.
--- drivers/misc/xgene/qmtm/Makefile | 2 +- drivers/misc/xgene/qmtm/xgene_qmtm_error.c | 288 ++++++++++++++++++++++++++++ drivers/misc/xgene/qmtm/xgene_qmtm_main.c | 6 +- drivers/misc/xgene/qmtm/xgene_qmtm_main.h | 4 + 4 files changed, 298 insertions(+), 2 deletions(-) create mode 100644 drivers/misc/xgene/qmtm/xgene_qmtm_error.c
drivers/misc/xgene/qmtm/Makefile +1 -1
@@ -4,4 +4,4 @@ obj-$(CONFIG_XGENE_QMTM) += xgene-qmtm.o -xgene-qmtm-objs := xgene_qmtm_main.o xgene_qmtm_storm.o +xgene-qmtm-objs := xgene_qmtm_main.o xgene_qmtm_storm.o xgene_qmtm_error.o
drivers/misc/xgene/qmtm/xgene_qmtm_error.c new file +288 -0
288 lines not on this page · raw message
drivers/misc/xgene/qmtm/xgene_qmtm_main.c +5 -1
@@ -592,13 +592,17 @@ static int xgene_qmtm_enable(struct xgene_qmtm *qmtm) qmtm->write_qstate (&qinfo); } -return rc; +/* Enable error reporting */ +return xgene_qmtm_enable_error (qmtm); }static int xgene_qmtm_disable (struct xgene_qmtm *qmtm) {u32 queue_id; +/* Disable error reporting */ +xgene_qmtm_disable_error (qmtm); +for (queue_id =0 ; queue_id < qmtm->max_queues; queue_id++) {if (qmtm->qinfo[queue_id]) { dev_err(&qmtm->pdev->dev,
drivers/misc/xgene/qmtm/xgene_qmtm_main.h +4 -0
@@ -134,6 +134,10 @@ enum xgene_qmtm_fp_mode {void xgene_qmtm_wr32 (struct xgene_qmtm *qmtm,u32 offset,u32 data);void xgene_qmtm_rd32 (struct xgene_qmtm *qmtm,u32 offset,u32 *data); +/* QMTM Error handling */ +int xgene_qmtm_enable_error (struct xgene_qmtm *qmtm); +void xgene_qmtm_disable_error (struct xgene_qmtm *qmtm); +struct xgene_qmtm_sdev *storm_qmtm_get_sdev (char *name);#endif /* __XGENE_QMTM_MAIN_H__ */
Signature · 9 lines
1.7.9.5 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Applied Micro Circuits Corporation or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. All unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Greg KH
maintainerRe: [PATCH 2/4] misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic Manager
In reply to Ravi Pateldrivers/misc/xgene/qmtm/Kconfig line 3
Quoted 6 lines · Ravi Patel
drivers/misc/xgene/qmtm/Kconfig new file +3
-0@@ -0,0 +1,8 @@ +config XGENE_QMTM + tristate "APM X-Gene QMTM driver" + depends on ARCH_XGENE
What does it need from this arch in order to build? What would be needed to get it to build on other arches so that it gets some actualy build testing?
Quoted 4 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +1
-0@@ -0,0 +1,765 @@ +/*
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 11
Quoted 10 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +10
-0+* AppliedMicro X-Gene SOC Queue Manager/Traffic Manager driver +* +* Copyright (c) 2013 Applied Micro Circuits Corporation. +* Author: Ravi Patel <[email protected]> +* Keyur Chudgar <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version.
Are you _sure_ about "any later version"? I have to ask.
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 19
Quoted 7 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +7
-0+* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>.
No need for this paragraph, the kernel has a copy of the GPL in it already.
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 41
Quoted 8 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +8
-0+/* CSR Address Macros */ +#define CSR_QM_CONFIG_ADDR 0x00000004 +#define QM_ENABLE_WR (src) (((u32)(src)<<31) & 0x80000000) + +#define CSR_PBM_ADDR 0x00000008 +#define OVERWRITE_WR (src) (((u32)(src)<<31) & 0x80000000) +#define SLVID_PBN_WR (src) (((u32)(src)) & 0x000003ff) +#define SLAVE_ID_SHIFT 6
Interesting way to align #defines, that's going to break badly over time, please just left align them like the rest of the kernel, using tabs.
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 294
Quoted 1 line
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +1
-0+EXPORT_SYMBOL (xgene_qmtm_set_qinfo);
EXPORT_SYMBOL_GPL() for this and the other exports perhaps? (sorry, I have to ask.)
Quoted 34 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +34
-0+/* +* Physical or free pool queue state (pq or fp) +*/ +struct storm_qmtm_pq_fp_qstate { +/* word 0 31:0 */ +u32 resize_qid:10 ; +u32 resize_start:1 ; +u32 resize_done:1 ; +u32 cfgtmvqen:1 ;/* enable pq to belong to vq */ +u32 cfgtmvq:10 ;/* parent vq */ +u32 cfgsaben:1 ;/* enable SAB broadcasting */ +u32 cpu_notify:8 ;/* cfgcpusab */ + +/* word 1 63:32 */ +u32 cfgnotifyqne:1 ;/* enable queue not empty interrupt */ +u32 nummsg:16 ; +u32 headptr:15 ; + +/* word 2 95:64 */ +u32 cfgcrid:1 ; +u32 rid:3 ; +u32 qcoherent:1 ; +u64 cfgstartaddr:34 ;/* 27/7 split */ + +/* word 3 127:96 */ +u32 vc_chanctl:2 ; +u32 vc_chanid:2 ; +u32 slot_pending:6 ; +u32 stashing:1 ; +u32 reserved_0:1 ; +u32 cfgacceptlerr:1 ; +u32 fp_mode:3 ;/* free pool mode */ +u32 cfgqsize:3 ;/* queue size, see xgene_qmtm_qsize */ +u32 qstatelock:1 ;
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 71
Quoted 10 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +10
-0+ u32 cfgRecombBuf:1; + u32 cfgRecombBufTimeoutL:4; /* 4/3 split */ + +/* word 4 159:128 */ + u32 cfgRecombBufTimeoutH:3; /* 4/3 split */ + u32 cfgselthrsh:3; /* associated threshold set */ + u32 resv2:13; + u32 cfgqtype:2; /* queue type, refer xgene_qmtm_qtype */ + u32 resv1:11; +} __packed;
u64 for a bitfield? Is that even valid C? This is pretty scary from a bitfield perspective, what about different endian and addressing modes?
Any chance to just use shifts to access the fields properly, like most drivers do, in a endian-neutral way to get the data out and into the structures?
Same goes for the other structures in this file.
thanks,
greg k-h
Greg KH
maintainerRe: [PATCH 2/4] misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic Manager
In reply to Ravi PatelQuoted 2 lines · Ravi Patel
This patch adds APM X-Gene SoC Queue Manager/Traffic Manager base driver.
QMTM is requried by Ethernet, PktDMA and Security Engine subsystems.
How does this driver talk to userspace? Or is it just a "bus" for devices to attach to and use to talk to the real devices in the system? If so, why isn't it represented in the driver model?
thanks,
greg k-h
Greg KH
maintainerQuoted 5 lines · Ravi Patel
This patch adds support for APM X-Gene SoC Queue Manager/Traffic Manager.
QMTM is required by APM X-Gene SoC Ethernet, PktDMA 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.
And finally, where are the drivers that are going to use these apis you are creating here? Where are they going to live, and when are they going to be submitted?
thanks,
greg k-h
Greg KH
maintainerA: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
Quoted 2 lines · Ravi Patel
APM X-Gene SoC Ethernet driver is planned to be submitted on Dec 20 2013. Ethernet driver will be using these exported API's from QMTM driver.
Please submit a user of the api as part of the series, otherwise we can't evaluate if it's really the correct thing to do or not.
Quoted 2 lines
The APM X-Gene SoC Ethernet driver is going to live in drivers/net/ethernet/apm /xgene.
So this is a "bus"? How is the ethernet device going to show up in sysfs as a parent of what as this isn't part of the driver model?
greg k-h
Greg KH
maintainerRe: [PATCH 2/4] misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic Manager
In reply to a message not in the archiveA: Top-posting.
Q: What is the most annoying thing in e-mail?
http://daringfireball.net/2007/07/on_top
Quoted 9 lines · Ravi Patel
There is no need to talk to this driver from userspace.
It is a device which is used by other IO devices to communicate with each other, including CPU.
For example, if CPU (software) wants to send a message to Ethernet HW (i.e. send packet),
it used this driver to enqueue a message to Ethernet.
In other direction, if Ethernet HW receives a packet, it uses QM/TM device to send message to
CPU (software) to process packet.
So it's a "bus" type of thing, right?
My question of "why isn't this reflected in the driver model" still stands.
thanks,
greg k-h
Quoted 7 lines
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and contains information
that is confidential and proprietary to Applied Micro Circuits Corporation or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. All unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Well this definitely has nothing to do with any business relationship that may exist between AMCC and Solarflare, so please don't send any more of these messages either directly or via netdev.
David, you'd better let all the netdev archives know to delete these messages... ;-)
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Greg KH
maintainerQuoted 11 lines · Ben Hutchings
Quoted 7 lines
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and contains information
that is confidential and proprietary to Applied Micro Circuits Corporation or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. All unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.Well this definitely has nothing to do with any business relationship that may exist between AMCC and Solarflare, so please don't send any more of these messages either directly or via netdev.
Ah crap, that means I have to delete these all from my mailboxes as well.
Ravi, I can't take any patch or communication that has this type of footer as it's in direct contradiction with open source development practices and the license of our code.
Please fix your email system.
greg k-h
Re: [PATCH 2/4] misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic Manager
In reply to Greg KHQuoted 11 lines · Greg KH
drivers/misc/xgene/qmtm/Kconfig line 3
Quoted 6 lines · Ravi Patel
drivers/misc/xgene/qmtm/Kconfig new file +3
-0@@ -0,0 +1,8 @@ +config XGENE_QMTM + tristate "APM X-Gene QMTM driver" + depends on ARCH_XGENEWhat does it need from this arch in order to build? What would be needed to get it to build on other arches so that it gets some actualy build testing?
In patch v2 added, depends on ARM64 || COMPILE_TEST in order to support build testing for other arches.
If you think we should have no dependency at all, let us know.
Quoted 8 lines
Quoted 8 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +5
-0@@ -0,0 +1,765 @@ +/* +* AppliedMicro X-Gene SOC Queue Manager/Traffic Manager driver +* +* Copyright (c) 2013 Applied Micro Circuits Corporation. +* Author: Ravi Patel <[email protected]>
Quoted 8 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 11
Quoted 6 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +6
-0+* Keyur Chudgar <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. Are you _sure_ about "any later version"? I have to ask.
In patch v2, removed "any later version" from this phrase.
Quoted 10 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 19
Quoted 7 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +7
-0+* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. No need for this paragraph, the kernel has a copy of the GPL in it already.
Removed the paragraph from the license banner in patch v2.
Quoted 4 lines
Quoted 4 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +4
-0+/* CSR Address Macros */ +#define CSR_QM_CONFIG_ADDR 0x00000004 +#define QM_ENABLE_WR (src) (((u32)(src)<<31) & 0x80000000) +
Quoted 8 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 41
Quoted 4 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +4
-0+#define CSR_PBM_ADDR 0x00000008 +#define OVERWRITE_WR (src) (((u32)(src)<<31) & 0x80000000) +#define SLVID_PBN_WR (src) (((u32)(src)) & 0x000003ff) +#define SLAVE_ID_SHIFT 6Interesting way to align #defines, that's going to break badly over time, please just left align them like the rest of the kernel, using tabs.
Fixed the macro alignment to left align using tabs in patch v2.
Quoted 4 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 294
Quoted 1 line
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +1
-0+EXPORT_SYMBOL (xgene_qmtm_set_qinfo);
EXPORT_SYMBOL_GPL()for this and the other exports perhaps? (sorry, I have to ask.)
Changed export to EXPORT_SYMBOL_GPL in patch v2.
Quoted 39 lines
Quoted 39 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +39
-0+/* +* Physical or free pool queue state (pq or fp) +*/ +struct storm_qmtm_pq_fp_qstate { +/* word 0 31:0 */ +u32 resize_qid:10 ; +u32 resize_start:1 ; +u32 resize_done:1 ; +u32 cfgtmvqen:1 ;/* enable pq to belong to vq */ +u32 cfgtmvq:10 ;/* parent vq */ +u32 cfgsaben:1 ;/* enable SAB broadcasting */ +u32 cpu_notify:8 ;/* cfgcpusab */ + +/* word 1 63:32 */ +u32 cfgnotifyqne:1 ;/* enable queue not empty interrupt */ +u32 nummsg:16 ; +u32 headptr:15 ; + +/* word 2 95:64 */ +u32 cfgcrid:1 ; +u32 rid:3 ; +u32 qcoherent:1 ; +u64 cfgstartaddr:34 ;/* 27/7 split */ + +/* word 3 127:96 */ +u32 vc_chanctl:2 ; +u32 vc_chanid:2 ; +u32 slot_pending:6 ; +u32 stashing:1 ; +u32 reserved_0:1 ; +u32 cfgacceptlerr:1 ; +u32 fp_mode:3 ;/* free pool mode */ +u32 cfgqsize:3 ;/* queue size, see xgene_qmtm_qsize */ +u32 qstatelock:1 ; +u32 cfgRecombBuf:1 ; +u32 cfgRecombBufTimeoutL:4 ;/* 4/3 split */ + +/* word 4 159:128 */ +u32 cfgRecombBufTimeoutH:3 ;/* 4/3 split */
Quoted 8 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c line 71
Quoted 5 lines
drivers/misc/xgene/qmtm/xgene_qmtm_main.c new file +5
-0+ u32 cfgselthrsh:3; /* associated threshold set */ + u32 resv2:13; + u32 cfgqtype:2; /* queue type, refer xgene_qmtm_qtype */ + u32 resv1:11; +} __packed;u64 for a bitfield? Is that even valid C? This is pretty scary from a bitfield perspective, what about different endian and addressing modes?
Currently the patch is supporting only ARM64 LE mode.
We will fix u64 bit-field with multiple u32 bit-fields for supporting ARM32 LE Mode.
Quoted 5 lines
Any chance to just use shifts to access the fields properly, like most drivers do, in a endian-neutral way to get the data out and into the structures?
Same goes for the other structures in this file.
I agree with you that code with bit-mask and bit-shift takes care for endian-neutral mode.
But QMTM in BE Mode, behaves differently by expecting message format in memory as follow:
Swapping at 128 bits level.
a. For each 16 bytes, group of 4 bytes needs be swapped Higher to lower <-> lower to higher,
b. As well as each bytes/bit fields in the group of 4 bytes also needs to be swapped.
So because of 128 bit level swap, there will be complete different code for bit-mask, bit-shift for BE and LE
So to support ARM64 BE and ARM32 BE, we are planning to just re-arrange bit-fields reversely in the structures for BE and LE.
Regards,
Ravi
Greg KH
maintainerRe: [PATCH 2/4] misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic Manager
Quoted 13 lines · Ravi Patel
Quoted 11 lines · Greg KH
drivers/misc/xgene/qmtm/Kconfig line 3
Quoted 6 lines · Ravi Patel
drivers/misc/xgene/qmtm/Kconfig new file +3
-0@@ -0,0 +1,8 @@ +config XGENE_QMTM + tristate "APM X-Gene QMTM driver" + depends on ARCH_XGENEWhat does it need from this arch in order to build? What would be needed to get it to build on other arches so that it gets some actualy build testing?
Quoted 3 lines
In patch v2 added, depends on ARM64 ||
COMPILE_TESTin order to support build testing for other arches.
If you think we should have no dependency at all, let us know.
That's fine, but it's pretty obvious you didn't check this as your v2 version can't build on non XGENE systems :(
Quoted 6 lines
Quoted 2 lines
u64 for a bitfield? Is that even valid C? This is pretty scary from a bitfield perspective, what about different endian and addressing modes?
Currently the patch is supporting only ARM64 LE mode.
We will fix u64 bit-field with multiple u32 bit-fields for supporting ARM32 LE Mode.
Don't use bitfields, use bit shifts, that way it doesn't matter what endian the system is that it is running on at all.
Quoted 6 lines
Quoted 5 lines
Any chance to just use shifts to access the fields properly, like most drivers do, in a endian-neutral way to get the data out and into the structures?
Same goes for the other structures in this file.
Quoted 13 lines
I agree with you that code with bit-mask and bit-shift takes care for endian-neutral mode.
But QMTM in BE Mode, behaves differently by expecting message format in memory as follow:
Swapping at 128 bits level.
a. For each 16 bytes, group of 4 bytes needs be swapped Higher to lower <-> lower to higher,
b. As well as each bytes/bit fields in the group of 4 bytes also needs to be swapped.
So because of 128 bit level swap, there will be complete different code for bit-mask, bit-shift for BE and LE
So to support ARM64 BE and ARM32 BE, we are planning to just re-arrange bit-fields reversely in the structures for BE and LE.
I'll hold off and wait to see what you create, but I think it will be more complex than just using a bit shift...
good luck,
greg k-h
Re: [PATCH 2/4] misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic Manager
In reply to Greg KHQuoted 11 lines · Ravi Patel
Quoted 9 lines
There is no need to talk to this driver from userspace.
It is a device which is used by other IO devices to communicate with each other, including CPU.
For example, if CPU (software) wants to send a message to Ethernet HW (i.e. send packet),
it used this driver to enqueue a message to Ethernet.
In other direction, if Ethernet HW receives a packet, it uses QM/TM device to send message to
CPU (software) to process packet.
Quoted 4 lines
So it's a "bus" type of thing, right?
My question of "why isn't this reflected in the driver model" still stands.
There is no subsystem underneath QMTM, nor QMTM does any enumeration. QMTM is a centralized resource manager which manages queues circularly for Ethernet, PktDMA (XOR Engine) and Security Engine subsystems. Traffic Management feature of QMTM does flow control, QoS for the subsystems. Because of this reasons, its not obvious that QMTM can fit as a bus. However we are doing further evalution on this.
Thanks,
Ravi
Greg KH
maintainerRe: [PATCH 2/4] misc: xgene: Add base driver for APM X-Gene SoC Queue Manager/Traffic Manager
Quoted 16 lines · Ravi Patel
Quoted 11 lines · Ravi Patel
Quoted 9 lines
There is no need to talk to this driver from userspace.
It is a device which is used by other IO devices to communicate with each other, including CPU.
For example, if CPU (software) wants to send a message to Ethernet HW (i.e. send packet),
it used this driver to enqueue a message to Ethernet.
In other direction, if Ethernet HW receives a packet, it uses QM/TM device to send message to
CPU (software) to process packet.Quoted 4 lines
So it's a "bus" type of thing, right?
My question of "why isn't this reflected in the driver model" still stands.
Quoted 6 lines
There is no subsystem underneath QMTM, nor QMTM does any enumeration. QMTM is a centralized resource manager which manages queues circularly for Ethernet, PktDMA (XOR Engine) and Security Engine subsystems. Traffic Management feature of QMTM does flow control, QoS for the subsystems. Because of this reasons, its not obvious that QMTM can fit as a bus. However we are doing further evalution on this.
Just because you can't enumerate a device, doesn't mean it isn't a "bus". You say so yourself that this is how devices talk to the hardware, so that sounds like a "bus" to me...
greg k-h